From 9ada11c99fc4003dcf5ab5118e70dd4d7792ccdf Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 8 Apr 2018 16:23:34 -0500 Subject: [PATCH 1/2] Time zone select --- src/arch.sh | 7 +++++-- src/chroot.sh | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/arch.sh b/src/arch.sh index e9cc08e..b6538ad 100755 --- a/src/arch.sh +++ b/src/arch.sh @@ -12,10 +12,12 @@ NC='\033[0m' dialog --defaultno --title "DON'T BE A BRAINLET!" --yesno "This is an Arch install script that is very rough around the edges.\n\nOnly run this script if you're a big-brane who doesn't mind deleting your entire /dev/sda drive.\n\nThis script is only really for me so I can autoinstall Arch.\n\nt. Luke" 15 60 || exit -dialog --defaultno --title "DON'T BE A BRAINLET!" --yesno "Do you think I'm meming? Only select yes to DELET your entire /dev/sda and reinstall Arch.\n\nTo stop this script, press no." 10 60 || exit +dialog --defaultno --title "DON'T BE A BRAINLET!" --yesno "Do you think I'm meming? Only select yes to DELET your entire /dev/sda and reinstall Arch.\n\nTo stop this script, press no." 10 60 || exit dialog --no-cancel --inputbox "Enter a name for your computer." 10 60 2> comp +dialog --defaultno --title "Time Zone select" --yesno "Do you want use the default time zone(America/New_York)?.\n\nPress no for select your own time zone" 10 60 && echo "America/New_York" > tz.tmp || tzselect > tz.tmp + dialog --no-cancel --inputbox "Enter partitionsize in gb, separated by space (swap & root)." 10 60 2>psize IFS=' ' read -ra SIZE <<< $(cat psize) @@ -67,7 +69,8 @@ mount /dev/sda4 /mnt/home pacstrap /mnt base base-devel genfstab -U /mnt >> /mnt/etc/fstab - +cat tz.tmp > /mnt/tzfinal.tmp +rm tz.tmp curl https://raw.githubusercontent.com/LukeSmithxyz/LARBS/master/src/chroot.sh > /mnt/chroot.sh && arch-chroot /mnt bash chroot.sh && rm /mnt/chroot.sh cat comp > /mnt/etc/hostname && rm comp diff --git a/src/chroot.sh b/src/chroot.sh index efa3d12..cb86493 100755 --- a/src/chroot.sh +++ b/src/chroot.sh @@ -2,7 +2,9 @@ passwd -ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime +TZuser=$(cat tzfinal.tmp) + +ln -sf /usr/share/zoneinfo/$TZuser /etc/localtime hwclock --systohc From 07b5776f0b69c55cb32c287007b40f3273bb1aea Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Mon, 23 Apr 2018 15:06:45 -0700 Subject: [PATCH 2/2] Exit inside parentheses doesn't exit script Several error conditions were resulting in a message printed and "exit" being called, however expressions inside parentheses are executed in a subshell; consequently the *subshell* would exit but the parent shell continued running the script. https://stackoverflow.com/questions/19886797/exit-inside-parentheses-doesnt-exit-script --- src/arch.sh | 2 +- src/larbs.sh | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/arch.sh b/src/arch.sh index e9cc08e..c02834a 100755 --- a/src/arch.sh +++ b/src/arch.sh @@ -5,7 +5,7 @@ #DO NOT RUN THIS YOURSELF because Step 1 is it reformatting /dev/sda WITHOUT confirmation, #which means RIP in peace qq your data unless you've already backed up all of your drive. -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) +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' diff --git a/src/larbs.sh b/src/larbs.sh index 1243724..0d5b290 100755 --- a/src/larbs.sh +++ b/src/larbs.sh @@ -1,7 +1,6 @@ #!/bin/bash -pacman -S --noconfirm --needed dialog || (echo "Error at script start: Are you sure you're running this as the root user? Are you sure you're using an Arch-based distro? ;-) Are you sure you have an internet connection?" && exit) - +pacman -S --noconfirm --needed dialog || { echo "Error at script start: Are you sure you're running this as the root user? Are you sure you're using an Arch-based distro? ;-) Are you sure you have an internet connection?"; exit; } 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 name=$(dialog --no-cancel --inputbox "First, please enter a name for the user account." 10 60 3>&1 1>&2 2>&3 3>&1) @@ -36,7 +35,7 @@ choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) let="\(\|[a-z]\|$(echo $choices | sed -e "s/ /\\\|/g")\)" -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 can relax even more with your complete system.\n\nNow just press and the system will begin installation!" 13 60 || (clear && exit) +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 can relax even more with your complete system.\n\nNow just press and the system will begin installation!" 13 60 || { clear; exit; } clear