Merge branch 'master' of github.com:LukeSmithxyz/LARBS

This commit is contained in:
Luke Smith 2020-11-06 12:50:18 -05:00
commit 9fdf6f6abc
No known key found for this signature in database
GPG Key ID: 4C50B54A911F6252

View File

@ -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
@ -46,12 +46,12 @@ getuserandpass() { \
done ;}
usercheck() { \
! (id -u "$name" >/dev/null) 2>&1 ||
! { id -u "$name" >/dev/null 2>&1; } ||
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 <CONTINUE> 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
}
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 <Let's go!> 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 <Let's go!> and the system will begin installation!" 13 60 || { clear; exit 1; }
}
adduserandpass() { \
@ -76,13 +76,13 @@ 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 &&
cd "$1" &&
sudo -u "$name" makepkg --noconfirm -si >/dev/null 2>&1
cd /tmp || return) ;}
cd /tmp || return 1) ;}
maininstall() { # Installs all needed programs from main repo.
dialog --title "LARBS Installation" --infobox "Installing \`$1\` ($n of $total). $1 $2" 5 70
@ -93,21 +93,21 @@ gitmakeinstall() {
progname="$(basename "$1" .git)"
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
sudo -u "$name" git clone --depth 1 "$1" "$dir" >/dev/null 2>&1 || { cd "$dir" || return 1 ; sudo -u "$name" git pull --force origin master;}
cd "$dir" || exit 1
make >/dev/null 2>&1
make install >/dev/null 2>&1
cd /tmp || return ;}
cd /tmp || return 1 ;}
aurinstall() { \
dialog --title "LARBS Installation" --infobox "Installing \`$1\` ($n of $total) from the AUR. $1 $2" 5 70
echo "$aurinstalled" | grep -q "^$1$" && return
echo "$aurinstalled" | grep -q "^$1$" && return 1
sudo -u "$name" $aurhelper -S --noconfirm "$1" >/dev/null 2>&1
}
pipinstall() { \
dialog --title "LARBS Installation" --infobox "Installing the Python package \`$1\` ($n of $total). $1 $2" 5 70
command -v pip || installpkg python-pip >/dev/null 2>&1
[ -x "$(command -v "pip")" ] || installpkg python-pip >/dev/null 2>&1
yes | pip install "$1"
}