From 1f84d41940a60f233c95c8387f7ccc0e014a50e9 Mon Sep 17 00:00:00 2001 From: natemaia Date: Mon, 28 Oct 2019 12:16:14 -0700 Subject: [PATCH] Fix: error in suckless_install, error checking for auto_part --- archlabs-installer | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/archlabs-installer b/archlabs-installer index 9280088..c3294a0 100755 --- a/archlabs-installer +++ b/archlabs-installer @@ -8,7 +8,7 @@ # check for syntax errors # set -n -VER=2.0.97 +VER=2.0.98 # default values { @@ -629,20 +629,23 @@ part_auto() msg "Auto Partition" "\nRemoving partitions on $device and setting table to $table\n" 1 - dev_info="$(parted -s "$device" print)" + dev_info="$(parted -s "$device" print 2> /dev/null)" swapoff -a while read -r PART; do - parted -s "$device" rm "$PART" > /dev/null 2>&1 + parted -s "$device" rm "$PART" > /dev/null 2> "$ERR" + errshow 0 "parted -s $device rm $PART" || return 1 done <<< "$(awk '/^ [1-9][0-9]?/ {print $1}' <<< "$dev_info" | sort -r)" - [[ $(awk '/Table:/ {print $3}' <<< "$dev_info") != "$table" ]] && parted -s "$device" mklabel "$table" > /dev/null 2>&1 + [[ $(awk '/Table:/ {print $3}' <<< "$dev_info") != "$table" ]] && parted -s "$device" mklabel "$table" > /dev/null 2> "$ERR" msg "Auto Partition" "\nCreating a 512M $boot_fs boot partition.\n" 1 if [[ $SYS == "BIOS" ]]; then - parted -s "$device" mkpart primary "$boot_fs" 1MiB 513MiB > /dev/null 2>&1 + parted -s "$device" mkpart primary "$boot_fs" 1MiB 513MiB > /dev/null 2> "$ERR" + errshow 0 "parted -s $device mkpart primary $boot_fs 1MiB 513MiB" || return 1 else - parted -s "$device" mkpart ESP "$boot_fs" 1MiB 513MiB > /dev/null 2>&1 + parted -s "$device" mkpart ESP "$boot_fs" 1MiB 513MiB > /dev/null 2> "$ERR" + errshow 0 "parted -s $device mkpart ESP $boot_fs 1MiB 513MiB" || return 1 fi sleep 0.5 @@ -650,16 +653,20 @@ part_auto() AUTO_BOOT_PART=$(lsblk -lno NAME,TYPE "$device" | awk 'NR==2 {print "/dev/" $1}') if [[ $SYS == "BIOS" ]]; then - mkfs.ext4 -q "$AUTO_BOOT_PART" > /dev/null 2>&1 + mkfs.ext4 -q "$AUTO_BOOT_PART" > /dev/null 2> "$ERR" + errshow 0 "mkfs.ext4 -q $AUTO_BOOT_PART" || return 1 else - mkfs.vfat -F32 "$AUTO_BOOT_PART" > /dev/null 2>&1 + mkfs.vfat -F32 "$AUTO_BOOT_PART" > /dev/null 2> "$ERR" + errshow 0 "mkfs.vfat -F32 $AUTO_BOOT_PART" || return 1 fi msg "Auto Partition" "\nCreating a $size ext4 root partition.\n" 0 - parted -s "$device" mkpart primary ext4 513MiB 100% > /dev/null 2>&1 + parted -s "$device" mkpart primary ext4 513MiB 100% > /dev/null 2> "$ERR" + errshow 0 "parted -s $device mkpart primary ext4 513MiB 100%" || return 1 sleep 0.5 AUTO_ROOT_PART="$(lsblk -lno NAME,TYPE "$device" | awk 'NR==3 {print "/dev/" $1}')" - mkfs.ext4 -q "$AUTO_ROOT_PART" > /dev/null 2>&1 + mkfs.ext4 -q "$AUTO_ROOT_PART" > /dev/null 2> "$ERR" + errshow 0 "mkfs.ext4 -q $AUTO_ROOT_PART" || return 1 sleep 0.5 msg "Auto Partition" "\nProcess complete.\n\n$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE "$device")\n" } @@ -1135,7 +1142,7 @@ select_extra_partitions() done <<< "$PARTS" fi - while (( COUNT > 0 )); do + while (( COUNT )); do part='' dlg part menu 'Mount Extra' "$_expart" 'done' 'finish mounting step' $PARTS || break if [[ $part == 'done' ]]; then @@ -1345,7 +1352,7 @@ install_user() chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2> "$ERR" 2>&1 errshow 1 "set $NEWUSER password" - if [[ $INSTALL_WMS == *dwm* ]];then + if [[ $INSTALL_WMS == *dwm* ]]; then install_suckless "/home/$NEWUSER" chroot [[ $INSTALL_WMS == 'dwm' ]] && rm -rf "$MNT/home/$NEWUSER/.config/xfce4" fi @@ -1422,7 +1429,7 @@ install_packages() rmpkg+="zsh " fi - if [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|fluxbox|jwm) ]]; then + if [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|fluxbox|jwm|awesome) ]]; then inpkg+="$WM_BASE_PKGS " elif [[ $INSTALL_WMS == 'dwm' ]]; then # dwm only needs a very limited package set inpkg+="nitrogen polkit-gnome gnome-keyring dunst " @@ -1472,7 +1479,8 @@ install_suckless() { local dir="$1/suckless" shift - if [[ $2 == 'chroot' ]]; then + + if [[ $1 == 'chroot' ]]; then chrun "mkdir -pv '$dir'" for i in dwm dmenu st; do if chrun "git clone 'https://git.suckless.org/$i' '$dir/$i'"; then