diff --git a/larbs.sh b/larbs.sh index 5b4b718..e70385d 100644 --- a/larbs.sh +++ b/larbs.sh @@ -6,12 +6,12 @@ ### OPTIONS AND VARIABLES ### while getopts ":a:r:b:p:h" o; do case "${o}" in - h) printf "Optional arguments for custom use:\\n -r: Dotfiles repository (local file or url)\\n -p: Dependencies and programs csv (local file or url)\\n -a: AUR helper (must have pacman-like syntax)\\n -h: Show this message\\n" && exit ;; - r) dotfilesrepo=${OPTARG} && git ls-remote "$dotfilesrepo" || exit ;; + h) printf "Optional arguments for custom use:\\n -r: Dotfiles repository (local file or url)\\n -p: Dependencies and programs csv (local file or url)\\n -a: AUR helper (must have pacman-like syntax)\\n -h: Show this message\\n" && exit 1 ;; + r) dotfilesrepo=${OPTARG} && git ls-remote "$dotfilesrepo" || exit 1 ;; b) repobranch=${OPTARG} ;; p) progsfile=${OPTARG} ;; a) aurhelper=${OPTARG} ;; - *) printf "Invalid option: -%s\\n" "$OPTARG" && exit ;; + *) printf "Invalid option: -%s\\n" "$OPTARG" && exit 1 ;; esac done [ -z "$dotfilesrepo" ] && dotfilesrepo="https://github.com/lukesmithxyz/voidrice.git" @@ -23,7 +23,7 @@ esac done installpkg(){ pacman --noconfirm --needed -S "$1" >/dev/null 2>&1 ;} -error() { clear; printf "ERROR:\\n%s\\n" "$1"; exit;} +error() { clear; printf "ERROR:\\n%s\\n" "$1" >&2; exit 1;} welcomemsg() { \ dialog --title "Welcome!" --msgbox "Welcome to Luke's Auto-Rice Bootstrapping Script!\\n\\nThis script will automatically install a fully-featured Linux desktop, which I use as my main machine.\\n\\n-Luke" 10 60 @@ -33,7 +33,7 @@ welcomemsg() { \ getuserandpass() { \ # Prompts user for new username an password. - name=$(dialog --inputbox "First, please enter a name for the user account." 10 60 3>&1 1>&2 2>&3 3>&1) || exit + name=$(dialog --inputbox "First, please enter a name for the user account." 10 60 3>&1 1>&2 2>&3 3>&1) || exit 1 while ! echo "$name" | grep -q "^[a-z_][a-z0-9_-]*$"; do name=$(dialog --no-cancel --inputbox "Username not valid. Give a username beginning with a letter, with only lowercase letters, - or _." 10 60 3>&1 1>&2 2>&3 3>&1) done @@ -51,7 +51,7 @@ usercheck() { \ } preinstallmsg() { \ - dialog --title "Let's get this party started!" --yes-label "Let's go!" --no-label "No, nevermind!" --yesno "The rest of the installation will now be totally automated, so you can sit back and relax.\\n\\nIt will take some time, but when done, you can relax even more with your complete system.\\n\\nNow just press and the system will begin installation!" 13 60 || { clear; exit; } + dialog --title "Let's get this party started!" --yes-label "Let's go!" --no-label "No, nevermind!" --yesno "The rest of the installation will now be totally automated, so you can sit back and relax.\\n\\nIt will take some time, but when done, you can relax even more with your complete system.\\n\\nNow just press and the system will begin installation!" 13 60 || { clear; exit 1; } } adduserandpass() { \ @@ -76,7 +76,7 @@ newperms() { # Set special sudoers settings for install (or after). 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 || exit + cd /tmp || exit 1 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 2>&1 && @@ -94,7 +94,7 @@ gitmakeinstall() { dir="$repodir/$progname" dialog --title "LARBS Installation" --infobox "Installing \`$progname\` ($n of $total) via \`git\` and \`make\`. $(basename "$1") $2" 5 70 sudo -u "$name" git clone --depth 1 "$1" "$dir" >/dev/null 2>&1 || { cd "$dir" || return ; sudo -u "$name" git pull --force origin master;} - cd "$dir" || exit + cd "$dir" || exit 1 make >/dev/null 2>&1 make install >/dev/null 2>&1 cd /tmp || return ;}