From 24a65b8497eb20e97624b594b6a26d2d11cd5967 Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Mon, 24 Aug 2026 13:37:42 +0300 Subject: [PATCH 01/15] update makefile help command and fix the issue with shellcheck target --- makefile | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile index 9c3d251..f5e6c63 100644 --- a/makefile +++ b/makefile @@ -1,10 +1,15 @@ .PHONY: all bashism shellcheck typos +SCRIPT_VERSION=v1.0 +SCRIPT_AUTHOR=tonytech + ROOT_DIR = . LOG_DIR = logging OUTPUT_PATH = $(ROOT_DIR)/$(LOG_DIR) -OUTPUT_OUT = $(OUTPUT_PATH)/$(PHASE).out -OUTPUT_ERR = $(OUTPUT_PATH)/$(PHASE).err +# OUTPUT_OUT = $(OUTPUT_PATH)/$(PHASE).out +# OUTPUT_ERR = $(OUTPUT_PATH)/$(PHASE).err +OUTPUT_OUT = $(OUTPUT_PATH)/$(strip $(PHASE)).out +OUTPUT_ERR = $(OUTPUT_PATH)/$(strip $(PHASE)).err OUTPUT = 1>$(OUTPUT_OUT) 2>$(OUTPUT_ERR) SHELL_SCRIPTS := $(shell find $(ROOT_DIR) -type f -name '*.sh' \ @@ -14,7 +19,10 @@ SHELL_SCRIPTS := $(shell find $(ROOT_DIR) -type f -name '*.sh' \ all: bashism shellchek typos ## Do all checks help: ## Show this help. - @grep -E -h '\s##\s' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-30s\033[0m %s\n", $$1, $$2}'\ + @echo -e "\nUsage: make [target] ...\n" + @grep -E -h '\s##\s' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-30s\033[0m %s\n", $$1, $$2}' + @echo -e "\nWritten by $(SCRIPT_AUTHOR), version $(SCRIPT_VERSION)" + @echo -e "Please report any bug or error to the author." $(OUTPUT_PATH): @mkdir -p $(OUTPUT_PATH) @@ -37,7 +45,7 @@ bashism: $(OUTPUT_PATH) echo "bashism check failed, see $(OUTPUT_ERR)"; \ fi -shellchek: PHASE = shellchek ## Check for shell issues +shellchek: PHASE = shellcheck ## Check for shell issues shellchek: $(OUTPUT_PATH) @echo "***Checking for shell issues..." @shellcheck $(SHELL_SCRIPTS) $(OUTPUT); \ @@ -56,3 +64,8 @@ typos: $(OUTPUT_PATH) echo "typos check failed, see $(OUTPUT_ERR)"; \ exit $$status; \ fi + +clean: PHASE = clean ## Clean all logs +clean: $(OUTPUT_PATH) + @echo "*** Clean all logs from previous executions..." + @rm -rf $(OUTPUT_PATH) From 2a1eeab787f93b558256a205050da1a99afeca8c Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Mon, 24 Aug 2026 14:38:44 +0300 Subject: [PATCH 02/15] update .vimrc --- .vimrc | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 169 insertions(+), 1 deletion(-) diff --git a/.vimrc b/.vimrc index de2e53c..96aa382 100644 --- a/.vimrc +++ b/.vimrc @@ -1 +1,169 @@ -set number \ No newline at end of file +syntax on +" Enable syntax highlighting + +set fileformat=unix +" Use Unix line endings (LF) for files, not Windows (CRLF) or old Mac (CR) + +set encoding=UTF-8 +" Set internal character encoding to UTF-8 + +au BufNewFile,BufRead *.py + \ set tabstop=4 | + \ set softtabstop=4 | + \ set shiftwidth=4 | +" Autocommand: when opening/creating a .py file, override indent settings +" to use 4 spaces (Python convention) instead of the global 2-space setting below. +" tabstop=4 -> a literal tab character displays as 4 columns wide +" softtabstop=4 -> pressing Tab/Backspace acts like 4 spaces +" shiftwidth=4 -> autoindent / >> << shift by 4 spaces +" (note: trailing `|` after the last line is harmless but unnecessary since +" it's the last command in the chain) + +set tabstop=2 +" Global default: a tab character displays as 2 columns wide + +set softtabstop=2 +" Global default: Tab/Backspace insert/remove 2 spaces at a time + +set shiftwidth=2 +" Global default: indentation commands (>>, <<, autoindent) shift by 2 spaces + +set autoindent +" Copy the indentation from the current line when starting a new line + +set smartindent +" Add some C-like smart auto-indenting (e.g. after `{`), language-agnostic heuristic + +set smarttab +" Tab/Backspace at the start of a line respect shiftwidth/tabstop settings intelligently + +set expandtab +" Convert typed tabs into spaces (uses tabstop/softtabstop width) + +set nowrap +" Don't visually wrap long lines onto the next screen line; let them extend off-screen + +set nolist +" Show "invisible" characters (tabs, trailing spaces, etc.) using listchars below + +set listchars=eol:.,tab:>-,trail:~,extends:>,precedes:< +" Define how invisible characters are displayed: +" eol:. -> end of line shown as . +" tab:>- -> tabs shown as >---- +" trail:~ -> trailing whitespace shown as ~ +" extends:> -> line continues beyond right edge of screen (nowrap) shown as > +" precedes:< -> line extends beyond left edge (when scrolled) shown as + +set cursorline +" Highlight the screen line the cursor is currently on + +set number +" Show absolute line number on the current line + +"set relativenumber +" Show relative line numbers on all other lines (combined with `number`, +" this gives "hybrid" line numbers — great for motions like 5j / 3dd) + +set scrolloff=8 +" Keep at least 8 lines visible above/below the cursor when scrolling + +set signcolumn=yes +" Always show the sign column (used by linters/git plugins for markers), +" preventing text from shifting left/right when signs appear/disappear + +set showcmd +" Show partially-typed commands in the bottom right (e.g. while typing "2dd") + +set showmode +" Show -- INSERT --/-- VISUAL -- etc. in the command line +" (usually because a statusline plugin already shows the mode) + +set conceallevel=1 +" Enable "conceal" — hide/replace certain syntax (e.g. markdown `**bold**` +" markers, or LaTeX symbols) with a nicer visual representation, if the +" filetype's syntax defines conceal rules + +set shortmess+=c +" Suppress completion-menu messages like "match 1 of 4" or "Pattern not found" +" (reduces noise, especially with autocomplete plugins) + +set formatoptions-=cro +" Disable auto-continuation of comments: +" c -> auto-wrap comments using textwidth +" r -> auto-insert comment leader after in insert mode +" o -> auto-insert comment leader after 'o'/'O' in normal mode +" Removing these stops Vim from automatically adding "// " or "# " etc. +" on new lines when you're writing/editing comments + +set noerrorbells visualbell t_vb= +" Disable the audible error bell (noerrorbells), enable "visual bell" instead, +" but then set the visual bell terminal code to empty (t_vb=), effectively +" silencing/disabling both audible and visual bells entirely + +set noswapfile +" Don't create .swp swap files + +set nobackup +" Don't create backup~ files when overwriting a file + +set undodir=~/.vim/undodir +" Directory where persistent undo history files are stored +" (must exist beforehand, or undofile below will fail silently for new files) + +set undofile +" Save undo history to disk per-file, so you can undo changes even after +" closing and reopening the file + +set clipboard=unnamed +" Use the system clipboard as the default register (yank/paste integrates +" with OS copy-paste); "unnamed" maps to the "* register (primary/select +" on Linux, or system clipboard on macOS/Windows) + +set ignorecase +" Make search patterns case-insensitive by default + +set smartcase +" Override ignorecase: if the search pattern contains an uppercase letter, +" search becomes case-sensitive (only takes effect when ignorecase is also set) + +set incsearch +" Show search matches incrementally as you type the pattern + +set hlsearch +" Highlight all matches of the current search pattern + +nnoremap :noh: +" Remap Enter in Normal mode to clear search highlighting (:noh) and then +" re-execute Enter's normal behavior. Breakdown: +" :noh -> run ":nohlsearch" (turn off highlight until next search) +" -> literal Enter, executing the :noh command +" : -> opens command-line then immediately backspaces out of it +" (a no-op trick, likely leftover/defensive coding to avoid +" disrupting Enter's normal cursor-move behavior in some contexts) + +"-- COLOR & THEME CONFIG +" Just a comment header/divider (starts with " which is Vim's comment character) + +set termguicolors +" Enable 24-bit RGB true color in the terminal (needed for accurate theme colors, +" requires a terminal emulator that supports it) + +set background=dark +" Tell Vim/the colorscheme to use its dark variant +" (note: setting this AFTER `colorscheme` can sometimes require the +" colorscheme to reload; some configs set background before colorscheme instead) + +hi Normal guibg=NONE ctermbg=NONE +" Override the "Normal" highlight group to have no background color, +" making the editor background transparent (shows your terminal's own +" background, e.g. for terminal transparency effects) in both GUI (guibg) +" and terminal (ctermbg) modes + +let g:terminal_ansi_colors = [ + \ '#282828', '#cc241d', '#98971a', '#d79921', '#458588', '#b16286', '#689d6a', '#a89984', + \ '#928374', '#fb4934', '#b8bb26', '#fabd2f', '#83a598', '#d3869b', '#8ec07c', '#ebdbb2', +\] +" Define the 16-color ANSI palette (gruvbox colors) used by Vim's built-in +" :terminal emulator, so terminal buffers opened inside Vim match the +" gruvbox theme. Order is the standard ANSI 0-15: black, red, green, yellow, +" blue, magenta, cyan, white, then their "bright" counterparts From c9651450af214f01b4d4b11e57ac8aee69c91a92 Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Tue, 25 Aug 2026 10:59:06 +0300 Subject: [PATCH 03/15] update .stow-local-ignore to exclde scripts folder --- .stow-local-ignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.stow-local-ignore b/.stow-local-ignore index c8fb29d..2eee89b 100644 --- a/.stow-local-ignore +++ b/.stow-local-ignore @@ -5,4 +5,5 @@ setup.sh LICENSE README.md installation.log -makefile \ No newline at end of file +makefile +scripts \ No newline at end of file From 44883a0eadb4ce1b5a26ae399fc7da7e858fd4c8 Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Tue, 25 Aug 2026 13:46:53 +0300 Subject: [PATCH 04/15] add nerd font installation --- scripts/install-nerd-font.sh | 53 ++++++++++++++++++++++++++++++++++++ scripts/variables | 3 +- setup.sh | 1 + 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 scripts/install-nerd-font.sh diff --git a/scripts/install-nerd-font.sh b/scripts/install-nerd-font.sh new file mode 100644 index 0000000..ce55c72 --- /dev/null +++ b/scripts/install-nerd-font.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +################################################################################## +##### Function to authenticate sudo early +################################################################################## + +install_nerd_font() { + + print_step "Install Nerd font" + start_spinner "Installing..." + + { + local message + + if fc-list 2>/dev/null | grep -qi "$NERD_FONT_FAMILY"; then + message="$(msg_skip "$NERD_FONT_FAMILY")" + else + font_temp_dir=$(mktemp -d) + font_archive="$font_temp_dir/JetBrainsMono.tar.xz" + font_unpack_dir="$font_temp_dir/unpacked" + font_dir="$HOME/.local/share/fonts/JetBrainsMonoNerdFont" + mkdir -p "$font_unpack_dir" "$font_dir" + + if ! curl -fsSL "$NERD_FONT_URL" -o "$font_archive"; then + rm -rf "$font_temp_dir" + message="$(msg_err "Failed to download ${BOLD}$NERD_FONT_FAMILY${RC}! Check ${BOLD}${LOG_FILE}${RC} for details.")" + fi + if ! tar -xJf "$font_archive" -C "$font_unpack_dir"; then + rm -rf "$font_temp_dir" + message="$(msg_err "Failed to extract ${BOLD}$NERD_FONT_FAMILY${RC}! Check ${BOLD}${LOG_FILE}${RC} for details.")" + fi + + find "$font_unpack_dir" -type f -name 'JetBrainsMonoNerdFont-*.ttf' -exec cp {} "$font_dir"/ \; + font_found= + for font_file in "$font_dir"/*.ttf; do + if [ -f "$font_file" ]; then + font_found=1 + break + fi + done + rm -rf "$font_temp_dir" + + if [ -z "$font_found" ]; then + message="$(msg_err "No standard JetBrainsMono Nerd Font files were found in the archive.")" + fi + + fc-cache -f >/dev/null 2>&1 + message="$(msg_ok "$NERD_FONT_FAMILY installed.")" + fi + } >> "$LOG_FILE" 2>&1 + + stop_spinner "$message" +} \ No newline at end of file diff --git a/scripts/variables b/scripts/variables index 8f20b4f..54cc6fd 100644 --- a/scripts/variables +++ b/scripts/variables @@ -7,4 +7,5 @@ SUDO_CMD="" REQUIREMENTS="" DEPENDENCIES="" DOTFILES_DIR="${DOTFILES_DIR:-$HOME/dotfiles}" -LOG_FILE="installation.log" \ No newline at end of file +LOG_FILE="installation.log" +NERD_FONT_FAMILY="JetBrainsMono Nerd Font" \ No newline at end of file diff --git a/setup.sh b/setup.sh index 7ef9cfe..83d9702 100755 --- a/setup.sh +++ b/setup.sh @@ -18,6 +18,7 @@ done ##### Execute the functions in order ################################################################################## head +install_nerd_font start_log check_env auth_sudo From 51b6a7f5d7e702dfa3fd0125137b1561b422f96b Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Tue, 25 Aug 2026 14:25:50 +0300 Subject: [PATCH 05/15] update fd installation --- scripts/install-deps.sh | 2 +- scripts/install-fd.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh index df5bc00..fbcbfb5 100644 --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -7,7 +7,7 @@ ################################################################################## install_deps() { # List of dependencies to install (space-separated, not quoted) - DEPENDENCIES="stow curl tree wget unzip fontconfig ca-certificates ripgrep" + DEPENDENCIES="stow curl tree wget unzip fontconfig ca-certificates ripgrep jq" print_step "Install dependencies" start_spinner "Installing..." diff --git a/scripts/install-fd.sh b/scripts/install-fd.sh index dcf27cd..9bb1935 100644 --- a/scripts/install-fd.sh +++ b/scripts/install-fd.sh @@ -2,19 +2,24 @@ ################################################################################## ##### Function to install fd +##### +##### A simple, fast and user-friendly alternative to 'find' +##### ################################################################################## install_fd() { print_step "Install fd" start_spinner "Installing..." - { + { + printf "##### Function to install fd #####" local message + if command_exists fd; then message="$(msg_skip "fd")" else local fd_version - fd_version=$(curl -s https://api.github.com/repos/sharkdp/fd/releases/latest | grep '"tag_name"' | cut -d'"' -f4) + fd_version=$(curl -s https://api.github.com/repos/sharkdp/fd/releases/latest | jq -r '.tag_name') cd /tmp || exit wget -c "https://github.com/sharkdp/fd/releases/download/${fd_version}/fd-${fd_version}-x86_64-unknown-linux-musl.tar.gz" -O - | tar xz ${SUDO_CMD} mv fd-*/fd /usr/local/bin/fd From c19c10558c1fb8b0ff02d396ec54578cd2a73bf8 Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Tue, 25 Aug 2026 14:44:55 +0300 Subject: [PATCH 06/15] add print in each install script --- scripts/install-eza.sh | 5 ++++- scripts/install-fd.sh | 3 ++- scripts/install-fzf.sh | 2 ++ scripts/install-nerd-font.sh | 2 ++ scripts/install-ohmyposh.sh | 2 ++ scripts/install-zoxide.sh | 2 ++ scripts/install-zsh.sh | 2 ++ scripts/update-system.sh | 3 ++- 8 files changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/install-eza.sh b/scripts/install-eza.sh index 9de77cf..939933d 100644 --- a/scripts/install-eza.sh +++ b/scripts/install-eza.sh @@ -8,8 +8,11 @@ install_eza() { print_step "Install eza" start_spinner "Installing..." - { + { + printf "\n##### Function to install eza #####\n" + local message + if command_exists eza; then message="$(msg_skip "eza")" else diff --git a/scripts/install-fd.sh b/scripts/install-fd.sh index 9bb1935..de71758 100644 --- a/scripts/install-fd.sh +++ b/scripts/install-fd.sh @@ -12,7 +12,8 @@ install_fd() { start_spinner "Installing..." { - printf "##### Function to install fd #####" + printf "\n##### Function to install fd #####\n" + local message if command_exists fd; then diff --git a/scripts/install-fzf.sh b/scripts/install-fzf.sh index 1445583..04933aa 100644 --- a/scripts/install-fzf.sh +++ b/scripts/install-fzf.sh @@ -9,6 +9,8 @@ install_fzf() { start_spinner "Installing..." { + printf "\n##### Function to install eza #####\n" + local clone_message local message diff --git a/scripts/install-nerd-font.sh b/scripts/install-nerd-font.sh index ce55c72..f9621ab 100644 --- a/scripts/install-nerd-font.sh +++ b/scripts/install-nerd-font.sh @@ -10,6 +10,8 @@ install_nerd_font() { start_spinner "Installing..." { + printf "\n##### Function to install eza #####\n" + local message if fc-list 2>/dev/null | grep -qi "$NERD_FONT_FAMILY"; then diff --git a/scripts/install-ohmyposh.sh b/scripts/install-ohmyposh.sh index 2a579dc..c909b92 100644 --- a/scripts/install-ohmyposh.sh +++ b/scripts/install-ohmyposh.sh @@ -9,6 +9,8 @@ install_ohmyposh() { start_spinner "Installing..." { + printf "\n##### Function to install eza #####\n" + local mkdir_message local mkdir_confirm local message diff --git a/scripts/install-zoxide.sh b/scripts/install-zoxide.sh index c7df61e..115beab 100644 --- a/scripts/install-zoxide.sh +++ b/scripts/install-zoxide.sh @@ -9,6 +9,8 @@ install_zoxide() { start_spinner "Installing..." { + printf "\n##### Function to install eza #####\n" + local message if command_exists zoxide; then diff --git a/scripts/install-zsh.sh b/scripts/install-zsh.sh index 29bce38..862a373 100644 --- a/scripts/install-zsh.sh +++ b/scripts/install-zsh.sh @@ -9,6 +9,8 @@ install_zsh() { start_spinner "Installing..." { + printf "\n##### Function to install eza #####\n" + local message if ! command_exists zsh; then diff --git a/scripts/update-system.sh b/scripts/update-system.sh index 5d0c9b0..9500913 100644 --- a/scripts/update-system.sh +++ b/scripts/update-system.sh @@ -11,8 +11,9 @@ update_system() { local message local unsupported=0 - # Redirect all output to log file { + printf "\n##### Function to install eza #####\n" + case "$PACKAGER" in pacman) ${SUDO_CMD} "$PACKAGER" -Sy From 6e0132554bd1fff9f7588817cc82cd595a127baa Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Tue, 25 Aug 2026 15:03:08 +0300 Subject: [PATCH 07/15] fix prints for each install script in log file --- scripts/install-deps.sh | 2 ++ scripts/install-fd.sh | 7 +++---- scripts/install-fzf.sh | 2 +- scripts/install-nerd-font.sh | 5 ++--- scripts/install-ohmyposh.sh | 4 ++-- scripts/install-zoxide.sh | 2 +- scripts/install-zsh.sh | 2 +- scripts/setup-zsh-conf.sh | 6 ++++-- scripts/update-system.sh | 2 +- 9 files changed, 17 insertions(+), 15 deletions(-) diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh index fbcbfb5..1dd4238 100644 --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -13,6 +13,8 @@ install_deps() { start_spinner "Installing..." { + printf "\n##### Function to install dependencies #####\n" + local message local install_status diff --git a/scripts/install-fd.sh b/scripts/install-fd.sh index de71758..3b02680 100644 --- a/scripts/install-fd.sh +++ b/scripts/install-fd.sh @@ -2,12 +2,11 @@ ################################################################################## ##### Function to install fd -##### -##### A simple, fast and user-friendly alternative to 'find' -##### ################################################################################## -install_fd() { +# A simple, fast and user-friendly alternative to 'find' + +install_fd() { print_step "Install fd" start_spinner "Installing..." diff --git a/scripts/install-fzf.sh b/scripts/install-fzf.sh index 04933aa..c8785a7 100644 --- a/scripts/install-fzf.sh +++ b/scripts/install-fzf.sh @@ -9,7 +9,7 @@ install_fzf() { start_spinner "Installing..." { - printf "\n##### Function to install eza #####\n" + printf "\n##### Function to install fzf #####\n" local clone_message local message diff --git a/scripts/install-nerd-font.sh b/scripts/install-nerd-font.sh index f9621ab..4cbd2a5 100644 --- a/scripts/install-nerd-font.sh +++ b/scripts/install-nerd-font.sh @@ -1,16 +1,15 @@ #!/usr/bin/env bash ################################################################################## -##### Function to authenticate sudo early +##### Function to install Nerd font ################################################################################## - install_nerd_font() { print_step "Install Nerd font" start_spinner "Installing..." { - printf "\n##### Function to install eza #####\n" + printf "\n##### Function to install Nerd font #####\n" local message diff --git a/scripts/install-ohmyposh.sh b/scripts/install-ohmyposh.sh index c909b92..480bb5b 100644 --- a/scripts/install-ohmyposh.sh +++ b/scripts/install-ohmyposh.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash ################################################################################## -##### Function to install oh-my-posh +##### Function to install oh-my-posh ################################################################################## install_ohmyposh() { @@ -9,7 +9,7 @@ install_ohmyposh() { start_spinner "Installing..." { - printf "\n##### Function to install eza #####\n" + printf "\n##### Function to install oh-my-posh #####\n" local mkdir_message local mkdir_confirm diff --git a/scripts/install-zoxide.sh b/scripts/install-zoxide.sh index 115beab..9c66f94 100644 --- a/scripts/install-zoxide.sh +++ b/scripts/install-zoxide.sh @@ -9,7 +9,7 @@ install_zoxide() { start_spinner "Installing..." { - printf "\n##### Function to install eza #####\n" + printf "\n##### Function to install zoxide #####\n" local message diff --git a/scripts/install-zsh.sh b/scripts/install-zsh.sh index 862a373..d176360 100644 --- a/scripts/install-zsh.sh +++ b/scripts/install-zsh.sh @@ -9,7 +9,7 @@ install_zsh() { start_spinner "Installing..." { - printf "\n##### Function to install eza #####\n" + printf "\n##### Function to install zsh #####\n" local message diff --git a/scripts/setup-zsh-conf.sh b/scripts/setup-zsh-conf.sh index 639d298..334bf66 100644 --- a/scripts/setup-zsh-conf.sh +++ b/scripts/setup-zsh-conf.sh @@ -3,14 +3,16 @@ # shellcheck disable=SC2059 ################################################################################## -##### Function to setup zsh configuration +##### Function to setup zsh configuration ################################################################################## setup_zsh_conf() { print_step "Setup zsh configuration" start_spinner "Configuring..." - { + { + printf "\n##### Function to setup zsh configuration #####\n" + local message # Check if the dotfiles directory exists diff --git a/scripts/update-system.sh b/scripts/update-system.sh index 9500913..cd9ae30 100644 --- a/scripts/update-system.sh +++ b/scripts/update-system.sh @@ -12,7 +12,7 @@ update_system() { local unsupported=0 { - printf "\n##### Function to install eza #####\n" + printf "\n##### Function to update system packages #####\n" case "$PACKAGER" in pacman) From c17321dfa22e7e9e61d5e759af7bb35ade0b1de9 Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Tue, 25 Aug 2026 15:25:31 +0300 Subject: [PATCH 08/15] update README.md --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d36a445..5bb40f6 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ cd ~/dotfiles && git clone https://github.com/tonytech83/dotfiles.git . `setup.sh` detects your package manager (apt, dnf, yum, pacman, zypper, apk), installs the tools below, stows the configs, points `ZDOTDIR` at `~/.config/zsh` via `/etc/zsh/zshenv`, and sets ZSH as the default shell. Details are logged to `installation.log`. -Installed tools: `zsh`, `stow`, `eza`, `fzf`, `fd`, `zoxide`, `oh-my-posh`. +Installed tools: `zsh`, `stow`, `eza`, `fzf`, `fd`, `zoxide`, `oh-my-posh`, `jq`. ## What's included @@ -31,8 +31,10 @@ Installed tools: `zsh`, `stow`, `eza`, `fzf`, `fd`, `zoxide`, `oh-my-posh`. │ ├── oh-my-posh/ # prompt themes │ ├── rofi/ # app launcher + themes │ └── zsh/ # .zshrc, .zshenv, aliases, bindings, fzf, plugins, prompt -├── scripts/ # folder contains all scripts +├── scripts/ # contains all scripts ├── .nanorc # nano config +├── .vimrc # vim config +├── makefile # GNU makefile (bashism, shell check and typos) └── setup.sh # installer ``` @@ -58,7 +60,8 @@ Managed by a tiny loader in `zsh/plugins.zsh` (git clone + source, no framework) ## Prompt -The prompt uses Oh-My-Posh with `oh-my-posh/code.toml`. A [Nerd Font](https://www.nerdfonts.com/) is required for icons to render correctly. +The prompt uses Oh-My-Posh with `oh-my-posh/code.toml`. +A [Nerd Font](https://www.nerdfonts.com/) is required for icons to render correctly. ## License From dab31dea0e9af53131bfc63eb91ed4fa63d5d0fe Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Tue, 25 Aug 2026 18:46:02 +0300 Subject: [PATCH 09/15] add prints for log file --- scripts/install-deps.sh | 2 +- scripts/install-eza.sh | 1 + scripts/install-fd.sh | 2 ++ scripts/install-fzf.sh | 1 + scripts/install-nerd-font.sh | 2 ++ scripts/install-ohmyposh.sh | 1 + scripts/install-zoxide.sh | 1 + setup.sh | 2 +- 8 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh index 1dd4238..b302b94 100644 --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -7,7 +7,7 @@ ################################################################################## install_deps() { # List of dependencies to install (space-separated, not quoted) - DEPENDENCIES="stow curl tree wget unzip fontconfig ca-certificates ripgrep jq" + DEPENDENCIES="stow curl tree wget unzip fontconfig ca-certificates jq" print_step "Install dependencies" start_spinner "Installing..." diff --git a/scripts/install-eza.sh b/scripts/install-eza.sh index 939933d..bb21f7a 100644 --- a/scripts/install-eza.sh +++ b/scripts/install-eza.sh @@ -15,6 +15,7 @@ install_eza() { if command_exists eza; then message="$(msg_skip "eza")" + printf "Installation skipped - eza is already present!\n" else cd /tmp || exit wget -c https://github.com/eza-community/eza/releases/latest/download/eza_x86_64-unknown-linux-musl.tar.gz -O - | tar xz diff --git a/scripts/install-fd.sh b/scripts/install-fd.sh index 3b02680..9e4b156 100644 --- a/scripts/install-fd.sh +++ b/scripts/install-fd.sh @@ -7,6 +7,7 @@ # A simple, fast and user-friendly alternative to 'find' install_fd() { + print_step "Install fd" start_spinner "Installing..." @@ -17,6 +18,7 @@ install_fd() { if command_exists fd; then message="$(msg_skip "fd")" + printf "Installation skipped - fd is already present!\n" else local fd_version fd_version=$(curl -s https://api.github.com/repos/sharkdp/fd/releases/latest | jq -r '.tag_name') diff --git a/scripts/install-fzf.sh b/scripts/install-fzf.sh index c8785a7..d3c54fa 100644 --- a/scripts/install-fzf.sh +++ b/scripts/install-fzf.sh @@ -16,6 +16,7 @@ install_fzf() { if command_exists fzf; then message="$(msg_skip "fzf")" + printf "Installation skipped - fzf is already present!\n" else git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf ~/.fzf/install --bin diff --git a/scripts/install-nerd-font.sh b/scripts/install-nerd-font.sh index 4cbd2a5..c053d96 100644 --- a/scripts/install-nerd-font.sh +++ b/scripts/install-nerd-font.sh @@ -15,10 +15,12 @@ install_nerd_font() { if fc-list 2>/dev/null | grep -qi "$NERD_FONT_FAMILY"; then message="$(msg_skip "$NERD_FONT_FAMILY")" + printf "Installation skipped - $NERD_FONT_FAMILY is already present!\n" else font_temp_dir=$(mktemp -d) font_archive="$font_temp_dir/JetBrainsMono.tar.xz" font_unpack_dir="$font_temp_dir/unpacked" + NERD_FONT_URL="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.zip" font_dir="$HOME/.local/share/fonts/JetBrainsMonoNerdFont" mkdir -p "$font_unpack_dir" "$font_dir" diff --git a/scripts/install-ohmyposh.sh b/scripts/install-ohmyposh.sh index 480bb5b..56e58bd 100644 --- a/scripts/install-ohmyposh.sh +++ b/scripts/install-ohmyposh.sh @@ -17,6 +17,7 @@ install_ohmyposh() { if command_exists oh-my-posh; then message="$(msg_skip "oh-my-posh")" + printf "Installation skipped - oh-my-posh is already present!\n" else # Check if the ./local/bin exists LOCALBINFOLDER="$HOME/.local/bin" diff --git a/scripts/install-zoxide.sh b/scripts/install-zoxide.sh index 9c66f94..4e98f50 100644 --- a/scripts/install-zoxide.sh +++ b/scripts/install-zoxide.sh @@ -15,6 +15,7 @@ install_zoxide() { if command_exists zoxide; then message="$(msg_skip "zoxide")" + printf "Installation skipped - zoxide is already present!\n" else curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh if verify_installed zoxide; then diff --git a/setup.sh b/setup.sh index 83d9702..731b4b6 100755 --- a/setup.sh +++ b/setup.sh @@ -18,8 +18,8 @@ done ##### Execute the functions in order ################################################################################## head -install_nerd_font start_log +install_nerd_font check_env auth_sudo update_system From 3e1a3da2453c64f34678c9b9a8be9f784b1a417c Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Wed, 26 Aug 2026 16:03:50 +0300 Subject: [PATCH 10/15] update loging path for makefile and setup --- .gitignore | 3 +-- makefile | 4 +--- scripts/install-nerd-font.sh | 2 +- scripts/logging.sh | 1 + scripts/variables | 3 ++- setup.sh | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index f3e8ab9..fd25468 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -installation.log .config/zsh/plugins/ .config/dlv/ .config/go/ -logging/ \ No newline at end of file +log/ \ No newline at end of file diff --git a/makefile b/makefile index f5e6c63..e9cef2f 100644 --- a/makefile +++ b/makefile @@ -4,10 +4,8 @@ SCRIPT_VERSION=v1.0 SCRIPT_AUTHOR=tonytech ROOT_DIR = . -LOG_DIR = logging +LOG_DIR = log OUTPUT_PATH = $(ROOT_DIR)/$(LOG_DIR) -# OUTPUT_OUT = $(OUTPUT_PATH)/$(PHASE).out -# OUTPUT_ERR = $(OUTPUT_PATH)/$(PHASE).err OUTPUT_OUT = $(OUTPUT_PATH)/$(strip $(PHASE)).out OUTPUT_ERR = $(OUTPUT_PATH)/$(strip $(PHASE)).err OUTPUT = 1>$(OUTPUT_OUT) 2>$(OUTPUT_ERR) diff --git a/scripts/install-nerd-font.sh b/scripts/install-nerd-font.sh index c053d96..cd7257e 100644 --- a/scripts/install-nerd-font.sh +++ b/scripts/install-nerd-font.sh @@ -15,7 +15,7 @@ install_nerd_font() { if fc-list 2>/dev/null | grep -qi "$NERD_FONT_FAMILY"; then message="$(msg_skip "$NERD_FONT_FAMILY")" - printf "Installation skipped - $NERD_FONT_FAMILY is already present!\n" + printf "Installation skipped - %s is already present!\n" "$NERD_FONT_FAMILY" else font_temp_dir=$(mktemp -d) font_archive="$font_temp_dir/JetBrainsMono.tar.xz" diff --git a/scripts/logging.sh b/scripts/logging.sh index ca01d3a..b3789fd 100644 --- a/scripts/logging.sh +++ b/scripts/logging.sh @@ -4,6 +4,7 @@ ##### Log file ################################################################################## start_log() { + mkdir -p "$LOG_DIR" true > "$LOG_FILE" echo "" >> "$LOG_FILE" echo "=== Setup started at $(date) ===" >> "$LOG_FILE" diff --git a/scripts/variables b/scripts/variables index 54cc6fd..9861b2e 100644 --- a/scripts/variables +++ b/scripts/variables @@ -7,5 +7,6 @@ SUDO_CMD="" REQUIREMENTS="" DEPENDENCIES="" DOTFILES_DIR="${DOTFILES_DIR:-$HOME/dotfiles}" -LOG_FILE="installation.log" +LOG_DIR="log" +LOG_FILE="${LOG_DIR}/installation.log" NERD_FONT_FAMILY="JetBrainsMono Nerd Font" \ No newline at end of file diff --git a/setup.sh b/setup.sh index 731b4b6..c0f86c4 100755 --- a/setup.sh +++ b/setup.sh @@ -6,7 +6,7 @@ BOX_WIDTH=76 ################################################################################## -##### Load external functions if available +##### Load external functions ################################################################################## SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" From 9388338dac4cee8c0afe58609a03126e2b4edca4 Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Wed, 26 Aug 2026 16:10:03 +0300 Subject: [PATCH 11/15] try to fix the path --- scripts/variables | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/variables b/scripts/variables index 9861b2e..d4c8be3 100644 --- a/scripts/variables +++ b/scripts/variables @@ -7,6 +7,6 @@ SUDO_CMD="" REQUIREMENTS="" DEPENDENCIES="" DOTFILES_DIR="${DOTFILES_DIR:-$HOME/dotfiles}" -LOG_DIR="log" +LOG_DIR="${DOTFILES_DIR}/log" LOG_FILE="${LOG_DIR}/installation.log" NERD_FONT_FAMILY="JetBrainsMono Nerd Font" \ No newline at end of file From 8ea58cbcc68de28b87c5eb3715dc075b9e0b4a0f Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Wed, 26 Aug 2026 21:41:32 +0300 Subject: [PATCH 12/15] chose new icons --- scripts/predef | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/predef b/scripts/predef index 235ab08..8f49885 100644 --- a/scripts/predef +++ b/scripts/predef @@ -18,6 +18,6 @@ REVERSE="$(printf '\033[7m')" HIDDEN="$(printf '\033[8m')" STRIKE="$(printf '\033[9m')" -SUCCESS="󰸞" +SUCCESS="✓" FAILED="" WARNING="" \ No newline at end of file From 5efcac1ec0594e76ad40f76300a02a22b3594886 Mon Sep 17 00:00:00 2001 From: Aiden Takeda Date: Thu, 27 Aug 2026 13:51:09 +0300 Subject: [PATCH 13/15] Made nerd font installation interactive (#34) * made nerd font installation interactive * update install workflow and change its name --------- Co-authored-by: Anton Petrov --- .github/workflows/{test.yml => install.yml} | 4 +- scripts/install-nerd-font.sh | 160 +++++++++++++++----- scripts/variables | 3 +- setup.sh | 2 +- 4 files changed, 128 insertions(+), 41 deletions(-) rename .github/workflows/{test.yml => install.yml} (84%) diff --git a/.github/workflows/test.yml b/.github/workflows/install.yml similarity index 84% rename from .github/workflows/test.yml rename to .github/workflows/install.yml index c41989a..627a6a9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/install.yml @@ -1,4 +1,4 @@ -name: Test +name: Install permissions: contents: read @@ -37,7 +37,7 @@ jobs: - name: Setup dotfiles run: | chmod +x setup.sh - DOTFILES_DIR="$GITHUB_WORKSPACE" ./setup.sh + printf 'y\n1\n' | DOTFILES_DIR="$GITHUB_WORKSPACE" ./setup.sh - name: Smoke test zsh shell: zsh {0} diff --git a/scripts/install-nerd-font.sh b/scripts/install-nerd-font.sh index cd7257e..afd6bc0 100644 --- a/scripts/install-nerd-font.sh +++ b/scripts/install-nerd-font.sh @@ -1,56 +1,142 @@ #!/usr/bin/env bash +################################################################################## +##### Fetch the canonical list of Nerd Font names (= release asset names) +################################################################################## +get_font_list() { + local json + json=$(curl -fsSL "$FONTS_JSON_URL") || { + printf "Failed to fetch font list from %s\n" "$FONTS_JSON_URL" | tee -a "$LOG_FILE" >&2 + exit 0 + } + + if command -v python3 >/dev/null 2>&1; then + printf '%s' "$json" | python3 -c ' +import json, sys +data = json.load(sys.stdin) +names = sorted(f["folderName"] for f in data["fonts"]) +print("\n".join(names)) +' + elif command -v jq >/dev/null 2>&1; then + printf '%s' "$json" | jq -r '.fonts[].folderName' | sort + else + printf "Need python3 or jq installed to parse the font list\n" | tee -a "$LOG_FILE" >&2 + exit 0 + fi +} + ################################################################################## ##### Function to install Nerd font ################################################################################## install_nerd_font() { + + print_step "Install Nerd font" - print_step "Install Nerd font" - start_spinner "Installing..." + # Ask for Nerd font at all + local need_nerd_font + while true; do + read -rp "Do you want Nerd font [Y/n] " need_nerd_font + case "$need_nerd_font" in + [Yy]*) break ;; + [Nn]*) + printf "Skipping font installation.\n" | tee -a "$LOG_FILE" + echo + return 0 + ;; + *) ehco "Please answer y or n." ;; + esac + done + + # Menu is interactive, so it happens before the spinner starts. + mapfile -t fonts < <(get_font_list) + # Check if fonts list is populated + if [ "${#fonts[@]}" -eq 0 ]; then + printf "No fonts available - continuing without font installation.\n" | tee -a "$LOG_FILE" + return 0 + fi + + # Print menu + echo + local cols=3 + local col_width=26 + local total=${#fonts[@]} + local total_items=$((total + 1)) + for ((i = 0; i < total_items; i++)); do + if (( i == 0 )); then + local skip_label="Skip installation" + local skip_pad=$(( col_width - ${#skip_label} )) + (( skip_pad < 0 )) && skip_pad=0 + printf "%3d) %s%s%s%*s" 0 "${BOLD}${GREEN}" "$skip_label" "${RC}" "$skip_pad" "" + else + printf "%3d) %-*s" "$i" "$col_width" "${fonts[$((i - 1))]}" + fi + if (( (i + 1) % cols == 0 )); then + echo + fi + done + if (( total_items % cols != 0 )); then + echo + fi + echo + + local choice + while true; do + read -rp "Select font: " choice + if [[ "$choice" =~ ^[0-9]+$ ]] && [ "$choice" -ge 0 ] && [ "$choice" -le "$total" ]; then + break + fi + printf "Invalid choice, try again." + done + + if [ "$choice" -eq 0 ]; then + printf "Skipping font installation.\n" | tee -a "$LOG_FILE" + echo + return 0 + fi + + local NERD_FONT_FAMILY="${fonts[$((choice - 1))]}" + + start_spinner "Installing..." + { printf "\n##### Function to install Nerd font #####\n" - + local message - - if fc-list 2>/dev/null | grep -qi "$NERD_FONT_FAMILY"; then + local font_dir="$FONT_INSTALL_ROOT/${NERD_FONT_FAMILY}NerdFont" + + # already installed? (checked by presence of font files, not by + # fc-list name, since the internal family name doesn't always + # match the download name) + if [ -d "$font_dir" ] && find "$font_dir" -maxdepth 1 \( -iname '*.ttf' -o -iname '*.otf' \) 2>/dev/null | grep -q .; then message="$(msg_skip "$NERD_FONT_FAMILY")" - printf "Installation skipped - %s is already present!\n" "$NERD_FONT_FAMILY" else - font_temp_dir=$(mktemp -d) - font_archive="$font_temp_dir/JetBrainsMono.tar.xz" - font_unpack_dir="$font_temp_dir/unpacked" - NERD_FONT_URL="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.zip" - font_dir="$HOME/.local/share/fonts/JetBrainsMonoNerdFont" - mkdir -p "$font_unpack_dir" "$font_dir" - - if ! curl -fsSL "$NERD_FONT_URL" -o "$font_archive"; then - rm -rf "$font_temp_dir" + local tmp_dir archive url + tmp_dir=$(mktemp -d) + archive="$tmp_dir/${NERD_FONT_FAMILY}.zip" + url="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${NERD_FONT_FAMILY}.zip" + + if ! curl -fsSL "$url" -o "$archive"; then message="$(msg_err "Failed to download ${BOLD}$NERD_FONT_FAMILY${RC}! Check ${BOLD}${LOG_FILE}${RC} for details.")" - fi - if ! tar -xJf "$font_archive" -C "$font_unpack_dir"; then - rm -rf "$font_temp_dir" - message="$(msg_err "Failed to extract ${BOLD}$NERD_FONT_FAMILY${RC}! Check ${BOLD}${LOG_FILE}${RC} for details.")" - fi - - find "$font_unpack_dir" -type f -name 'JetBrainsMonoNerdFont-*.ttf' -exec cp {} "$font_dir"/ \; - font_found= - for font_file in "$font_dir"/*.ttf; do - if [ -f "$font_file" ]; then - font_found=1 - break + else + mkdir -p "$tmp_dir/unpacked" "$font_dir" + if ! unzip -qq -o "$archive" -d "$tmp_dir/unpacked"; then + message="$(msg_err "Failed to extract ${BOLD}$NERD_FONT_FAMILY${RC}! Check ${BOLD}${LOG_FILE}${RC} for details.")" + else + find "$tmp_dir/unpacked" -type f \( -iname '*.ttf' -o -iname '*.otf' \) -exec cp {} "$font_dir/" \; + + if ! find "$font_dir" -maxdepth 1 \( -iname '*.ttf' -o -iname '*.otf' \) | grep -q .; then + message="$(msg_err "No font files found for ${BOLD}$NERD_FONT_FAMILY${RC}!")" + else + fc-cache -f "$font_dir" >/dev/null 2>&1 + message="$(msg_ok "Font ${BOLD}$NERD_FONT_FAMILY${RC} installed.")" + fi fi - done - rm -rf "$font_temp_dir" - - if [ -z "$font_found" ]; then - message="$(msg_err "No standard JetBrainsMono Nerd Font files were found in the archive.")" fi - - fc-cache -f >/dev/null 2>&1 - message="$(msg_ok "$NERD_FONT_FAMILY installed.")" + + rm -rf "$tmp_dir" fi } >> "$LOG_FILE" 2>&1 - - stop_spinner "$message" + + stop_spinner "$message" | tee -a "$LOG_FILE" } \ No newline at end of file diff --git a/scripts/variables b/scripts/variables index d4c8be3..da967a6 100644 --- a/scripts/variables +++ b/scripts/variables @@ -9,4 +9,5 @@ DEPENDENCIES="" DOTFILES_DIR="${DOTFILES_DIR:-$HOME/dotfiles}" LOG_DIR="${DOTFILES_DIR}/log" LOG_FILE="${LOG_DIR}/installation.log" -NERD_FONT_FAMILY="JetBrainsMono Nerd Font" \ No newline at end of file +FONTS_JSON_URL="https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/bin/scripts/lib/fonts.json" +FONT_INSTALL_ROOT="${FONT_INSTALL_ROOT:-$HOME/.local/share/fonts}" \ No newline at end of file diff --git a/setup.sh b/setup.sh index c0f86c4..3e07d37 100755 --- a/setup.sh +++ b/setup.sh @@ -19,7 +19,7 @@ done ################################################################################## head start_log -install_nerd_font +install_nerd_font "$@" check_env auth_sudo update_system From a9a863fdf7afd92032918dd7da2b15a9d7b799ae Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Sun, 27 Sep 2026 13:38:35 +0300 Subject: [PATCH 14/15] Feat/migrate to posix (#37) * Logging & Nerd font installation (#35) * update makefile help command and fix the issue with shellcheck target * update .vimrc * update .stow-local-ignore to exclde scripts folder * add nerd font installation * update fd installation * add print in each install script * fix prints for each install script in log file * update README.md * add prints for log file * update loging path for makefile and setup * try to fix the path * chose new icons * Made nerd font installation interactive (#34) * made nerd font installation interactive * update install workflow and change its name --------- * Update badge link from Test to Install * fix typo * update fastfetch config and zen oh-my-posh theme * update alacritty and fastfetch configs * updated fastfetch theme * updated alacritty and fastfetch configs * made all scripts POSIX compliant * fixed logging * fixed exit in zsh configuration script * added break if something is not satisfied * move variables outside logged commands * update installation ok and err messages * updated overall output of scripts * added install_pkg func --- .config/alacritty/alacritty.toml | 72 +++++++----- .config/alacritty/keybindings.toml | 26 +++++ .config/alacritty/keybinds.toml | 56 ---------- .config/alacritty/nordic.toml | 8 +- .config/fastfetch/config.jsonc | 171 +++++++++++++++-------------- .config/zsh/.zshenv | 4 +- README.md | 2 +- scripts/auth-sudo.sh | 2 +- scripts/check-env.sh | 61 +++++----- scripts/command-exists.sh | 2 +- scripts/conf-zsh-env.sh | 14 +-- scripts/head.sh | 16 ++- scripts/install-deps.sh | 86 ++++++++------- scripts/install-eza.sh | 12 +- scripts/install-fd.sh | 14 +-- scripts/install-fzf.sh | 15 ++- scripts/install-nerd-font.sh | 148 ++++++++++++------------- scripts/install-ohmyposh.sh | 16 +-- scripts/install-zoxide.sh | 12 +- scripts/install-zsh.sh | 19 ++-- scripts/logging.sh | 2 +- scripts/output.sh | 16 ++- scripts/setup-zsh-conf.sh | 131 ++++++++++++---------- scripts/spinner.sh | 55 ++++++---- scripts/update-system.sh | 6 +- scripts/verify-installed.sh | 2 +- setup.sh | 9 +- 27 files changed, 510 insertions(+), 467 deletions(-) create mode 100644 .config/alacritty/keybindings.toml delete mode 100644 .config/alacritty/keybinds.toml diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml index 8c2c9ea..ad3dc0d 100644 --- a/.config/alacritty/alacritty.toml +++ b/.config/alacritty/alacritty.toml @@ -1,51 +1,71 @@ [general] live_config_reload = true working_directory = "None" - # Themes -- import = [ + # colors "~/.config/alacritty/nordic.toml", - "~/.config/alacritty/keybinds.toml" + # key bindings + "~/.config/alacritty/keybindings.toml" ] -[terminal.shell] -program = "/usr/bin/zsh" +[env] +TERM = "xterm-256color" [window] title = "Alacritty" decorations = "none" blur = true opacity = 0.9 -padding.x = 10 -padding.y = 10 +padding = { x = 10, y = 10 } -[window.dimensions] -columns = 160 -lines = 80 +# [window.dimensions] +# columns = 160 +# lines = 80 -[cursor.style] -shape= "Beam" -blinking = "Never" +[scrolling] +history = 10000 +multiplier = 3 + +[font] +size = 11.0 +normal = { family = "Lilex Nerd Font", style = "Regular" } +bold = { family = "Lilex Nerd Font", style = "Bold" } +italic = { family = "Lilex Nerd Font", style = "Italic" } +bold_italic = { family = "Lilex Nerd Font", style = "Bold Italic" } +builtin_box_drawing = false [colors] #transparent_background_colors = true draw_bold_text_with_bright_colors = true -[env] -TERM = "xterm-256color" +[bell] +command = "None" + +[selection] +save_to_clipboard = true + +[cursor.style] +shape= "Block" +blinking = "On" + +[terminal.shell] +program = "/usr/bin/zsh" + +[mouse] +hide_when_typing = true + + +[debug] +render_timer = true +print_events = true + + + + + + -[font] -#glyph_offset = { x = 1, y = 0 } -normal.family = "JETBRAINSMONO NERD FONT" -normal.style = "Regular" -size = 11.0 -[font.bold] -family = "JetBrainsMono Nerd Font" -style = "Bold" -[font.italic] -family = "JetBrainsMono Nerd Font" -style = "Italic" -[terminal] diff --git a/.config/alacritty/keybindings.toml b/.config/alacritty/keybindings.toml new file mode 100644 index 0000000..8dad7b6 --- /dev/null +++ b/.config/alacritty/keybindings.toml @@ -0,0 +1,26 @@ +[keyboard] +bindings = [ + # Clipboard + { key = "C", mods = "Super", action = "Copy" }, + { key = "Insert", mods = "Shift", action = "PasteSelection" }, + { key = "Insert", mods = "Shift", action = "Paste" }, + { key = "V", mods = "Control", action = "Paste" }, + # { key = "V", mods = "Super", action = "Paste" }, + # { key = "S", mods = "Control|Shift", action = "Paste" }, + # { key = "C", mods = "Control", action = "Copy" }, # commented out + + # Scrolling + { key = "Up", mods = "Control|Shift", action = "ScrollLineUp" }, + { key = "Down", mods = "Control|Shift", action = "ScrollLineDown" }, + { key = "K", mods = "Control|Shift", action = "ScrollLineUp" }, + { key = "J", mods = "Control|Shift", action = "ScrollLineDown" }, + { key = "PageUp", mods = "Control|Shift", action = "ScrollPageUp" }, + { key = "PageDown", mods = "Control|Shift", action = "ScrollPageDown" }, + { key = "Home", mods = "Control|Shift", action = "ScrollToTop" }, + { key = "End", mods = "Control|Shift", action = "ScrollToBottom" }, + + # Miscellaneous + { key = "Up", mods = "Control|Shift", action = "IncreaseFontSize" }, + { key = "Down", mods = "Control|Shift", action = "DecreaseFontSize" }, + { key = "Backspace", mods = "Control|Shift", action = "ResetFontSize" }, +] diff --git a/.config/alacritty/keybinds.toml b/.config/alacritty/keybinds.toml deleted file mode 100644 index a5fa119..0000000 --- a/.config/alacritty/keybinds.toml +++ /dev/null @@ -1,56 +0,0 @@ -[keyboard] -bindings = [ - # Clipboard - { key = "V", mods = "Super", action = "Paste" }, - { key = "S", mods = "Control|Shift", action = "Paste" }, - { key = "C", mods = "Super", action = "Copy" }, - { key = "Insert", mods = "Shift", action = "PasteSelection" }, - # { key = "C", mods = "Control", action = "Copy" }, # commented out - { key = "V", mods = "Control", action = "Paste" }, - { key = "Insert", mods = "Shift", action = "Paste" }, - - # Scrolling - { key = "Up", mods = "Control|Shift", action = "ScrollLineUp" }, - { key = "Down", mods = "Control|Shift", action = "ScrollLineDown" }, - { key = "K", mods = "Control|Shift", action = "ScrollLineUp" }, - { key = "J", mods = "Control|Shift", action = "ScrollLineDown" }, - { key = "PageUp", mods = "Control|Shift", action = "ScrollPageUp" }, - { key = "PageDown", mods = "Control|Shift", action = "ScrollPageDown" }, - { key = "Home", mods = "Control|Shift", action = "ScrollToTop" }, - { key = "End", mods = "Control|Shift", action = "ScrollToBottom" }, - # { key = "H", mods = "Control|Shift", action = "ShowScrollback" }, - - # Window management -# { key = "N", mods = "Super", action = "SpawnNewInstance" }, -# { key = "W", mods = "Super", action = "Close" }, -# { key = "Enter", mods = "Control|Shift", action = "SpawnNewInstance" }, -# { key = "RightBracket", mods = "Control|Shift", action = "NextWindow" }, -# { key = "LeftBracket", mods = "Control|Shift", action = "PreviousWindow" }, -# { key = "F", mods = "Control|Shift", action = "MoveForward" }, -# { key = "B", mods = "Control|Shift", action = "MoveBackward" }, -# { key = "Grave", mods = "Control|Shift", action = "MoveToTop" }, -# { key = "Key1", mods = "Control|Shift", action = "MoveToFirst" }, -# { key = "Key2", mods = "Control|Shift", action = "MoveToSecond" }, -# { key = "Key3", mods = "Control|Shift", action = "MoveToThird" }, -# { key = "Key4", mods = "Control|Shift", action = "MoveToFourth" }, -# { key = "Key5", mods = "Control|Shift", action = "MoveToFifth" }, -# { key = "Key6", mods = "Control|Shift", action = "MoveToSixth" }, -# { key = "Key7", mods = "Control|Shift", action = "MoveToSeventh" }, -# { key = "Key8", mods = "Control|Shift", action = "MoveToEighth" }, -# { key = "Key9", mods = "Control|Shift", action = "MoveToNinth" }, -# { key = "Key0", mods = "Control|Shift", action = "MoveToTenth" }, - - # Tab management -# { key = "Right", mods = "Control|Shift", action = "NextTab" }, -# { key = "Left", mods = "Control|Shift", action = "PreviousTab" }, -# { key = "T", mods = "Control|Shift", action = "SpawnNewTab" }, -# { key = "Q", mods = "Control|Shift", action = "CloseTab" }, -# { key = "L", mods = "Control|Shift", action = "NextLayout" }, -# { key = "Period", mods = "Control|Shift", action = "MoveTabForward" }, -# { key = "Comma", mods = "Control|Shift", action = "MoveTabBackward" }, - - # Miscellaneous - { key = "Up", mods = "Control|Shift", action = "IncreaseFontSize" }, - { key = "Down", mods = "Control|Shift", action = "DecreaseFontSize" }, - { key = "Backspace", mods = "Control|Shift", action = "ResetFontSize" }, -] diff --git a/.config/alacritty/nordic.toml b/.config/alacritty/nordic.toml index 8ee315a..d96bbee 100644 --- a/.config/alacritty/nordic.toml +++ b/.config/alacritty/nordic.toml @@ -2,13 +2,12 @@ [colors.primary] background = '#2E3440' -# foreground = '#D8DEE9' -foreground = '#FFFACD' +foreground = '#BDC5BD' [colors.selection] text = '#000000' # background = '#FFFACD' -background = '#BF616A' +background = '#b68388' [colors.normal] black = '#191C1D' @@ -25,8 +24,7 @@ black = '#727C7C' red = '#D18FAF' green = '#B7CEB0' yellow = '#BCBCBC' -blue = '#E0CF9F' +blue = '#81A1C1' magenta = '#C7A9D9' cyan = '#BBDA97' white = '#BDC5BD' - diff --git a/.config/fastfetch/config.jsonc b/.config/fastfetch/config.jsonc index f1abcdc..1491ae2 100644 --- a/.config/fastfetch/config.jsonc +++ b/.config/fastfetch/config.jsonc @@ -1,145 +1,148 @@ -/* ----------- 💫 https://github.com/JaKooLit 💫 -------- */ - { "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", "logo": { - //"source": "~/.config/fastfetch/nixos.png", - //"type": "kitty-direct", - "height": 15, - "width": 30, + "type": "file", + "source": "~/.config/fedora/branding/deathstar.txt", + "color": { "1": "bright_black", "2": "white" }, "padding": { - "top": 1, + "top": 3, + "right": 0, + "left": 0, }, }, "display": { - "separator": " ➜ ", + "separator": " │ ", }, - "modules": [ "break", { - "type": "os", - "key": " DISTRO", - "keyColor": "31", + "type": "custom", + "format": " {#3}{#1}{#green}Hardware{#}", }, { - "type": "kernel", - "key": " ├  ", - "keyColor": "31", + "type": "custom", + "format": "┌─────────────┐ ┌─────────────────────────────────────────", }, { - "type": "packages", - "key": " ├ 󰏖 ", - "keyColor": "31", + "type": "host", + "key": "{#}│{#green}  Host {#}│", + "keyColor": "green", }, { - "type": "uptime", - "key": " ├ 󰔟 ", - "keyColor": "31", + "type": "cpu", + "key": "{#}│{#green}  CPU {#}│", + "showPeCoreCount": true, + "keyColor": "green", }, { - "type": "command", - "key": " ├ 󰅐 ", - "keyColor": "31", - "text": "birth_install=$(stat -c %W /); current=$(date +%s); time_progression=$((current - birth_install)); days_difference=$((time_progression / 86400)); echo $days_difference days", + "type": "gpu", + "key": "{#}│{#green}  GPU {#}│", + "detectionMethod": "pci", + "keyColor": "green", }, { - "type": "shell", - "key": " └  ", - "keyColor": "31", + "type": "display", + "key": "{#}│{#green} 󱄄 Display {#}│", + "keyColor": "green", }, - "break", { - "type": "wm", - "key": " DE/WM", - "keyColor": "32", + "type": "disk", + "key": "{#}│{#green} 󰋊 Disk {#}│", + "keyColor": "green", }, { - "type": "wmtheme", - "key": " ├ 󰉼 ", - "keyColor": "32", + "type": "memory", + "key": "{#}│{#green}  Memory {#}│", + "keyColor": "green", }, { - "type": "icons", - "key": " ├ 󰀻 ", - "keyColor": "32", + "type": "swap", + "key": "{#}│{#green} 󰓡 Swap {#}│", + "keyColor": "green", }, { - "type": "cursor", - "key": " ├  ", - "keyColor": "32", + "type": "custom", + "format": "└─────────────┘ └─────────────────────────────────────────", }, { - "type": "terminal", - "key": " ├  ", - "keyColor": "32", + "type": "custom", + "format": " {#3}{#1}{#blue}Software{#}", }, { - "type": "terminalfont", - "key": " └  ", - "keyColor": "32", + "type": "custom", + "format": "┌─────────────┐ ┌─────────────────────────────────────────", }, - "break", { - "type": "host", - "format": "{2}", - "key": "󰌢 SYSTEM", - "keyColor": "33", + "type": "os", + "key": "{#}│{#blue} \ue900 Distro {#}│", + "keyColor": "blue", }, { - "type": "cpu", - "format": "{1} ({3}) @ {7} GHz", - "key": " ├  ", - "keyColor": "33", + "type": "kernel", + "key": "{#}│{#blue}  Kernel {#}│", + "keyColor": "blue", }, { - "type": "gpu", - "format": "{2}", - "key": " ├ 󰢮 ", - "keyColor": "33", + "type": "wm", + "key": "{#}│{#blue}  WinManager{#}│", + "keyColor": "blue", }, { - "type": "memory", - "key": " ├  ", - "keyColor": "33", + "type": "de", + "key": "{#}│{#blue}  DesktopEnv{#}│", + "keyColor": "blue", }, { - "type": "swap", - "key": " ├ 󰓡 ", - "keyColor": "33", + "type": "terminal", + "key": "{#}│{#blue}  Terminal {#}│", + "keyColor": "blue", }, { - "type": "disk", - "key": " ├ 󰋊 ", - "keyColor": "33", + "type": "packages", + "key": "{#}│{#blue} 󰏖 Packages {#}│", + "keyColor": "blue", }, { - "type": "display", - "key": " └  ", - "compactType": "original-with-refresh-rate", - "keyColor": "33", + "type": "wmtheme", + "key": "{#}│{#blue} 󰉼 Theme {#}│", + "keyColor": "blue", }, - "break", { - "type": "sound", - "key": " AUDIO", - "format": "{2}", - "keyColor": "magenta", + "type": "terminalfont", + "key": "{#}│{#blue}  Font {#}│", + "keyColor": "blue", }, { - "type": "player", - "key": " ├ 󰥠 ", + "type": "shell", + "key": "{#}│{#blue}  Shell {#}│", + "keyColor": "blue", + }, + { + "type": "custom", + "format": "└─────────────┘ └─────────────────────────────────────────", + }, + { + "type": "custom", + "format": " {#3}{#1}{#magenta}Age / Uptime / Update{#}", + }, + { + "type": "custom", + "format": "┌─────────────┐ ┌─────────────────────────────────────────", + }, + { + "type": "command", + "key": "{#}│{#magenta} 󱦟 OS Age {#}│", "keyColor": "magenta", + "text": "echo $(( ($(date +%s) - $(stat -c %W /)) / 86400 )) days", }, { - "type": "media", - "key": " └ 󰝚 ", + "type": "uptime", + "key": "{#}│{#magenta} 󱫐 Uptime {#}│", "keyColor": "magenta", }, - "break", { "type": "custom", - "format": "\u001b[90m \u001b[31m \u001b[32m \u001b[33m \u001b[34m \u001b[35m \u001b[36m \u001b[37m \u001b[38m \u001b[39m \u001b[39m  \u001b[38m \u001b[37m \u001b[36m \u001b[35m \u001b[34m \u001b[33m \u001b[32m \u001b[31m \u001b[90m ", + "format": "└─────────────┘ └─────────────────────────────────────────", }, "break", ], diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv index 29bc99e..5e8e271 100644 --- a/.config/zsh/.zshenv +++ b/.config/zsh/.zshenv @@ -9,8 +9,8 @@ export XDG_STATE_HOME="$HOME/.local/state" # ---------- Editor ---------- # Default editor used by git, crontab, etc. -export EDITOR="nano" -export VISUAL="nano" +export EDITOR="vim" +export VISUAL="vim" # ---------- Pager ---------- # if command -v bat >/dev/null 2>&1; then diff --git a/README.md b/README.md index 5bb40f6..8f9b502 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Test](https://img.shields.io/github/actions/workflow/status/tonytech83/dotfiles/test.yml?branch=main&label=Test&style=for-the-badge)](https://github.com/tonytech83/dotfiles/actions/workflows/test.yml) +[![Install](https://img.shields.io/github/actions/workflow/status/tonytech83/dotfiles/install.yml?branch=main&label=Install&style=for-the-badge)](https://github.com/tonytech83/dotfiles/actions/workflows/install.yml) [![Release](https://img.shields.io/github/actions/workflow/status/tonytech83/dotfiles/release.yml?branch=main&label=Release&style=for-the-badge)](https://github.com/tonytech83/dotfiles/actions/workflows/release.yml) [![Version](https://img.shields.io/github/v/release/tonytech83/dotfiles?color=%230567ff&label=Latest%20Release&style=for-the-badge)](https://github.com/tonytech83/dotfiles/releases) diff --git a/scripts/auth-sudo.sh b/scripts/auth-sudo.sh index c3e237e..2168373 100644 --- a/scripts/auth-sudo.sh +++ b/scripts/auth-sudo.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Function to authenticate sudo early diff --git a/scripts/check-env.sh b/scripts/check-env.sh index c79bdf4..109d343 100644 --- a/scripts/check-env.sh +++ b/scripts/check-env.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # shellcheck disable=SC2034 @@ -9,20 +9,27 @@ check_env() { print_step "Check the environment for necessary tools and permissions" start_spinner "Checking..." - + { - local req_message - local pm_message - local priv_message - - # Check for required commands - REQUIREMENTS="curl sudo" - for req in $REQUIREMENTS; do - if ! command_exists "$req"; then - req_message="$(msg_err "Missing required command: $req")" - exit 1 - fi - done + pm_message + priv_message + continue=true + + # Determine privilege escalation method + if [ "$(id -u)" -eq 0 ]; then + # Running as root + SUDO_CMD="" + priv_message="$(msg_ok "Running as root, sudo is not needed.")" + elif command_exists sudo; then + SUDO_CMD="sudo" + priv_message="$(msg_ok "Using ${BOLD}${ITALIC}${MAGENTA}sudo${RC} for privilege escalation.")" + elif command_exists doas && [ -f "/etc/doas.conf" ]; then + SUDO_CMD="doas" + priv_message="$(msg_ok "Using ${BOLD}${ITALIC}${MAGENTA}doas${RC} for privilege escalation.")" + else + priv_message="$(msg_err "No suitable privilege escalation tool found (sudo/doas).")" + continue=false + fi # Determine the package manager to use PACKAGEMANAGER="apt-get dnf yum pacman zypper apk" @@ -36,25 +43,15 @@ check_env() { if [ -z "$PACKAGER" ]; then pm_message="$(msg_err "No supported package manager found.")" - exit 1 + continue=false fi - # Determine privilege escalation method - if [ "$(id -u)" -eq 0 ]; then - # Running as root - SUDO_CMD="" - priv_message="$(msg_ok "Running as root, sudo is not needed.")" - elif command_exists sudo; then - SUDO_CMD="sudo" - priv_message="$(msg_ok "Using ${BOLD}${ITALIC}${MAGENTA}sudo${RC} for privilege escalation.")" - elif command_exists doas && [ -f "/etc/doas.conf" ]; then - SUDO_CMD="doas" - priv_message="$(msg_ok "Using doas for privilege escalation.")" - else - priv_message="$(msg_err "No suitable privilege escalation tool found (sudo/doas).")" - exit 1 - fi - } >> "$LOG_FILE" 2>&1 - stop_spinner "$req_message" "$pm_message" "$priv_message" + } >> "${LOG_FILE:-/dev/null}" 2>&1 + + stop_spinner "$pm_message" "$priv_message" + + if [ "$continue" = false ]; then + exit 1 + fi } diff --git a/scripts/command-exists.sh b/scripts/command-exists.sh index d69ada8..bea10ee 100644 --- a/scripts/command-exists.sh +++ b/scripts/command-exists.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Function to check if a command exists diff --git a/scripts/conf-zsh-env.sh b/scripts/conf-zsh-env.sh index b5bf720..a105230 100644 --- a/scripts/conf-zsh-env.sh +++ b/scripts/conf-zsh-env.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # shellcheck disable=SC1091 @@ -10,12 +10,12 @@ conf_zsh_env() { print_step "Configure zsh environment" start_spinner "Configuring..." - { - local message - local zshenv_path - local os_id - local os_like + message="" + zshenv_path="" + os_id="" + os_like="" + { # zsh's global config dir varies: # Debian/Arch/Alpine use /etc/zsh, # RHEL/Fedora-family use /etc/zshenv @@ -42,7 +42,7 @@ conf_zsh_env() { fi EOF message="$(msg_ok "Zsh environment configured successfully!")" - } >> "$LOG_FILE" 2>&1 + } >> "${LOG_FILE:-/dev/null}" 2>&1 stop_spinner "$message" } \ No newline at end of file diff --git a/scripts/head.sh b/scripts/head.sh index 6c018a1..92d5c7c 100644 --- a/scripts/head.sh +++ b/scripts/head.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Head @@ -10,11 +10,15 @@ head() { # Define and format output using printf to control line width (80 characters) if [ -f /etc/os-release ]; then # shellcheck source=/dev/null - . /etc/os-release - os_name="${ID^}" # e.g. "Ubuntu" or "Debian" - desc="${PRETTY_NAME}" # e.g. "Debian GNU/Linux 12 (bookworm)" - version="${VERSION_ID}" # e.g. "12" - codename="${VERSION_CODENAME}" # e.g. "bookworm" + eval "$( + . /etc/os-release + rest="${ID#?}" + first="${ID%"$rest"}" + printf 'os_name=%s\n' "\"$(printf '%s' "$first" | tr '[:lower:]' '[:upper:]')$rest\"" + printf 'desc=%s\n' "\"$PRETTY_NAME\"" + printf 'version=%s\n' "\"$VERSION_ID\"" + printf 'codename=%s\n' "\"$VERSION_CODENAME\"" + )" else os_name="Unknown" desc="Unknown" diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh index b302b94..cdac882 100644 --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -1,7 +1,28 @@ -#!/usr/bin/env bash +#!/bin/sh # shellcheck disable=SC2086 +pkg_installed() { + case "$PACKAGER" in + apt-get) dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -q "install ok installed" ;; + dnf|yum|zypper) rpm -q "$1" >/dev/null 2>&1 ;; + pacman) pacman -Q "$1" >/dev/null 2>&1 ;; + apk) apk info -e "$1" >/dev/null 2>&1 ;; + *) return 1 ;; + esac +} + +install_pkg() { + case "$PACKAGER" in + apt-get) $SUDO_CMD env DEBIAN_FRONTEND=noninteractive apt-get install -y "$@" ;; + dnf|yum) $SUDO_CMD "$PACKAGER" install -y "$@" ;; + pacman) $SUDO_CMD pacman -S --noconfirm --needed "$@" ;; + zypper) $SUDO_CMD zypper --non-interactive install "$@" ;; + apk) $SUDO_CMD apk add "$@" ;; + *) printf 'Unsupported package manager: %s\n' "$PACKAGER"; return 1 ;; + esac +} + ################################################################################## ##### Function to install dependencies ################################################################################## @@ -10,42 +31,33 @@ install_deps() { DEPENDENCIES="stow curl tree wget unzip fontconfig ca-certificates jq" print_step "Install dependencies" - start_spinner "Installing..." - - { - printf "\n##### Function to install dependencies #####\n" - - local message - local install_status - - case "$PACKAGER" in - pacman) - ${SUDO_CMD} pacman-key --init - ${SUDO_CMD} "${PACKAGER}" -Sy --needed --noconfirm archlinux-keyring - ${SUDO_CMD} "${PACKAGER}" -Syu --needed --noconfirm ${DEPENDENCIES} - ;; - dnf | yum | zypper | apt | apt-get) - ${SUDO_CMD} "${PACKAGER}" install -y ${DEPENDENCIES} - ;; - apk) - ${SUDO_CMD} "${PACKAGER}" add ${DEPENDENCIES} - ;; - *) - ${SUDO_CMD} "${PACKAGER}" install -yq ${DEPENDENCIES} - ;; - esac - install_status=$? - - if [ "$install_status" -eq 0 ]; then - message="$(msg_ok "Dependencies installed!")" - else - message="$(msg_err "Something went wrong while installing dependencies! Check ${BOLD}${LOG_FILE}${RC} for details.")" + + for dep in $DEPENDENCIES; do + start_spinner "Installing..." + + message="" + install_status=0 + + { + if pkg_installed "$dep"; then + message="$(msg_skip "$dep")" + printf "\n--- %s skipped (already installed) ---\n" "$dep" + elif install_pkg "$dep"; then + message="$(msg_install_ok "$dep")" + printf "\n--- %s installed ---\n" "$dep" + else + install_status=$? + message="$(msg_err "Something went wrong while installing ${BOLD}${ITALIC}${MAGENTA}$dep${RC} pkg! Check ${BOLD}${LOG_FILE}${RC} for details.")" + printf "\n--- %s FAILED (exit %s) ---\n" "$dep" "$install_status" + fi + } >> "${LOG_FILE:-/dev/null}" 2>&1 + + if [ "$install_status" -ne 0 ]; then + stop_spinner "$message" + exit 1 fi - } >> "$LOG_FILE" 2>&1 - - stop_spinner "$message" - if [ "$install_status" -ne 0 ]; then - exit 1 - fi + stop_spinner "$message" + + done } \ No newline at end of file diff --git a/scripts/install-eza.sh b/scripts/install-eza.sh index bb21f7a..bdf87db 100644 --- a/scripts/install-eza.sh +++ b/scripts/install-eza.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Function to install eza @@ -8,11 +8,11 @@ install_eza() { print_step "Install eza" start_spinner "Installing..." + message="" + { printf "\n##### Function to install eza #####\n" - local message - if command_exists eza; then message="$(msg_skip "eza")" printf "Installation skipped - eza is already present!\n" @@ -23,12 +23,12 @@ install_eza() { ${SUDO_CMD} chown root:root eza ${SUDO_CMD} mv eza /usr/local/bin/eza if verify_installed eza; then - message="$(msg_ok "Successfully installed ${BOLD}eza${RC}.")" + message="$(msg_install_ok "eza")" else - message="$(msg_err "Installation of ${BOLD}eza${RC} could not be verified! Check ${BOLD}${LOG_FILE}${RC} for details.")" + message="$(msg_install_err "eza")" fi fi - } >> "$LOG_FILE" 2>&1 + } >> "${LOG_FILE:-/dev/null}" 2>&1 stop_spinner "$message" } \ No newline at end of file diff --git a/scripts/install-fd.sh b/scripts/install-fd.sh index 9e4b156..010114f 100644 --- a/scripts/install-fd.sh +++ b/scripts/install-fd.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Function to install fd @@ -11,28 +11,28 @@ install_fd() { print_step "Install fd" start_spinner "Installing..." + message="" + { printf "\n##### Function to install fd #####\n" - - local message if command_exists fd; then message="$(msg_skip "fd")" printf "Installation skipped - fd is already present!\n" else - local fd_version + fd_version fd_version=$(curl -s https://api.github.com/repos/sharkdp/fd/releases/latest | jq -r '.tag_name') cd /tmp || exit wget -c "https://github.com/sharkdp/fd/releases/download/${fd_version}/fd-${fd_version}-x86_64-unknown-linux-musl.tar.gz" -O - | tar xz ${SUDO_CMD} mv fd-*/fd /usr/local/bin/fd ${SUDO_CMD} chmod +x /usr/local/bin/fd if verify_installed fd; then - message="$(msg_ok "Successfully installed ${BOLD}fd${RC}.")" + message="$(msg_install_ok "fd")" else - message="$(msg_err "Installation of ${BOLD}fd${RC} could not be verified! Check ${BOLD}${LOG_FILE}${RC} for details.")" + message="$(msg_install_err "fd")" fi fi - } >> "$LOG_FILE" 2>&1 + } >> "${LOG_FILE:-/dev/null}" 2>&1 stop_spinner "$message" } \ No newline at end of file diff --git a/scripts/install-fzf.sh b/scripts/install-fzf.sh index d3c54fa..3d1e73e 100644 --- a/scripts/install-fzf.sh +++ b/scripts/install-fzf.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Function to install fzf @@ -8,12 +8,11 @@ install_fzf() { print_step "Install fzf" start_spinner "Installing..." + message="" + { printf "\n##### Function to install fzf #####\n" - local clone_message - local message - if command_exists fzf; then message="$(msg_skip "fzf")" printf "Installation skipped - fzf is already present!\n" @@ -23,12 +22,12 @@ install_fzf() { mkdir -p "$HOME/.local/bin" ln -sf "$HOME/.fzf/bin/fzf" "$HOME/.local/bin/fzf" if verify_installed fzf; then - message="$(msg_ok "Successfully installed ${BOLD}fzf${RC}.")" + message="$(msg_install_ok "fzf")" else - message="$(msg_err "Installation of ${BOLD}fzf${RC} could not be verified! Check ${BOLD}${LOG_FILE}${RC} for details.")" + message="$(msg_install_err "fzf")" fi fi - } >> "$LOG_FILE" 2>&1 + } >> "${LOG_FILE:-/dev/null}" 2>&1 - stop_spinner "$clone_message" "$message" + stop_spinner "$message" } \ No newline at end of file diff --git a/scripts/install-nerd-font.sh b/scripts/install-nerd-font.sh index afd6bc0..1490fa9 100644 --- a/scripts/install-nerd-font.sh +++ b/scripts/install-nerd-font.sh @@ -1,142 +1,140 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Fetch the canonical list of Nerd Font names (= release asset names) ################################################################################## get_font_list() { - local json json=$(curl -fsSL "$FONTS_JSON_URL") || { printf "Failed to fetch font list from %s\n" "$FONTS_JSON_URL" | tee -a "$LOG_FILE" >&2 - exit 0 + return 1 } if command -v python3 >/dev/null 2>&1; then printf '%s' "$json" | python3 -c ' import json, sys data = json.load(sys.stdin) -names = sorted(f["folderName"] for f in data["fonts"]) -print("\n".join(names)) +print("\n".join(sorted(f["folderName"] for f in data["fonts"]))) ' elif command -v jq >/dev/null 2>&1; then printf '%s' "$json" | jq -r '.fonts[].folderName' | sort else printf "Need python3 or jq installed to parse the font list\n" | tee -a "$LOG_FILE" >&2 - exit 0 + return 1 fi } +# True if directory $1 directly contains a .ttf/.otf file (any case) +has_font_files() { + for f in "$1"/*; do + case "$f" in + *.[tT][tT][fF]|*.[oO][tT][fF]) [ -f "$f" ] && return 0 ;; + esac + done + return 1 +} + ################################################################################## ##### Function to install Nerd font ################################################################################## install_nerd_font() { - print_step "Install Nerd font" # Ask for Nerd font at all - local need_nerd_font while true; do - read -rp "Do you want Nerd font [Y/n] " need_nerd_font + printf "Do you want Nerd font [Y/n] " + read -r need_nerd_font || { echo; return 0; } # EOF -> skip case "$need_nerd_font" in - [Yy]*) break ;; + ''|[Yy]*) break ;; [Nn]*) printf "Skipping font installation.\n" | tee -a "$LOG_FILE" - echo return 0 ;; - *) ehco "Please answer y or n." ;; + *) echo "Please answer y or n." ;; esac done - + # Menu is interactive, so it happens before the spinner starts. - mapfile -t fonts < <(get_font_list) + fonts=$(get_font_list) + total=$(printf '%s\n' "$fonts" | grep -c .) - # Check if fonts list is populated - if [ "${#fonts[@]}" -eq 0 ]; then + if [ "$total" -eq 0 ]; then printf "No fonts available - continuing without font installation.\n" | tee -a "$LOG_FILE" return 0 fi - + # Print menu echo - local cols=3 - local col_width=26 - local total=${#fonts[@]} - local total_items=$((total + 1)) - for ((i = 0; i < total_items; i++)); do - if (( i == 0 )); then - local skip_label="Skip installation" - local skip_pad=$(( col_width - ${#skip_label} )) - (( skip_pad < 0 )) && skip_pad=0 - printf "%3d) %s%s%s%*s" 0 "${BOLD}${GREEN}" "$skip_label" "${RC}" "$skip_pad" "" - else - printf "%3d) %-*s" "$i" "$col_width" "${fonts[$((i - 1))]}" - fi - if (( (i + 1) % cols == 0 )); then - echo - fi - done - if (( total_items % cols != 0 )); then - echo - fi - echo - - local choice + cols=3 + col_width=26 + i=0 + printf "%3d) %s%-${col_width}s%s" 0 "${BOLD}${GREEN}" "Skip installation" "${RC}" + while IFS= read -r font; do + i=$((i + 1)) + if [ $((i % cols)) -eq 0 ]; then echo; fi + printf "%3d) %-${col_width}s" "$i" "$font" + done </dev/null | grep -q .; then - message="$(msg_skip "$NERD_FONT_FAMILY")" + + message="" + font_dir="$FONT_INSTALL_ROOT/${font_family}NerdFont" + + # Already installed? (checked by font files, not fc-list name, + # since the internal family name doesn't always match) + if has_font_files "$font_dir"; then + message="$(msg_skip "$font_family")" + elif ! tmp_dir=$(mktemp -d); then + message="$(msg_err "Could not create a temporary directory!")" else - local tmp_dir archive url - tmp_dir=$(mktemp -d) - archive="$tmp_dir/${NERD_FONT_FAMILY}.zip" - url="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${NERD_FONT_FAMILY}.zip" - + archive="$tmp_dir/${font_family}.zip" + url="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${font_family}.zip" + if ! curl -fsSL "$url" -o "$archive"; then - message="$(msg_err "Failed to download ${BOLD}$NERD_FONT_FAMILY${RC}! Check ${BOLD}${LOG_FILE}${RC} for details.")" + message="$(msg_err "Failed to download ${BOLD}$font_family${RC}! Check ${BOLD}${LOG_FILE}${RC} for details.")" else mkdir -p "$tmp_dir/unpacked" "$font_dir" if ! unzip -qq -o "$archive" -d "$tmp_dir/unpacked"; then - message="$(msg_err "Failed to extract ${BOLD}$NERD_FONT_FAMILY${RC}! Check ${BOLD}${LOG_FILE}${RC} for details.")" + message="$(msg_err "Failed to extract ${BOLD}$font_family${RC}! Check ${BOLD}${LOG_FILE}${RC} for details.")" else - find "$tmp_dir/unpacked" -type f \( -iname '*.ttf' -o -iname '*.otf' \) -exec cp {} "$font_dir/" \; - - if ! find "$font_dir" -maxdepth 1 \( -iname '*.ttf' -o -iname '*.otf' \) | grep -q .; then - message="$(msg_err "No font files found for ${BOLD}$NERD_FONT_FAMILY${RC}!")" + find "$tmp_dir/unpacked" -type f \ + \( -name '*.[tT][tT][fF]' -o -name '*.[oO][tT][fF]' \) \ + -exec cp {} "$font_dir/" \; + + if ! has_font_files "$font_dir"; then + message="$(msg_err "No font files found for ${BOLD}$font_family${RC}!")" else fc-cache -f "$font_dir" >/dev/null 2>&1 - message="$(msg_ok "Font ${BOLD}$NERD_FONT_FAMILY${RC} installed.")" + message="$(msg_ok "Font ${BOLD}${ITALIC}${MAGENTA}$font_family${RC} installed.")" fi fi fi - + rm -rf "$tmp_dir" fi - } >> "$LOG_FILE" 2>&1 - + } >> "${LOG_FILE:-/dev/null}" 2>&1 + stop_spinner "$message" | tee -a "$LOG_FILE" } \ No newline at end of file diff --git a/scripts/install-ohmyposh.sh b/scripts/install-ohmyposh.sh index 56e58bd..bf6e1ef 100644 --- a/scripts/install-ohmyposh.sh +++ b/scripts/install-ohmyposh.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Function to install oh-my-posh @@ -8,12 +8,12 @@ install_ohmyposh() { print_step "Install oh-my-posh" start_spinner "Installing..." + mkdir_message="" + mkdir_confirm="" + message="" + { printf "\n##### Function to install oh-my-posh #####\n" - - local mkdir_message - local mkdir_confirm - local message if command_exists oh-my-posh; then message="$(msg_skip "oh-my-posh")" @@ -29,12 +29,12 @@ install_ohmyposh() { # Install Oh My Posh if curl -sS https://ohmyposh.dev/install.sh | bash -s -- -d ~/.local/bin && verify_installed oh-my-posh; then - message="$(msg_ok "Successfully installed ${BOLD}oh-my-posh${RC}!")" + message="$(msg_install_ok "oh-my-posh")" else - message="$(msg_err "Installation of ${BOLD}oh-my-posh${RC} could not be verified! Check ${BOLD}${LOG_FILE}${RC} for details.")" + message="$(msg_install_err "oh-my-posh")" fi fi - } >> "$LOG_FILE" 2>&1 + } >> "${LOG_FILE:-/dev/null}" 2>&1 stop_spinner "$mkdir_message" "$mkdir_confirm" "$message" } \ No newline at end of file diff --git a/scripts/install-zoxide.sh b/scripts/install-zoxide.sh index 4e98f50..96d08ce 100644 --- a/scripts/install-zoxide.sh +++ b/scripts/install-zoxide.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Function to install zoxide @@ -8,10 +8,10 @@ install_zoxide() { print_step "Install zoxide" start_spinner "Installing..." + message="" + { printf "\n##### Function to install zoxide #####\n" - - local message if command_exists zoxide; then message="$(msg_skip "zoxide")" @@ -19,12 +19,12 @@ install_zoxide() { else curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh if verify_installed zoxide; then - message="$(msg_ok "Successfully installed ${BOLD}zoxide${RC}.")" + message="$(msg_install_ok "zoxide")" else - message="$(msg_err "Installation of ${BOLD}zoxide${RC} could not be verified! Check ${BOLD}${LOG_FILE}${RC} for details.")" + message="$(msg_install_err "zoxide")" fi fi - } >> "$LOG_FILE" 2>&1 + } >> "${LOG_FILE:-/dev/null}" 2>&1 stop_spinner "$message" } diff --git a/scripts/install-zsh.sh b/scripts/install-zsh.sh index d176360..7f3b529 100644 --- a/scripts/install-zsh.sh +++ b/scripts/install-zsh.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Function to install zsh @@ -11,9 +11,12 @@ install_zsh() { { printf "\n##### Function to install zsh #####\n" - local message - - if ! command_exists zsh; then + message + + if command_exists zsh; then + message="$(msg_skip "zsh")" + printf "Installation skipped - zsh is already present!\n" + else case "$PACKAGER" in pacman) ${SUDO_CMD} "$PACKAGER" -S --needed --noconfirm zsh @@ -26,15 +29,13 @@ install_zsh() { ;; esac if verify_installed zsh; then - message="$(msg_ok "Successfully installed ${BOLD}zsh${RC}.")" + message="$(msg_install_ok "zsh")" else - message="$(msg_err "Installation of ${BOLD}zsh${RC} could not be verified! Check ${BOLD}${LOG_FILE}${RC} for details.")" + message="$(msg_install_err "zsh")" fi - else - message="$(msg_skip "zsh")" fi - } >> "$LOG_FILE" 2>&1 + } >> "${LOG_FILE:-/dev/null}" 2>&1 stop_spinner "$message" } \ No newline at end of file diff --git a/scripts/logging.sh b/scripts/logging.sh index b3789fd..5dcba74 100644 --- a/scripts/logging.sh +++ b/scripts/logging.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Log file diff --git a/scripts/output.sh b/scripts/output.sh index 3bcd8ba..973257d 100644 --- a/scripts/output.sh +++ b/scripts/output.sh @@ -1,17 +1,29 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Output helpers ################################################################################## # Section header: ==> Title print_step() { - printf '%s==>%s %s%s%s\n' \ + printf '\n%s==>%s %s%s%s\n' \ "${BOLD}${BLUE}" "${RC}" "${BOLD}${ITALIC}${YELLOW}" "$1" "${RC}" } # Status line builders (==> message), no trailing newline msg_ok() { printf '[%s%s] %s' "${BOLD}${GREEN}${SUCCESS}" "${RC}" "$1"; } + +msg_install_ok() { + printf '[%s%s] Successfully installed %s%s%s package.' \ + "${BOLD}${GREEN}${SUCCESS}" "${RC}" "${BOLD}${ITALIC}${MAGENTA}" "$1" "${RC}" +} + +msg_install_err() { + printf '[%s%s] Installation of %s%s%s could not be verified! Check %s for details.' \ + "${BOLD}${RED}${FAILED}" "${RC}" "${BOLD}${ITALIC}${MAGENTA}" "$1" "${RC}" "${BOLD}${LOG_FILE}${RC}" +} + msg_err() { printf '[%s%s] %s' "${BOLD}${RED}${FAILED}" "${RC}" "$1"; } + msg_warn() { printf '[%s%s] %s' "${BOLD}${YELLOW}${WARNING}" "${RC}" "$1"; } # "Installation skipped - is already present!" diff --git a/scripts/setup-zsh-conf.sh b/scripts/setup-zsh-conf.sh index 334bf66..a6ad6d6 100644 --- a/scripts/setup-zsh-conf.sh +++ b/scripts/setup-zsh-conf.sh @@ -1,7 +1,68 @@ -#!/usr/bin/env bash +#!/bin/sh # shellcheck disable=SC2059 +################################################################################## +##### Steps for zsh configuration (stops at the first failure) +################################################################################## +_setup_zsh_conf_steps() { + + # Check if the dotfiles directory exists + cd "$DOTFILES_DIR" || { + message="$(msg_err "Dotfiles directory '$DOTFILES_DIR' not found")" + return 1 + } + + # Check if stow is available + if ! command_exists stow; then + message="$(msg_err "${BOLD}Stow${RC} is not installed. Please install it first.")" + return 1 + fi + + # Back up existing configs that would conflict + for rc in .nanorc .vimrc; do + if [ -f "$HOME/$rc" ] && [ ! -L "$HOME/$rc" ]; then + mv "$HOME/$rc" "$HOME/$rc.bak" + printf '%s backed up to ~/%s.bak\n' "$rc" "$rc" + fi + done + + # Dry run first to check for conflicts (same target as the real run) + printf 'Checking for potential stow conflicts...\n' + if ! stow -n -t "$HOME" .; then + message="$(msg_err "${BOLD}Stow${RC} detected conflicts. You may need to manually resolve conflicts.")" + return 1 + fi + + # Perform actual stow + printf 'Creating symlinks...\n' + if ! stow -t "$HOME" .; then + message="$(msg_err "Failed to create symlinks.")" + return 1 + fi + + # Verify critical files were linked + if [ ! -f "$HOME/.config/zsh/.zshrc" ]; then + message="$(msg_err "Failed to create ${BOLD}.zshrc${RC} symlink.")" + return 1 + fi + + # Change default shell to zsh for current user + zsh_path="$(command -v zsh)" || { + message="$(msg_err "${BOLD}zsh${RC} not found in PATH.")" + return 1 + } + if ! ${SUDO_CMD} chsh -s "$zsh_path" "$(id -un)"; then + message="$(msg_err "Failed to change default shell to ${BOLD}zsh${RC}.")" + return 1 + fi + + # Create required directories + mkdir -p "$HOME/.local/state/zsh" "$HOME/.cache/zsh" + + message="$(msg_ok "Configuration of ${BOLD}${ITALIC}${MAGENTA}zsh${RC} setup completed successfully!")" +} + ################################################################################## ##### Function to setup zsh configuration ################################################################################## @@ -10,70 +71,24 @@ setup_zsh_conf() { print_step "Setup zsh configuration" start_spinner "Configuring..." + message="" + continue=true + { printf "\n##### Function to setup zsh configuration #####\n" - local message - - # Check if the dotfiles directory exists - cd "$DOTFILES_DIR" || { - message="$(msg_err "Dotfiles directory '$DOTFILES_DIR' not found")" - exit 1 - } - - # Check if stow is available - if ! command_exists stow; then - message="$(msg_err "${BOLD}Stow${RC} is not installed. Please install it first.")" - exit 1 - fi - - # Check if ~/.nanorc exists - if [ -f "$HOME/.nanorc" ]; then - mv "$HOME/.nanorc" "$HOME/.nanorc.bak" - printf "%snano configuration file backup in ~/.nanorc.bak%s\n" "${GREEN}" "${RC}" - fi - - # Check if ~/.vimrc exists - if [ -f "$HOME/.vimrc" ]; then - mv "$HOME/.vimrc" "$HOME/.vimrc.bak" - printf "%svim configuration file backup in ~/.vimrc.bak%s\n" "${GREEN}" "${RC}" - fi - - # Do stow dry run first to check for conflicts - printf "$(msg_warn "Checking for potential stow conflicts...")" - - if ! stow -n .; then - message="$(msg_err "${BOLD}Stow${RC} detected conflicts. You may need to manually resolve conflicts.")" - exit 1 - fi - - # If dry run successful, perform actual stow - printf "$(msg_warn "Creating symlinks...")" - - if ! stow -t "$HOME" .; then - message="$(msg_err "Failed to create symlinks.")" - exit 1 - fi - - # Verify critical files were linked - if [ ! -f "$HOME/.config/zsh/.zshrc" ]; then - message="$(msg_err "Failed to create ${BOLD}.zshrc${RC} symlink.")" - exit 1 - fi - - # Change default shell to zsh for current user - ${SUDO_CMD} chsh -s "$(which zsh)" "$USER" + _setup_zsh_conf_steps || continue=false - # Create required directories - mkdir -p "$HOME/.local/state/zsh" # history - mkdir -p "$HOME/.cache/zsh" # completion cache - - message="$(msg_ok "Configuration of ${BOLD}${ITALIC}${MAGENTA}zsh${RC} setup completed successfully!")" - - } >> "$LOG_FILE" 2>&1 + } >> "${LOG_FILE:-/dev/null}" 2>&1 stop_spinner "$message" + if [ "$continue" = false ]; then + exit 1 + fi + # Source the new configuration + printf "\n" printf "%sPlease execute %sexec zsh%s %sand the installation will continue ...%s" "${BOLD}${ITALIC}" "${BOLD}${MAGENTA}" "${RC}" "${BOLD}${ITALIC}" "${RC}" + printf "\n" } \ No newline at end of file diff --git a/scripts/spinner.sh b/scripts/spinner.sh index ed8dea7..b07a21c 100644 --- a/scripts/spinner.sh +++ b/scripts/spinner.sh @@ -1,51 +1,62 @@ -#!/usr/bin/env bash +#!/bin/sh # shellcheck disable=SC2034 ################################################################################## ##### Spinner ################################################################################## -# Define an array of Braille patterns for a spinner -eight_dot_cell_pattern=("⣾" "⢿" "⡿" "⣷" "⣯" "⢟" "⡻" "⣽") -six_dot_cell_pattern=("⠋" "⠙" "⠹" "⠸" "⠼" "⠴" "⠦" "⠧" "⠇" "⠏") +# Braille patterns for the spinner (space-separated frames) +eight_dot_cell_pattern="⣾ ⢿ ⡿ ⣷ ⣯ ⢟ ⡻ ⣽" +six_dot_cell_pattern="⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏" # Set the pattern -braille_spinner=("${six_dot_cell_pattern[@]}") +braille_spinner="$six_dot_cell_pattern" -# Set the duration for each spinner frame (in seconds) +# Duration of each spinner frame (in seconds) frame_duration=0.2 -# Function to start the spinner in the background +spinner_pid="" + +# Start the spinner in the background start_spinner() { action_message=$1 ( - idx=0 while :; do - printf "\r[%s] %s" "${braille_spinner[idx]}" "$action_message" - idx=$(( (idx + 1) % ${#braille_spinner[@]} )) - sleep "$frame_duration" + for frame in $braille_spinner; do + printf "\r[%s] %s" "$frame" "$action_message" + sleep "$frame_duration" + done done ) & spinner_pid=$! - disown } -# Function to stop the spinner with U+2800 +# Stop the spinner and print the result messages stop_spinner() { - kill -9 "$spinner_pid" 2>/dev/null # Stop the spinner loop - wait "$spinner_pid" 2>/dev/null + if [ -n "$spinner_pid" ]; then + kill "$spinner_pid" 2>/dev/null + wait "$spinner_pid" 2>/dev/null + spinner_pid="" + fi - # Move to start of line and clear it, instead of just moving to a new line + # Move to start of line and clear it printf "\r\033[K" - # Process all arguments for msg in "$@"; do - [[ -n "$msg" ]] && printf "%b\n" "$msg" + if [ -n "$msg" ]; then + printf "%b\n" "$msg" + fi done - - printf "\n" } -# Kill the spinner when the script exits, regardless of success or failure or someone pressing Ctrl+C -trap 'kill -9 "$spinner_pid" 2>/dev/null; printf "\n"' EXIT \ No newline at end of file +# Kill the spinner on exit, error, or Ctrl+C +cleanup_spinner() { + if [ -n "$spinner_pid" ]; then + kill "$spinner_pid" 2>/dev/null + printf "\r\033[K" + fi +} +trap cleanup_spinner EXIT +trap 'exit 130' INT +trap 'exit 143' TERM \ No newline at end of file diff --git a/scripts/update-system.sh b/scripts/update-system.sh index cd9ae30..d251c59 100644 --- a/scripts/update-system.sh +++ b/scripts/update-system.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Function to update system packages @@ -8,8 +8,8 @@ update_system() { print_step "Update system packages" start_spinner "Updating..." - local message - local unsupported=0 + message="" + unsupported=0 { printf "\n##### Function to update system packages #####\n" diff --git a/scripts/verify-installed.sh b/scripts/verify-installed.sh index 0beefa4..55b21fd 100644 --- a/scripts/verify-installed.sh +++ b/scripts/verify-installed.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ################################################################################## ##### Function to verify a tool is available after installing diff --git a/setup.sh b/setup.sh index 3e07d37..f3f0cff 100755 --- a/setup.sh +++ b/setup.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # shellcheck disable=SC2034,SC1090 @@ -8,10 +8,12 @@ BOX_WIDTH=76 ################################################################################## ##### Load external functions ################################################################################## -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +SCRIPT_DIR="$(cd -- "$(dirname -- "$0")" && pwd -P)" for f in "$SCRIPT_DIR"/scripts/*; do - [[ -f "$f" ]] && source "$f" + if [ -f "$f" ]; then + . "$f" + fi done ################################################################################## @@ -24,6 +26,7 @@ check_env auth_sudo update_system install_deps +install_nerd_font "$@" install_zsh conf_zsh_env install_ohmyposh From c9c6cde4aefa6766392071afd00c5505af3bfc05 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 27 Sep 2026 13:49:00 +0300 Subject: [PATCH 15/15] removed the dublicated func call --- setup.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.sh b/setup.sh index f3f0cff..4f62bca 100755 --- a/setup.sh +++ b/setup.sh @@ -21,7 +21,6 @@ done ################################################################################## head start_log -install_nerd_font "$@" check_env auth_sudo update_system