From 639067a2eb2f3fb378d748324a11dfec586754bc Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 17 Jan 2026 18:45:12 -0600 Subject: fix(archsetup): misc bug fixes and improvements - Add missing error codes to error() calls - Remove useless mkdir pipe to tee - Remove duplicate 5353/udp firewall rule - Replace deprecated exfat-utils with exfatprogs - Quote all variable expansions for safety - Use pipx instead of pip for isolated environments --- archsetup | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/archsetup b/archsetup index 43807c6..495ae5a 100755 --- a/archsetup +++ b/archsetup @@ -317,11 +317,11 @@ aur_install() { fi } -# PIP Install +# PIP Install (using pipx for isolated environments) pip_install() { - [ -x "$(command -v "pip")" ] || pacman_install python-pip - action="installing $1 via PIP" && display "task" "$action" - (yes | sudo -u "$username" pip install "$1" >> "$logfile" 2>&1) || \ + [ -x "$(command -v "pipx")" ] || pacman_install python-pipx + action="installing $1 via pipx" && display "task" "$action" + (sudo -u "$username" pipx install "$1" >> "$logfile" 2>&1) || \ error "error" "$action" "$?" } @@ -453,7 +453,7 @@ create_user () { display "task" "configuring shell" # zsh cache required: $username will install via yay; zsh will run those commands - mkdir -p "/home/$username/.cache/zsh/" | tee -a "$logfile" + mkdir -p "/home/$username/.cache/zsh/" # give $username sudo nopasswd rights (required for aur installs) display "task" "granting permissions" @@ -496,24 +496,24 @@ user_customizations() { action="creating common directories" && display "task" "$action" # Create default directories and grant permissions { - mkdir -p -m 751 /home/$username/code - mkdir -p -m 751 /home/$username/documents - mkdir -p -m 751 /home/$username/downloads/torrents/complete - mkdir -p -m 751 /home/$username/downloads/torrents/incomplete - mkdir -p -m 751 /home/$username/downloads/torrents/files - mkdir -p -m 751 /home/$username/downloads/ebooks - mkdir -p -m 751 /home/$username/music - mkdir -p -m 751 /home/$username/projects - mkdir -p -m 751 /home/$username/pictures/screenshots - mkdir -p -m 751 /home/$username/videos - mkdir -p -m 751 /home/$username/vms - chown -R $username: /home/$username + mkdir -p -m 751 "/home/$username/code" + mkdir -p -m 751 "/home/$username/documents" + mkdir -p -m 751 "/home/$username/downloads/torrents/complete" + mkdir -p -m 751 "/home/$username/downloads/torrents/incomplete" + mkdir -p -m 751 "/home/$username/downloads/torrents/files" + mkdir -p -m 751 "/home/$username/downloads/ebooks" + mkdir -p -m 751 "/home/$username/music" + mkdir -p -m 751 "/home/$username/projects" + mkdir -p -m 751 "/home/$username/pictures/screenshots" + mkdir -p -m 751 "/home/$username/videos" + mkdir -p -m 751 "/home/$username/vms" + chown -R "$username": "/home/$username" mkdir -p -m 751 /media/backup mkdir -p -m 751 /media/remote0 mkdir -p -m 751 /media/remote1 mkdir -p -m 751 /media/remote2 - chown -R $username: /media + chown -R "$username": /media } >> "$logfile" 2>&1 } @@ -526,7 +526,7 @@ aur_installer () { display "task" "fetching source code for yay" if ! (sudo -u "$username" git clone --depth 1 "$yay_repo" "$build_dir" >> "$logfile" 2>&1); then - error "error" "cloning source code for yay - directory may exist, removing and retrying" + error "error" "cloning source code for yay - directory may exist, removing and retrying" "$?" (rm -rf "$build_dir" >> "$logfile" 2>&1) || \ error "crash" "removing existing directory for yay" "$?" (sudo -u "$username" git clone --depth 1 "$yay_repo" "$build_dir" >> "$logfile" 2>&1) || \ @@ -593,13 +593,12 @@ essential_services() { pacman_install ufw action="configuring ufw to deny by default" && display "task" "$action" - ufw default deny incoming >> "$logfile" 2>&1 || error "error" "$action" + ufw default deny incoming >> "$logfile" 2>&1 || error "error" "$action" "$?" for protocol in \ "80,443,8080/tcp" \ "9040,9050,9051,9053,9119/tcp" \ "IMAP" "IMAPS" \ - "5353/udp" \ "ssh" \ "22000/tcp" "22000/udp" "21027/udp" \ "42001/tcp" "42001/udp" \ @@ -930,7 +929,7 @@ desktop_environment() { action="System Utilities" && display "subtitle" "$action" pacman_install dmidecode pacman_install dosfstools - pacman_install exfat-utils + pacman_install exfatprogs pacman_install lshw pacman_install ntfs-3g pacman_install sshfs @@ -1179,7 +1178,7 @@ developer_workstation () { pacman_install yt-dlp # video download action="setting up emacs configuration files" && display "task" "$action" - (sudo -u "$username" git clone --recurse-submodules $dotemacs_repo /home/$username/.emacs.d >> \ + (sudo -u "$username" git clone --recurse-submodules "$dotemacs_repo" "/home/$username/.emacs.d" >> \ "$logfile" 2>&1) || error "error" "$action" "$?" action="Android Utilities" && display "subtitle" "$action" -- cgit v1.2.3