From aec12895da6c5be1055f92c692ff390dcf715aed Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 5 Oct 2017 11:28:56 -0700 Subject: [PATCH] modularity added, reusable install pacakages --- README.md | 20 +++----- aur_pacakges.sh | 72 ++++++++++++++++++++++++++++ install_packages.sh | 114 ++++++++++++++++++++++++++++++++++++++++++++ root.sh | 99 ++------------------------------------ user.sh | 67 +------------------------- 5 files changed, 197 insertions(+), 175 deletions(-) create mode 100755 aur_pacakges.sh create mode 100755 install_packages.sh diff --git a/README.md b/README.md index 9be0729..da4e136 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ All the core stuff we be installed without prompt, but you'll have the option to ### Installing Arch Automatically -You can use these scripts to install Arch automatically just by plugging in and booting into a Arch live usb, then by running the following commands (provided you have stable internet connection): +You can use these scripts to install Arch automatically just by plugging in and booting into a Arch live USB, then by running the following commands (provided you have stable internet connection): ``` -curl -O http://lukesmith.xyz/larbs/arch.sh -bash arch.sh +curl -O http://lukesmith.xyz/larbs/arch.sh #Downloads the script. +bash arch.sh #Runs it. ``` After the system installs, you'll have the option of bootstrapping automatically into installing my configs as well. @@ -25,10 +25,10 @@ This is just as easy. Log in as the root user and run the following. ``` curl -O http://lukesmith.xyz/larbs/root.sh #Downloads the script. -bash root.sh #To run it. +bash root.sh #Runs it. ``` -After prompting you for some settings and some package choices, the system will install my full i3-gaps tiling window manager Desktop Environment. If you don't know what that means, don't worry, because I've gone to great lengths to write readable instructions about how to go pro super quick with this system. +After prompting you for some settings and some package choices, the system will install my full i3-gaps tiling window manager Desktop Environment. If you don't know what that means, don't worry, because I've gone to great lengths to write readable instructions about how to go PRO super quick with this system. Finally, it will use `git` to download my [Voidrice](https://github.com/lukesmithxyz/voidrice) dotfiles and will plop them in their proper location for instant use! @@ -72,15 +72,7 @@ Some computers might require some additional drivers to run a graphical environm ### I have some other problem and it didn't install correctly. -In normal circumstances, there are two main causes of misinstalls: faulty internet connections and errors with particular package upgrades or with the pacman keyring. - -Check yourself if the former may be at fault, but feel free to inform me in the latter case; I may be able to provide a quick fix. - -Regardless, it's generally safe to rerun the script if something temporary went wrong, although you may want to delete the user created before rerunning: - -``` -userdel USER -``` +In normal circumstances, there are two main causes of misinstalls: faulty internet connections and errors with particular package upgrades or with the pacman keyring. Check yourself if the former may be at fault, but feel free to inform me in the latter case; I may be able to provide a quick fix. ### >still using systemd botnet distro and/or not a 100% free-as-in-freedumb Parabola GANOO slash Linocks diff --git a/aur_pacakges.sh b/aur_pacakges.sh new file mode 100755 index 0000000..6dcf790 --- /dev/null +++ b/aur_pacakges.sh @@ -0,0 +1,72 @@ +#!/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 && clear && exit ;} + +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 ;} + +qm=$(pacman -Qm | awk '{print $1}') + +aurcheck() { +for arg in "$@" +do +if [[ $qm = *"$arg"* ]]; then + echo $arg is already installed. +else + echo $arg not installed + printf "${BLUE}\nNow installing $arg...\n${NC}" + aurinstall $arg && printf "${BLUE}\n$arg now installed.\n${NC}" +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}" + +#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 && error) + +#packer --noconfirm -S ncpamixer-git speedometer cli-visualizer + +choices=$(cat choices) +for choice in $choices +do + case $choice in + 1) + printf "\n${BLUE}Now installing LaTeX packages...\n${NC}" + aurcheck vim-live-latex-preview + git clone https://github.com/lukesmithxyz/latex-templates.git && mkdir -p /home/$USER/Documents/LaTeX && rsync -va latex-templates /home/$USER/Documents/LaTeX && rm -rf latex-templates + ;; + 6) + printf "\n${BLUE}Now installing extra fonts...\n${NC}" + aurcheck ttf-ancient-fonts + ;; + 7) + printf "\n${BLUE}Now installing transmission-remote-cli...\n${NC}" + aurcheck transmission-remote-cli-git + ;; + esac +done +browsers=$(cat browch) +for choice in $browsers +do + case $choice in + 3) + printf "\n${BLUE}Now installing Palemoon...\n${NC}" + aurcheck palemoon-bin + ;; + 4) + printf "\n${BLUE}Now installing Waterfox...\n${NC}" + aurcheck waterfox-bin + ;; + esac +done diff --git a/install_packages.sh b/install_packages.sh new file mode 100755 index 0000000..89103d0 --- /dev/null +++ b/install_packages.sh @@ -0,0 +1,114 @@ +#!/bin/bash +pacman -S --noconfirm dialog || (echo "Error at script start: Are you sure you're running this as the root user? Are you sure you have an internet connection?" && exit) +RED='\033[0;31m' +BLUE='\033[0;34m' +NC='\033[0m' + +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 ;} + +cmd=(dialog --separate-output --checklist "Select additional packages to install with :" 22 76 16) +options=(1 "LaTeX packages" off + 2 "Libreoffice Suite" off + 3 "GIMP" off + 4 "Blender" off + 5 "Emacs" off + 6 "Fonts for unicode and other languages" off + 7 "transmission torrent client" off + ) +choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) +echo $choices > /home/$USER/choices +clear + +brow=(dialog --separate-output --checklist "Select a browser (none or multiple possible):" 22 76 16) +options=(1 "qutebrowser" off # any option can be set to default to "on" + 2 "Firefox" off + 3 "Palemoon" off + 4 "Waterfox" off + ) +browch=$("${brow[@]}" "${options[@]}" 2>&1 >/dev/tty) +echo $browch > /home/$USER/browch +clear + +#If this is the first run, install all core programs. +if [[ -e .firstrun ]] +then + 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'll can relax even more with your complete system.\n\nNow just press and the system will begin installation!" 13 60 + printf "\n${BLUE}Now installing main programs.\n${NC}" + pacman --noconfirm --needed -S base-devel xorg-xinit xorg-server rxvt-unicode feh ffmpeg pulseaudio pulseaudio-alsa arandr pavucontrol pamixer mpv wget rofi vim w3m ranger mediainfo poppler highlight tmux calcurse htop newsbeuter mpd mpc ncmpcpp network-manager-applet networkmanager imagemagick atool libcaca compton transset-df markdown mupdf evince rsync git youtube-dl youtube-viewer cups screenfetch scrot unzip unrar ntfs-3g offlineimap msmtp notmuch notmuch-mutt dosfstools fzf r pandoc || (echo "Error installing basic packages. Check your internet connection and pacman keyring." >> LARBS.log && error) +fi + +for choice in $choices +do + case $choice in + 1) + printf "\n${BLUE}Now installing LaTeX packages...\n${NC}" + pacman --noconfirm --needed -S texlive-most texlive-lang biber + ;; + 2) + printf "\n${BLUE}Now installing Libreoffice suite...\n${NC}" + pacman --noconfirm --needed -S libreoffice-fresh + ;; + 3) + printf "\n${BLUE}Now installing GIMP...\n${NC}" + pacman --noconfirm --needed -S gimp + ;; + 4) + printf "\n${BLUE}Now installing Blender...\n${NC}" + pacman --noconfirm --needed -S blender + ;; + 5) + printf "\n${BLUE}Now installing Emacs...\n${NC}" + pacman --noconfirm --needed -S emacs + ;; + 6) + printf "\n${BLUE}Now installing extra fonts...\n${NC}" + pacman --noconfirm --needed -S noto-fonts-cjk noto-fonts-emoji + ;; + 7) + printf "\n${BLUE}Now installing transmission...\n${NC}" + pacman --noconfirm --needed -S transmission-cli + esac +done + +for choice in $browch +do + case $choice in + 1) + printf "\n${BLUE}Now installing qutebrowser...\n${NC}" + pacman --noconfirm --needed -S qutebrowser gst-libav gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly + ;; + 2) + printf "\n${BLUE}Now installing Firefox...\n${NC}" + pacman --noconfirm --needed -S firefox + ;; + 3) + printf "\n${BLUE}Now installing Palemoon...\n${NC}" + pacman --noconfirm --needed -S palemoon-bin + ;; + 4) + printf "\n${BLUE}Now installing Waterfox...\n${NC}" + pacman --noconfirm --needed -S waterfox-bin + ;; + esac +done + +#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 + 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 + rm /home/$USER/aur_packages.sh +fi + +clear diff --git a/root.sh b/root.sh index b2ce08c..3222d08 100755 --- a/root.sh +++ b/root.sh @@ -9,7 +9,6 @@ error() { dialog --title "Error!" --msgbox "We've run into a fatal-ish error. Ch 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 dialog --no-cancel --inputbox "First, please enter a name for the user account." 10 60 2> name -clear dialog --no-cancel --passwordbox "Enter a password for that user." 10 60 2> pass1 dialog --no-cancel --passwordbox "Reype password." 10 60 2> pass2 @@ -28,106 +27,14 @@ echo "$USER:$(cat pass1)" | chpasswd shred -u pass1 shred -u pass2 -cmd=(dialog --separate-output --checklist "Select additional packages to install with :" 22 76 16) -options=(1 "LaTeX packages" off - 2 "Libreoffice Suite" off - 3 "GIMP" off - 4 "Blender" off - 5 "Emacs" off - 6 "Fonts for unicode and other languages" off - 7 "transmission torrent client" off - ) -choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) -echo $choices > /home/$USER/choices -clear - -brow=(dialog --separate-output --checklist "Select a browser (none or multiple possible):" 22 76 16) -options=(1 "qutebrowser" off # any option can be set to default to "on" - 2 "Firefox" off - 3 "Palemoon" off - 4 "Waterfox" off - ) -browch=$("${brow[@]}" "${options[@]}" 2>&1 >/dev/tty) -echo $browch > /home/$USER/browch -clear - -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'll can relax even more with your complete system.\n\nNow just press and the system will begin installation!" 13 60 - - -printf "\n${BLUE}Now installing main programs.\n${NC}" - -pacman --noconfirm --needed -S base-devel xorg-xinit xorg-server rxvt-unicode feh ffmpeg pulseaudio pulseaudio-alsa arandr pavucontrol pamixer mpv wget rofi vim w3m ranger mediainfo poppler highlight tmux calcurse htop newsbeuter mpd mpc ncmpcpp network-manager-applet networkmanager imagemagick atool libcaca compton transset-df markdown mupdf evince rsync git youtube-dl youtube-viewer cups screenfetch scrot unzip unrar ntfs-3g offlineimap msmtp notmuch notmuch-mutt dosfstools fzf r pandoc || (echo "Error installing basic packages. Check your internet connection and pacman keyring." >> LARBS.log && error) - -for choice in $choices -do - case $choice in - 1) - printf "\n${BLUE}Now installing LaTeX packages...\n${NC}" - pacman --noconfirm --needed -S texlive-most texlive-lang biber - ;; - 2) - printf "\n${BLUE}Now installing Libreoffice suite...\n${NC}" - pacman --noconfirm --needed -S libreoffice-fresh - ;; - 3) - printf "\n${BLUE}Now installing GIMP...\n${NC}" - pacman --noconfirm --needed -S gimp - ;; - 4) - printf "\n${BLUE}Now installing Blender...\n${NC}" - pacman --noconfirm --needed -S blender - ;; - 5) - printf "\n${BLUE}Now installing Emacs...\n${NC}" - pacman --noconfirm --needed -S emacs - ;; - 6) - printf "\n${BLUE}Now installing extra fonts...\n${NC}" - pacman --noconfirm --needed -S noto-fonts-cjk noto-fonts-emoji - ;; - 7) - printf "\n${BLUE}Now installing transmission...\n${NC}" - pacman --noconfirm --needed -S transmission-cli - esac -done - -for choice in $browch -do - case $choice in - 1) - printf "\n${BLUE}Now installing qutebrowser...\n${NC}" - pacman --noconfirm --needed -S qutebrowser gst-libav gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly - ;; - 2) - printf "\n${BLUE}Now installing Firefox...\n${NC}" - pacman --noconfirm --needed -S firefox - ;; - 3) - printf "\n${BLUE}Now installing Palemoon...\n${NC}" - pacman --noconfirm --needed -S palemoon-bin - ;; - 4) - printf "\n${BLUE}Now installing Waterfox...\n${NC}" - pacman --noconfirm --needed -S waterfox-bin - ;; - esac -done - -#pacman --noconfirm --needed -S projectm-pulseaudio +touch .firstime +curl -O http://lukesmith.xuz/larbs/install_packages.sh && bash install_packages.sh +rm .firstime printf "${BLUE}Enabling Network Manager...\n${NC}" systemctl enable NetworkManager systemctl start NetworkManager -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}" -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 b746b85..491848f 100755 --- a/user.sh +++ b/user.sh @@ -10,71 +10,8 @@ error() { dialog --title "Error!" --msgbox "We've run into a fatal-ish error. Ch printf "${BLUE}Activating Pulseaudio if not already active...\n${NC}" pulseaudio --start - -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 ;} - -qm=$(pacman -Qm | awk '{print $1}') - -aurcheck() { -for arg in "$@" -do -if [[ $qm = *"$arg"* ]]; then - echo $arg is already installed. -else - echo $arg not installed - printf "${BLUE}\nNow installing $arg...\n${NC}" - aurinstall $arg && printf "${BLUE}\n$arg now installed.\n${NC}" -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}" - -#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 && error) - -#packer --noconfirm -S ncpamixer-git speedometer cli-visualizer - -choices=$(cat choices) -for choice in $choices -do - case $choice in - 1) - printf "\n${BLUE}Now installing LaTeX packages...\n${NC}" - aurcheck vim-live-latex-preview - git clone https://github.com/lukesmithxyz/latex-templates.git && mkdir -p /home/$USER/Documents/LaTeX && rsync -va latex-templates /home/$USER/Documents/LaTeX && rm -rf latex-templates - ;; - 6) - printf "\n${BLUE}Now installing extra fonts...\n${NC}" - aurcheck ttf-ancient-fonts - ;; - 7) - printf "\n${BLUE}Now installing transmission-remote-cli...\n${NC}" - aurcheck transmission-remote-cli-git - ;; - esac -done -browsers=$(cat browch) -for choice in $browsers -do - case $choice in - 3) - printf "\n${BLUE}Now installing Palemoon...\n${NC}" - aurcheck palemoon-bin - ;; - 4) - printf "\n${BLUE}Now installing Waterfox...\n${NC}" - aurcheck waterfox-bin - ;; - esac -done - +curl -O http://lukesmith.xyz/aur_install.sh && bash aur_install.sh +rm aur_install.sh printf "${BLUE}Downloading config files...\n${NC}" git clone https://github.com/lukesmithxyz/voidrice.git && rsync -va voidrice/ /home/$USER && rm -rf voidrice