huge function changes, cleaning up code, needs testing

This commit is contained in:
Luke
2017-10-05 17:36:14 -07:00
parent 6b10393671
commit 9382a3a081
3 changed files with 35 additions and 32 deletions

View File

@@ -1,44 +1,49 @@
#!/bin/bash
RED='\033[0;31m'
BLUE='\033[0;34m'
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 ;}
#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}Installing packer as an AUR manager...\n${NC}"
blue() { printf "\033[0;34m $* \033[0m\n" && (echo $* >> LARBS.log) ;}
red() { printf "\033[0;31m $* \033[0m\n" && (echo ERROR: $* >> LARBS.log) ;}
#Install an AUR package manually.
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 ;}
qm=$(pacman -Qm | awk '{print $1}')
#aurcheck runs on each of its arguments, if the argument is not already installed, it either uses packer to install it, or installs it manually.
aurcheck() {
qm=$(pacman -Qm | awk '{print $1}')
for arg in "$@"
do
if [[ $qm = *"$arg"* ]]; then
echo $arg is already installed.
else
else
echo $arg not installed
printf "${BLUE}\nNow installing $arg...\n${NC}"
aurinstall $arg && printf "${BLUE}\n$arg now installed.\n${NC}"
blue Now installing $arg...
if [[ -e /usr/bin/packer ]]
then
(packer --noconfirm -S $arg && printf "${BLUE}\n$arg now installed.\n${NC}") || red Error installing $arg.
else
(aurinstall $arg && printf "${BLUE}\n$arg now installed.\n${NC}") || red Error installing $arg.
fi
fi
done
}
aurcheck packer || (echo "Error installing packer." >> LARBS.log && error)
printf "${BLUE}Installing AUR programs...\n${NC}"
printf "${BLUE}(May take some time.)\n${NC}"
blue Changing directory to /home/$USER...
cd /home/$USER || red Could not cd to /home/$USER. Does user and home directory exist?
blue Installing AUR programs...
blue \(This may take some time.\)
#Add the needed gpg key for neomutt
gpg --recv-keys 5FAF0A6EE7371805
aurcheck 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)
aurcheck packer i3-gaps vim-pathogen neofetch tamzen-font-git neomutt unclutter-xfixes-git urxvt-resize-font-git polybar-git python-pywal xfce-theme-blackbird
#Also installing i3lock, since i3-gaps was only just now installed.
sudo pacman -S i3lock
#packer --noconfirm -S ncpamixer-git speedometer cli-visualizer
choices=$(cat choices)
choices=$(cat .choices)
for choice in $choices
do
case $choice in
@@ -57,7 +62,7 @@ do
;;
esac
done
browsers=$(cat browch)
browsers=$(cat .browch)
for choice in $browsers
do
case $choice in