--msgbox "Welcome!\\n\\nThis script will automatically install a fully-featured Linux desktop with DWM and my dotfiles."1060
whiptail --title "Important Note!" --yes-button "All ready!"\
--no-button "Return..."\
--yesno "Be sure the computer you are using has current pacman updates and refreshed Arch keyrings.\\n\\nIf it does not, the installation of some programs might fail."870
}
getuserandpass(){
# Prompts user for new username an password.
name=$(whiptail --inputbox "First, please enter a name for the user account."1060 3>&1 1>&2 2>&3 3>&1)||exit1
while ! echo"$name"| grep -q "^[a-z_][a-z0-9_-]*$";do
name=$(whiptail --nocancel --inputbox "Username not valid. Give a username beginning with a letter, with only lowercase letters, - or _."1060 3>&1 1>&2 2>&3 3>&1)
done
pass1=$(whiptail --nocancel --passwordbox "Enter a password for that user."1060 3>&1 1>&2 2>&3 3>&1)
--yesno "The user \`$name\` already exists on this system. LARBS can install for a user already existing, but it will OVERWRITE any conflicting settings/dotfiles on the user account.\\n\\nLARBS will NOT 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."1470
}
preinstallmsg(){
whiptail --title "Let's get this party started!" --yes-button "Let's go!"\
--no-button "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!"1360||{
--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 (it will start automatically in tty1).\\n\\n.t Luke"1380
}
### THE ACTUAL SCRIPT ###
### This is how everything happens in an intuitive format and order.
# Check if user is root on Arch distro. Install whiptail.
pacman --noconfirm --needed -Sy libnewt ||
error "Are you sure you're running this as the root user, are on an Arch-based distribution and have an internet connection?"
# Welcome user and pick dotfiles.
welcomemsg || error "User exited."
# Get and verify username and password.
getuserandpass || error "User exited."
# Give warning if user already exists.
usercheck || error "User exited."
# Last chance for user to back out before install.
preinstallmsg || error "User exited."
### The rest of the script requires no user input.
# Refresh Arch keyrings.
refreshkeys ||
error "Error automatically refreshing Arch keyring. Consider doing so manually."
for x in curl ca-certificates base-devel git ntp zsh;do
whiptail --title "LARBS Installation"\
--infobox "Installing \`$x\` which is required to install and configure other programs."870
installpkg "$x"
done
whiptail --title "LARBS Installation"\
--infobox "Synchronizing system time to ensure successful and secure installation of software..."870