From 7249fc06e55e5e471efbb38be4585d4f9489b73f Mon Sep 17 00:00:00 2001 From: Luke Date: Mon, 2 Oct 2017 17:04:53 -0400 Subject: [PATCH] Error handling improvements --- root.sh | 7 ++++--- user.sh | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/root.sh b/root.sh index 3e8e0a7..fff3fcc 100755 --- a/root.sh +++ b/root.sh @@ -81,7 +81,7 @@ brow=(dialog --separate-output --checklist "Select a browser (none or multiple p options=(1 "qutebrowser" off # any option can be set to default to "on" 2 "Firefox" off #3 "Palemoon" off - #4 "Firefox" off + #4 "Waterfox" off ) browch=$("${brow[@]}" "${options[@]}" 2>&1 >/dev/tty) clear @@ -114,13 +114,14 @@ systemctl enable NetworkManager systemctl start NetworkManager printf "${BLUE}Downloading next portion of script...\n${NC}" -curl http://lukesmith.xyz/larbs/user.sh > /home/$USER/user.sh - +curl https://raw.githubusercontent.com/LukeSmithxyz/larbs/master/user.sh > /home/$USER/user.sh printf "${BLUE}Running script as new user $USER...\n${NC}" cp /etc/sudoers /etc/sudoers.prelarbs echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers sudo -u $USER bash /home/$USER/user.sh || (echo "Error in the user install script. This might be because of a problem in your internet connection or pacman keyring or in an AUR package." >> LARBS.log && error) +cat /home$USER/LARBS.log >> LARBS.log && rm /home/$USER/LARBS.log +rm /home/$USER/user.sh curl https://raw.githubusercontent.com/LukeSmithxyz/larbs/master/sudoers > /etc/sudoers diff --git a/user.sh b/user.sh index fdf5cbd..5cf84e8 100755 --- a/user.sh +++ b/user.sh @@ -5,6 +5,8 @@ NC='\033[0m' printf "${BLUE}Changing directory to /home/$USER...\n${NC}" cd /home/$USER +error() { dialog --title "Error!" --msgbox "We've run into a fatal-ish error. Check the LARBS.log file for more information" 10 60 && clear && exit ;} + printf "${BLUE}Activating Pulseaudio if not already active...\n${NC}" pulseaudio --start @@ -13,11 +15,11 @@ printf "${BLUE}Installing packer as an AUR manager...\n${NC}" aurinstall() { curl -O https://aur.archlinux.org/cgit/aur.git/snapshot/$1.tar.gz && tar -xvf $1.tar.gz && cd $1 && makepkg --noconfirm -si && cd .. && rm -rf $1 $1.tar.gz ;} -aurinstall packer || (echo "Error installing packer." && exit) +aurinstall packer || (echo "Error installing packer." >> LARBS.log && error) printf "${BLUE}Installing AUR programs...\n${NC}" printf "${BLUE}(May take some time.)\n${NC}" -packer --noconfirm -S i3-gaps vim-pathogen neofetch i3lock tamzen-font-git neomutt unclutter-xfixes-git urxvt-resize-font-git polybar-git python-pywal xfce-theme-blackbird || (echo "Error installing AUR packages. Check your internet connections and pacman keys." && exit) +packer --noconfirm -S i3-gaps vim-pathogen neofetch i3lock tamzen-font-git neomutt unclutter-xfixes-git urxvt-resize-font-git polybar-git python-pywal xfce-theme-blackbird || (echo "Error installing AUR packages. Check your internet connections and pacman keys." >> LARBS.log && error) #packer --noconfirm -S ncpamixer-git speedometer cli-visualizer choices=$(cat choices) for choice in $choices