huge function changes, cleaning up code, needs testing
This commit is contained in:
parent
6b10393671
commit
9382a3a081
3 changed files with 35 additions and 32 deletions
|
@ -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
|
||||
|
|
|
@ -16,7 +16,7 @@ options=(1 "LaTeX packages" off
|
|||
7 "transmission torrent client" off
|
||||
)
|
||||
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
|
||||
echo $choices > /home/$USER/choices
|
||||
echo $choices > /home/$USER/.choices
|
||||
clear
|
||||
|
||||
brow=(dialog --separate-output --checklist "Select a browser (none or multiple possible):" 22 76 16)
|
||||
|
@ -26,7 +26,7 @@ options=(1 "qutebrowser" off # any option can be set to default to "on"
|
|||
4 "Waterfox" off
|
||||
)
|
||||
browch=$("${brow[@]}" "${options[@]}" 2>&1 >/dev/tty)
|
||||
echo $browch > /home/$USER/browch
|
||||
echo $browch > /home/$USER/.browch
|
||||
clear
|
||||
|
||||
#If this is the first run, install all core programs.
|
||||
|
@ -92,22 +92,19 @@ do
|
|||
esac
|
||||
done
|
||||
|
||||
#Packages I may later add:
|
||||
#pacman --noconfirm --needed -S projectm-pulseaudio
|
||||
|
||||
if [[ -e .firstrun ]]
|
||||
then
|
||||
printf "${BLUE}Downloading next portion of script...\n${NC}"
|
||||
curl https://raw.githubusercontent.com/LukeSmithxyz/larbs/master/user.sh > /home/$USER/user.sh
|
||||
printf "${BLUE}Running script as new user $USER...\n${NC}"
|
||||
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
|
||||
blue Downloading next portion of the script \(user.sh\)...
|
||||
curl https://raw.githubusercontent.com/LukeSmithxyz/larbs/master/user.sh > /home/$USER/user.sh && blue Running user.sh script as $(whoami)...
|
||||
sudo -u $USER bash /home/$USER/user.sh || red Error when running user.sh...
|
||||
rm /home/$USER/user.sh
|
||||
else
|
||||
printf "${BLUE}Downloading next portion of script...\n${NC}"
|
||||
curl https://raw.githubusercontent.com/LukeSmithxyz/larbs/master/aur_packages.sh > /home/$USER/aur_packages.sh
|
||||
printf "${BLUE}Running script as new user $USER...\n${NC}"
|
||||
sudo -u $USER bash /home/$USER/aur_packages.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
|
||||
blue Downloading next portion of the script \(aur_packages.sh\)...
|
||||
curl https://raw.githubusercontent.com/LukeSmithxyz/larbs/master/aur_packages.sh > /home/$USER/aur_packages.sh && blue Running aur_packages as $(whoami)...
|
||||
sudo -u $USER bash /home/$USER/aur_packages.sh || red Error when running aur_packages...
|
||||
rm /home/$USER/aur_packages.sh
|
||||
fi
|
||||
|
||||
|
|
1
le.sh
Normal file
1
le.sh
Normal file
|
@ -0,0 +1 @@
|
|||
(cat asdf && echo asdfa) || dialog --title "Error found." --msgbox "Error installing $1." 5 50
|
Loading…
Reference in a new issue