From 0d50d2f5e1680c8b4e6f47ab9caa5d6647c29bfd Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 7 Oct 2017 15:09:18 -0700 Subject: [PATCH] new scripts --- .user.sh.swp | Bin 12288 -> 0 bytes larbs.sh | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++ larbs_user.sh | 89 +++++++++++++++++++++++++++++++++++++ new_user.sh | 21 +++++++++ pacaur.tar.gz | Bin 0 -> 1012 bytes user.sh | 6 +-- 6 files changed, 234 insertions(+), 3 deletions(-) delete mode 100644 .user.sh.swp create mode 100755 larbs.sh create mode 100755 larbs_user.sh create mode 100755 new_user.sh create mode 100644 pacaur.tar.gz diff --git a/.user.sh.swp b/.user.sh.swp deleted file mode 100644 index de9a16784b581594efb43e0e7783c2102979044e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2-)a;w6vk7lUfC*E?@za-w8BodZiUifp=vFPQrWtKSdh$2b|*NSj7g?-73+%g!!n!a9m<+_U^Z*qvzib z73Ubs%NH^{K5pbv#>eG^_;x7BTe2{YZ^_sxFL^F(?0D&FOMJR^|5P_2uD1E0s zKf;>VXRDw3L~R_#F1Jr!hjtJFB0vO)01+SpM1Tko0U~f}3HV}&y+ikBb~?DaGY=h_ zca}5}0U|&IhyW2F0z`la5CI}U1c(3;AOfe5fJhnpeu1(3BWND~|KI)o|9O$IAE+;= zHtI2I33UZEhB}KHMtvP+>?7&}Y87<@HHR8Qea4!fPz5T~A4bt20z`la5CI}U1c(3; zAOb{y2>eF^Mc-#e!#0l+qdTh0*AuG>@3_m1^-1YnRPqF~4N zK$P~m($0%K4;QyxnHuyA^#p23X>+KrRaVjIp1mme8{GH)eRnVsa2_gJ!!O4&cT$w8 zGElGM%WTzCbrg^GLsE-4muaw8g_aYqHV3D4AWL;X8xJD4QlxzlAxT#4B> LARBS.log) ;} +red() { printf "\033[0;31m $* \033[0m\n" && (chmod 777 LARBS.log && echo ERROR: $* >> LARBS.log) ;} + +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 + +dialog --no-cancel --passwordbox "Enter a password for that user." 10 60 2> pass1 +dialog --no-cancel --passwordbox "Reype password." 10 60 2> pass2 + +while [ $(cat pass1) != $(cat pass2) ] +do + dialog --no-cancel --passwordbox "Passwords do not match.\n\nEnter password again." 10 60 2> pass1 + dialog --no-cancel --passwordbox "Reype password." 10 60 2> pass2 +done + +NAME=$(cat name) +useradd -m -g wheel -s /bin/bash $NAME + +echo "$NAME:$(cat pass1)" | chpasswd +#I shred the password for safety's sake. +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) +#rm -f /home/$NAME/.choices #Needed if write protected from root script. +echo $choices > /home/$NAME/.choices && chmod 777 /home/$NAME/.choices + +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) +#rm -f /home/$NAME/.browch #Needed if write protected from root script. +echo $browch > /home/$NAME/.browch &&chmod 777 /home/$NAME/.browch + +#If this is the first run, install all core programs. +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 + +blue Now installing main programs... + +sudo 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 || (red Error installing basic packages. Check your internet connection and pacman keyring.) + +for choice in $choices +do + case $choice in + 1) + blue Now installing LaTeX packages... + sudo pacman --noconfirm --needed -S texlive-most texlive-lang biber + ;; + 2) + blue Now installing LibreOffice Suite... + sudo pacman --noconfirm --needed -S libreoffice-fresh + ;; + 3) + blue Now installing GIMP... + sudo pacman --noconfirm --needed -S gimp + ;; + 4) + blue Now installing Blender... + sudo pacman --noconfirm --needed -S blender + ;; + 5) + blue Now installing Emacs... + sudo pacman --noconfirm --needed -S emacs + ;; + 6) + blue Now installing extra fonts... + sudo pacman --noconfirm --needed -S noto-fonts-cjk noto-fonts-emoji + ;; + 7) + blue Now installing transmission... + sudo pacman --noconfirm --needed -S transmission-cli + esac +done + +for choice in $browch +do + case $choice in + 1) + blue Now installing qutebrowser... + sudo pacman --noconfirm --needed -S qutebrowser gst-libav gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly + ;; + 2) + blue Now installing Firefox... + sudo pacman --noconfirm --needed -S firefox + ;; + esac +done + +#Packages I may later add: +#pacman --noconfirm --needed -S projectm-pulseaudio + +blue Downloading next portion of the script \(user.sh\)... +curl https://raw.githubusercontent.com/LukeSmithxyz/larbs/master/user.sh > /home/$NAME/user.sh && blue Running user.sh script as $NAME... +sudo -u $NAME bash /home/$NAME/user.sh || red Error when running user.sh... +rm -f /home/$NAME/user.sh + +printf "${BLUE}Enabling Network Manager...\n${NC}" +systemctl enable NetworkManager +systemctl start NetworkManager + + +curl https://raw.githubusercontent.com/LukeSmithxyz/larbs/master/sudoers > /etc/sudoers + +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 diff --git a/larbs_user.sh b/larbs_user.sh new file mode 100755 index 0000000..4a11f5a --- /dev/null +++ b/larbs_user.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +blue() { printf "\033[0;34m $* \033[0m\n" && (echo $* >> LARBS.log) ;} +red() { printf "\033[0;31m $* \033[0m\n" && (echo ERROR: $* >> LARBS.log) ;} + +NAME=$(cat .firstrun) +blue Changing directory to /home/$NAME... + +cd /home/$NAME + +blue Activating Pulseaudio if not already active... +pulseaudio --start && blue Pulseaudio enabled... + +#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 ;} + +#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 + echo $arg not installed + blue Now installing $arg... + if [[ -e /usr/bin/packer ]] + then + (packer --noconfirm -S $arg && blue $arg now installed) || red Error installing $arg. + else + (aurinstall $arg && blue $arg now installed) || red Error installing $arg. + fi + +fi +done +} + +blue Changing directory to /home/$NAME... +cd /home/$NAME || red Could not cd to /home/$NAME. Does user and home directory exist? + +blue Installing AUR programs... +blue \(This may take some time.\) + +gpg --recv-keys 5FAF0A6EE7371805 #Add the needed gpg key for neomutt + +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 || red Error with basic AUR installations... +#Also installing i3lock, since i3-gaps was only just now installed. +sudo pacman -S --noconfirm --needed i3lock + +#packer --noconfirm -S ncpamixer-git speedometer cli-visualizer + +choices=$(cat .choices) +rm .choices +for choice in $choices +do + case $choice in + 1) + aurcheck vim-live-latex-preview + git clone https://github.com/lukesmithxyz/latex-templates.git && mkdir -p /home/$NAME/Documents/LaTeX && rsync -va latex-templates /home/$NAME/Documents/LaTeX && rm -rf latex-templates + ;; + 6) + aurcheck ttf-ancient-fonts + ;; + 7) + aurcheck transmission-remote-cli-git + ;; + esac +done + +browsers=$(cat .browch) +rm .browch +for choice in $browsers +do + case $choice in + 3) + gpg --recv-keys 865E6C87C65285EC + aurcheck palemoon-bin + ;; + 4) + aurcheck waterfox-bin + ;; + esac +done + +blue Downloading config files... +git clone https://github.com/lukesmithxyz/voidrice.git && rsync -va voidrice/ /home/$NAME && rm -rf voidrice + +blue Generating bash/ranger/qutebrowser shortcuts... +python ~/.config/Scripts/shortcuts.py diff --git a/new_user.sh b/new_user.sh new file mode 100755 index 0000000..bb33d52 --- /dev/null +++ b/new_user.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +blue() { printf "\033[0;34m $* \033[0m\n" && (echo $* >> LARBS.log) ;} +red() { printf "\033[0;31m $* \033[0m\n" && (echo ERROR: $* >> LARBS.log) ;} + +USER=$(cat .firstrun) +blue Changing directory to /home/$USER... + +cd /home/$USER + +blue Activating Pulseaudio if not already active... +pulseaudio --start && blue Pulseaudio enabled... + +curl -O http://lukesmith.xyz/larbs/aur_install.sh && bash aur_install.sh +rm aur_install.sh + +blue Downloading config files... +git clone https://github.com/lukesmithxyz/voidrice.git && rsync -va voidrice/ /home/$USER && rm -rf voidrice + +blue Generating bash/ranger/qutebrowser shortcuts... +python ~/.config/Scripts/shortcuts.py diff --git a/pacaur.tar.gz b/pacaur.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..e9d383f9e714bdaff3a650a22578726d7144f653 GIT binary patch literal 1012 zcmVBTQ|YC9R~6+`(z2C3um?s&)NuEZZ7*-oSQj8|0SbTHe|G1hG6rB}&Y}CC~HnklwNN-NXG);0_SU)0AbU zPX;a<42dJoid~^TvuP5=*_J3z@{fCadTYuYe;J%zBnjL)W^Wp2sleXU@5(d*ORC$3-O(4&f_ww0t3E0CQmW{ql$&O@{c)*Kow_yDZL~nENh~> znU0lSiWiKsf@M_H0W+Q`z0Etx|73hyz@EV7wm?)g-+qTMlwN?zqAF_jl9*3)-UVWk zJPYHw(i3^b342lSW*vL{fthUv47gdwdtSO@Sa@$JevZx?X2Vz$ z8U`>1YFpg_RO{{l!j|3e{#kZ|LQ8M|;$UQNx-_i`{-#Y-$8Z&#w-g6Q$0!aym7t0f zdhr&0R1knrq^>;Zon^IIDRMeUafWogD#H;Bf;E}->p3I|Qthh`&56(*&MKU!u+S7# zeYhG!snp*ZLp5|Aipika`)hA#V=06kPo-59PbxDHsYow<`#{qwBLH2FymeoBzD#6Vl&OT$@bKUh}p6Rda zddRMbFlQ!wBqJT}M3Jz%0On>Y_8zI;V{8;Rm3W=~S46oKktyPm>0yRU-{dDpI6D!r$RG34H1B2)z!5W2! zX-sHgtc6^QDlIOx-?5ejT9#-9Jf+4fO)NB#XoAD@V}i>#(@L%_quKcW)AtDek*rdG z@LV~;3G|)VydBT(Ce!KFyUEm4H+#iAOv^f-IVb^(k)FTYPM6;_Zw=BsV>R!;_Qy#= iLPA19LPA19LPA19LPA19LPA2~U*m7_tlQB5C;$Ktw)@fm literal 0 HcmV?d00001 diff --git a/user.sh b/user.sh index d64bfff..bb33d52 100755 --- a/user.sh +++ b/user.sh @@ -1,7 +1,7 @@ #!/bin/bash -blue() { printf "\033[0;34m $* \033[0m\n" && (sudo echo $* >> LARBS.log) ;} -red() { printf "\033[0;31m $* \033[0m\n" && (sudo echo ERROR: $* >> LARBS.log) ;} +blue() { printf "\033[0;34m $* \033[0m\n" && (echo $* >> LARBS.log) ;} +red() { printf "\033[0;31m $* \033[0m\n" && (echo ERROR: $* >> LARBS.log) ;} USER=$(cat .firstrun) blue Changing directory to /home/$USER... @@ -11,7 +11,7 @@ cd /home/$USER blue Activating Pulseaudio if not already active... pulseaudio --start && blue Pulseaudio enabled... -sudo sh -c "curl -O http://lukesmith.xyz/larbs/aur_install.sh && bash aur_install.sh" +curl -O http://lukesmith.xyz/larbs/aur_install.sh && bash aur_install.sh rm aur_install.sh blue Downloading config files...