master
TiynGER 5 years ago
parent 49ccaa9f72
commit baaa86adfe

@ -14,14 +14,24 @@ while getopts ":a:r:b:p:h" o; do case "${o}" in
*) printf "Invalid option: -%s\\n" "$OPTARG" && exit ;; *) printf "Invalid option: -%s\\n" "$OPTARG" && exit ;;
esac done esac done
[ -z "$dotfilesrepo" ] && dotfilesrepo="https://github.com/tiynger/.dotfiles.git" [ -z "$dotfilesrepo" ] && dotfilesrepo="https://github.com/tiynger/voidrice.git"
[ -z "$progsfile" ] && progsfile="https://raw.githubusercontent.com/tiynger/larbs/master/progs.csv" [ -z "$progsfile" ] && progsfile="https://raw.githubusercontent.com/LukeSmithxyz/LARBS/master/progs.csv"
[ -z "$aurhelper" ] && aurhelper="yay" [ -z "$aurhelper" ] && aurhelper="yay"
[ -z "$repobranch" ] && repobranch="master" [ -z "$repobranch" ] && repobranch="master"
### FUNCTIONS ### ### FUNCTIONS ###
if type xbps-install >/dev/null 2>&1; then
installpkg(){ xbps-install -y "$1" >/dev/null 2>&1 ;}
grepseq="\"^[PGV]*,\""
elif type apt >/dev/null 2>&1; then
installpkg(){ apt-get install -y "$1" >/dev/null 2>&1 ;}
grepseq="\"^[PGU]*,\""
else
distro="arch"
installpkg(){ pacman --noconfirm --needed -S "$1" >/dev/null 2>&1 ;} installpkg(){ pacman --noconfirm --needed -S "$1" >/dev/null 2>&1 ;}
grepseq="\"^[PGA]*,\""
fi
error() { clear; printf "ERROR:\\n%s\\n" "$1"; exit;} error() { clear; printf "ERROR:\\n%s\\n" "$1"; exit;}
@ -29,6 +39,10 @@ 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 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
} }
selectdotfiles() { \
edition="$(dialog --title "Select LARBS version." --menu "Select which version of LARBS you wish to have as default:" 10 70 2 dwm "The version of LARBS using suckless's dwm." i3 "The classic version of LARBS using i3." custom "If you are supplying commandline options for LARBS." 3>&1 1>&2 2>&3 3>&1)" || error "User exited."
}
getuserandpass() { \ getuserandpass() { \
# Prompts user for new username an password. # 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
@ -151,16 +165,17 @@ finalize(){ \
installpkg dialog || error "Are you sure you're running this as the root user and have an internet connection?" installpkg dialog || error "Are you sure you're running this as the root user and have an internet connection?"
# Welcome user and pick dotfiles. # Welcome user and pick dotfiles.
welcomemsg || error "User exited from welcome." welcomemsg || error "User exited."
selectdotfiles || error "User exited."
# Get and verify username and password. # Get and verify username and password.
getuserandpass || error "User exited from pass." getuserandpass || error "User exited."
# Give warning if user already exists. # Give warning if user already exists.
usercheck || error "User exited from check." usercheck || error "User exited."
# Last chance for user to back out before install. # Last chance for user to back out before install.
preinstallmsg || error "User exited from preinstall." preinstallmsg || error "User exited."
### The rest of the script requires no user input. ### The rest of the script requires no user input.
@ -173,8 +188,12 @@ dialog --title "LARBS Installation" --infobox "Installing \`basedevel\` and \`gi
installpkg curl installpkg curl
installpkg base-devel installpkg base-devel
installpkg git installpkg git
installpkg ntp
dialog --title "LARBS Installation" --infobox "Synchronizing system time to ensure successful and secure installation of software..." 4 70 dialog --title "LARBS Installation" --infobox "Synchronizing system time to ensure successful and secure installation of software..." 4 70
ntp 0.us.pool.ntp.org >/dev/null 2>&1
[ "$distro" = arch ] && { \
[ -f /etc/sudoers.pacnew ] && cp /etc/sudoers.pacnew /etc/sudoers # Just in case [ -f /etc/sudoers.pacnew ] && cp /etc/sudoers.pacnew /etc/sudoers # Just in case
# Allow user to run sudo without password. Since AUR programs must be installed # Allow user to run sudo without password. Since AUR programs must be installed
@ -189,6 +208,7 @@ grep "ILoveCandy" /etc/pacman.conf >/dev/null || sed -i "/#VerbosePkgLists/a ILo
sed -i "s/-j2/-j$(nproc)/;s/^#MAKEFLAGS/MAKEFLAGS/" /etc/makepkg.conf sed -i "s/-j2/-j$(nproc)/;s/^#MAKEFLAGS/MAKEFLAGS/" /etc/makepkg.conf
manualinstall $aurhelper || error "Failed to install AUR helper." manualinstall $aurhelper || error "Failed to install AUR helper."
}
# The command that does all the installing. Reads the progs.csv file and # The command that does all the installing. Reads the progs.csv file and
# installs each needed program the way required. Be sure to run this only after # installs each needed program the way required. Be sure to run this only after
@ -212,6 +232,13 @@ sed -i "s/^$name:\(.*\):\/bin\/.*/$name:\1:\/bin\/zsh/" /etc/passwd
# dbus UUID must be generated for Artix runit. # dbus UUID must be generated for Artix runit.
dbus-uuidgen > /var/lib/dbus/machine-id dbus-uuidgen > /var/lib/dbus/machine-id
# Block Brave autoupdates just in case. (I don't know if these even exist on Linux, but whatever.)
grep -q "laptop-updates.brave.com" /etc/hosts || echo "0.0.0.0 laptop-updates.brave.com
0.0.0.0 go-updater.brave.com" >> /etc/hosts
# Let LARBS know the WM it's supposed to run.
echo "$edition" > "/home/$name/.local/share/larbs/wm"; chown -R "$name":wheel "/home/$name/.local"
# This line, overwriting the `newperms` command above will allow the user to run # This line, overwriting the `newperms` command above will allow the user to run
# serveral important commands, `shutdown`, `reboot`, updating, etc. without a password. # serveral important commands, `shutdown`, `reboot`, updating, etc. without a password.
[ "$distro" = arch ] && newperms "%wheel ALL=(ALL) ALL #LARBS [ "$distro" = arch ] && newperms "%wheel ALL=(ALL) ALL #LARBS

Loading…
Cancel
Save