From 1076254393ccf087781be6bfcdbce140ef22f5c6 Mon Sep 17 00:00:00 2001 From: Thomas Cole Date: Wed, 30 Jun 2021 15:17:42 -0400 Subject: [PATCH] refactor --- archinstall.sh | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/archinstall.sh b/archinstall.sh index c8bfcde..adc70f5 100755 --- a/archinstall.sh +++ b/archinstall.sh @@ -68,7 +68,6 @@ partition () { echoc " - Formatting disk..." $GREEN - #DANGER ZONE parted --script $DISK -- mklabel gpt mkpart ESP fat32 1Mib 500MiB set 1 boot on mkpart primary ext4 500MiB 100% @@ -85,11 +84,12 @@ partition () { mkdir /mnt/boot mount ${DISK}1 /mnt/boot + return 1 } sysinstall () { - echoc " - Updating mirror list. This might take a while." $YELLOW - #reflector --protocol https --sort rate --country 'United States' --save /etc/pacman.d/mirrorlist --verbose + echoc " - Updating mirror list. This might take a while." $GREEN + reflector --protocol https --sort rate --country 'United States' --save /etc/pacman.d/mirrorlist --verbose echoc " - Installing system." $GREEN pacstrap /mnt base linux linux-firmware nano @@ -106,11 +106,16 @@ sysinstall () { echoc " - Setting Hostname." $GREEN echo "$HOSTNAME" > /mnt/etc/HOSTNAME - arch-chroot /mnt useradd -mU -s /bin/bash -G wheel,uucp,video,audio,storage,games,input $USER + echoc " - Setting shell." $GREEN arch-chroot /mnt chsh -s /bin/bash + echoc " - Adding Users." $GREEN + arch-chroot /mnt useradd -mU -s /bin/bash -G wheel,uucp,video,audio,storage,games,input $USER + echo "$USER:$PASSWD" | chpasswd -e --root /mnt echo "root:$ROOTPASSWD" | chpasswd -e --root /mnt + + return 1 } ###################################################################################### @@ -123,11 +128,28 @@ fi echo "AALI - 1.0" +#run each step and check output for completion prechecks if [ $? -eq 1 ]; then echo "Prechecks passed!" partition - sysinstall else echoc "Prechecks failed!" $RED + return -1 +fi + +#partition good +if [ $? -eq 1 ]; then + echo "Partitioning complete!" + sysinstall +else + echoc "Partitioning failed." $RED + return -1 +fi + +#sysinstall good +if [ $? -eq 1 ]; then + echo "Base system installation complete!" +else + echoc "System installation failed!" $RED fi \ No newline at end of file