LARBS/src/larbs.sh

94 lines
4.3 KiB
Bash
Raw Normal View History

2017-10-07 22:09:18 +00:00
#!/bin/bash
2017-10-09 07:03:33 +00:00
2018-03-03 05:07:00 +00:00
pacman -S --noconfirm --needed dialog || (echo "Error at script start: Are you sure you're running this as the root user? Are you sure you're using an Arch-based distro? ;-) Are you sure you have an internet connection?" && exit)
2017-10-07 22:09:18 +00:00
dialog --title "Welcome!" --msgbox "Welcome to Luke's Auto-Rice Bootstrapping Script!\n\nThis script will automatically install a fully-featured i3wm Arch Linux desktop, which I use as my main machine.\n\n-Luke" 10 60
2018-03-03 05:07:00 +00:00
name=$(dialog --no-cancel --inputbox "First, please enter a name for the user account." 10 60 3>&1 1>&2 2>&3 3>&1)
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)
2017-10-07 22:09:18 +00:00
2018-03-03 05:07:00 +00:00
while [ $pass1 != $pass2 ]
2017-10-07 22:09:18 +00:00
do
2018-03-03 05:07:00 +00:00
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)
unset pass2
2017-10-07 22:09:18 +00:00
done
2018-03-03 05:07:00 +00:00
dialog --infobox "Adding user \"$name\"..." 4 50
2018-03-03 07:21:16 +00:00
useradd -m -g wheel -s /bin/bash $name >/dev/tty6
echo "$name:$pass1" | chpasswd >/dev/tty6
2018-03-03 05:07:00 +00:00
cmd=(dialog --separate-output --nocancel --buildlist "Press <SPACE> to select the packages you want to install. LARBS will install all the packages you put in the right column.
2018-03-03 07:21:16 +00:00
Use \"^\" and \"\$\" to move to the left and right columns respectively. Press <ENTER> when done." 22 76 16)
2018-03-03 05:07:00 +00:00
options=(X "LaTeX packages" off
L "Libreoffice" off
G "GIMP" off
B "Blender" off
E "Emacs" off
F "Fonts for unicode and other languages" off
T "Transmission torrent client" off
D "Music visualizers and decoration" off
2018-03-11 01:06:15 +00:00
P "Pandoc and R/Rmarkdown" off
2017-10-07 22:09:18 +00:00
)
2018-03-03 07:21:16 +00:00
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
2018-03-03 05:07:00 +00:00
let="\(\|[a-z]\|$(echo $choices | sed -e "s/ /\\\|/g")\)"
2018-03-03 07:21:16 +00:00
dialog --title "Let's get this party started!" --msgbox "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 <OK> and the system will begin installation!" 13 60 || (clear && exit)
2018-03-03 05:07:00 +00:00
clear
2018-03-03 05:07:00 +00:00
dialog --infobox "Refreshing Arch Keyring..." 4 40
pacman --noconfirm -Sy archlinux-keyring >/dev/tty6
2017-10-07 22:09:18 +00:00
2018-03-03 05:07:00 +00:00
dialog --infobox "Getting program list..." 4 40
curl https://raw.githubusercontent.com/LukeSmithxyz/larbs/master/src/progs.csv > /tmp/progs.csv
rm /tmp/aur_queue &>/dev/tty6
count=$(cat /tmp/progs.csv | grep -G ",$let," | wc -l)
n=0
installProgram() { ( (pacman --noconfirm --needed -S $1 &>/dev/tty6 && echo $1 installed.) || echo $1 >> /tmp/aur_queue) || echo $1 >> /tmp/larbs_failed ;}
2017-10-09 17:03:56 +00:00
2018-03-03 05:07:00 +00:00
for x in $(cat /tmp/progs.csv | grep -G ",$let," | awk -F, {'print $1'})
2017-10-07 22:09:18 +00:00
do
2018-03-03 05:07:00 +00:00
n=$((n+1))
2018-03-03 07:21:16 +00:00
dialog --title "LARBS Installation" --infobox "Downloading and installing program $n out of $count: $x...\n\nThe first programs will take more time due to dependencies. You can watch the output on tty6." 8 70
2018-03-03 05:07:00 +00:00
installProgram $x >/dev/tty6
2017-10-07 22:09:18 +00:00
done
2018-03-03 05:07:00 +00:00
dialog --infobox "Preparing the user script..." 4 40
curl https://raw.githubusercontent.com/LukeSmithxyz/larbs/master/src/sudoers_tmp > /etc/sudoers
2017-10-08 23:53:40 +00:00
cd /tmp
2018-03-03 05:21:25 +00:00
if [ $1 = "devel" ]
then curl https://raw.githubusercontent.com/LukeSmithxyz/larbs/devel/src/larbs_user.sh > /tmp/larbs_user.sh;
else curl https://raw.githubusercontent.com/LukeSmithxyz/larbs/master/src/larbs_user.sh > /tmp/larbs_user.sh;
fi
2018-03-03 05:07:00 +00:00
sudo -u $name bash /tmp/larbs_user.sh
2017-10-08 23:53:40 +00:00
rm -f /tmp/larbs_user.sh
2017-10-07 22:09:18 +00:00
2018-03-03 05:07:00 +00:00
dialog --infobox "Installing \"st\" from source..." 4 40
2018-01-22 17:30:07 +00:00
cd /tmp
2018-03-11 05:41:37 +00:00
rm -rf st
2018-03-11 05:36:39 +00:00
git clone https://github.com/lukesmithxyz/st.git
2018-01-22 17:30:07 +00:00
cd st
2018-03-11 05:36:39 +00:00
make
make install
2018-01-22 17:30:07 +00:00
cd /tmp
2017-10-09 00:13:16 +00:00
2018-03-11 01:06:15 +00:00
# R markdown install.
2018-03-03 05:07:00 +00:00
dialog --infobox "Enabling Network Manager..." 4 40
2017-10-07 22:09:18 +00:00
systemctl enable NetworkManager
systemctl start NetworkManager
2018-03-03 05:07:00 +00:00
dialog --infobox "Getting rid of that retarded error beep sound..." 10 50
2017-10-09 21:08:59 +00:00
rmmod pcspkr
echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf
2017-10-07 22:09:18 +00:00
2018-03-03 05:07:00 +00:00
dialog --infobox "Updating sudoers file..." 4 40
curl https://raw.githubusercontent.com/LukeSmithxyz/larbs/master/src/sudoers > /etc/sudoers
2017-10-07 22:09:18 +00:00
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
clear