From 94d889d5b0cf00a1aa72f482e24472e74607aa44 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 11 Dec 2018 16:19:30 -0500 Subject: [PATCH] shellcheck --- larbs.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/larbs.sh b/larbs.sh index 70894ff..142912a 100755 --- a/larbs.sh +++ b/larbs.sh @@ -55,14 +55,14 @@ getuserandpass() { \ done pass1=$(dialog --no-cancel --passwordbox "Enter a password for that user." 10 60 3>&1 1>&2 2>&3 3>&1) pass2=$(dialog --no-cancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1) - while ! [[ ${pass1} == ${pass2} ]]; do + while ! [[ ${pass1} == "${pass2}" ]]; do unset pass2 pass1=$(dialog --no-cancel --passwordbox "Passwords do not match.\\n\\nEnter password again." 10 60 3>&1 1>&2 2>&3 3>&1) pass2=$(dialog --no-cancel --passwordbox "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1) done ;} usercheck() { \ - ! (id -u $name &>/dev/null) || + ! (id -u "$name" &>/dev/null) || dialog --colors --title "WARNING!" --yes-label "CONTINUE" --no-label "No wait..." --yesno "The user \`$name\` already exists on this system. LARBS can install for a user already existing, but it will \\Zboverwrite\\Zn any conflicting settings/dotfiles on the user account.\\n\\nLARBS will \\Zbnot\\Zn overwrite your user files, documents, videos, etc., so don't worry about that, but only click if you don't mind your settings being overwritten.\\n\\nNote also that LARBS will change $name's password to the one you just gave." 14 70 } @@ -76,12 +76,12 @@ adduserandpass() { \ gitmakeinstall() { dir=$(mktemp -d) - dialog --title "LARBS Installation" --infobox "Installing \`$(basename $1)\` ($n of $total) via \`git\` and \`make\`. $(basename $1) $2" 5 70 + dialog --title "LARBS Installation" --infobox "Installing \`$(basename "$1")\` ($n of $total) via \`git\` and \`make\`. $(basename "$1") $2" 5 70 git clone --depth 1 "$1" "$dir" &>/dev/null cd "$dir" || exit make &>/dev/null make install &>/dev/null - cd /tmp ;} + cd /tmp || return ;} maininstall() { # Installs all needed programs from main repo. dialog --title "LARBS Installation" --infobox "Installing \`$1\` ($n of $total). $1 $2" 5 70 @@ -91,7 +91,7 @@ maininstall() { # Installs all needed programs from main repo. aurinstall() { \ dialog --title "LARBS Installation" --infobox "Installing \`$1\` ($n of $total) from the AUR. $1 $2" 5 70 grep "^$1$" <<< "$aurinstalled" && return - sudo -u $name $aurhelper -S --noconfirm "$1" &>/dev/null + sudo -u "$name" $aurhelper -S --noconfirm "$1" &>/dev/null } installationloop() { \ @@ -137,17 +137,17 @@ resetpulse() { dialog --infobox "Reseting Pulseaudio..." 4 50 manualinstall() { # Installs $1 manually if not installed. Used only for AUR helper here. [[ -f /usr/bin/$1 ]] || ( dialog --infobox "Installing \"$1\", an AUR helper..." 4 50 - cd /tmp + cd /tmp || exit rm -rf /tmp/"$1"* curl -sO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz && sudo -u "$name" tar -xvf "$1".tar.gz &>/dev/null && cd "$1" && - sudo -u $name makepkg --noconfirm -si &>/dev/null - cd /tmp) ;} + sudo -u "$name" makepkg --noconfirm -si &>/dev/null + cd /tmp || return) ;} finalize(){ \ dialog --infobox "Preparing welcome message..." 4 50 - echo "exec_always --no-startup-id notify-send -i ~/.scripts/pix/larbs.png 'Welcome to LARBS: Press Super+F1 for the manual.' -t 10000" >> /home/$name/.config/i3/config + echo "exec_always --no-startup-id notify-send -i ~/.scripts/pix/larbs.png 'Welcome to LARBS: Press Super+F1 for the manual.' -t 10000" >> "/home/$name/.config/i3/config" dialog --title "All done!" --msgbox "Congrats! Provided there were no hidden errors, the script completed successfully and all the programs and configuration files should be in place.\\n\\nTo run the new graphical environment, log out and log back in as your new user, then run the command \"startx\" to start the graphical environment.\\n\\n-Luke" 12 80 }