From faf132abb042c56cac76a381e048df3e61afe518 Mon Sep 17 00:00:00 2001 From: natemaia Date: Thu, 17 Oct 2019 22:08:13 -0700 Subject: [PATCH] Show stderr during install when redirecting it to the error log --- archlabs-installer | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/archlabs-installer b/archlabs-installer index 56dee67..60eb985 100755 --- a/archlabs-installer +++ b/archlabs-installer @@ -5,7 +5,7 @@ # Some ideas and code reworked from other resources # AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due -VER=2.0.81 +VER=2.0.82 # bulk default values { @@ -619,10 +619,11 @@ part_show() part_auto() { local device="$1" table="$2" boot_fs="$3" size="$4" dev_info="" - dev_info="$(parted -s "$device" print)" msg "Auto Partition" "\nRemoving partitions on $device and setting table to $table\n" 1 + dev_info="$(parted -s "$device" print)" + swapoff -a while read -r PART; do parted -s "$device" rm "$PART" >/dev/null 2>&1 @@ -914,7 +915,6 @@ part_mountconf() mount_menu() { - msg "Info" "\nGathering device info.\n" 0 no_bg_install || return 0 lvm_detect umount_dir $MNT @@ -1172,7 +1172,7 @@ select_extra_partitions() install_main() { install_base - genfstab -U $MNT >$MNT/etc/fstab 2>$ERR + genfstab -U $MNT >$MNT/etc/fstab 2>$ERR 2>&1 errshow 1 "genfstab -U $MNT >$MNT/etc/fstab" [[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab install_packages @@ -1322,10 +1322,11 @@ install_boot() fi prerun_$BOOTLDR - chrun "${BCMDS[$BOOTLDR]}" 2>$ERR + chrun "${BCMDS[$BOOTLDR]}" 2>$ERR 2>&1 errshow 1 "${BCMDS[$BOOTLDR]}" if [[ -d $MNT/hostrun ]]; then + echo "Unmounting chroot directories" # cleanup the bind mounts we made earlier for the grub-probe module umount_dir $MNT/hostrun/{udev,lvm} rm -rf $MNT/hostrun >/dev/null 2>&1 @@ -1351,19 +1352,19 @@ install_user() rm -f $MNT/root/.zshrc # remove welcome message from root zshrc - chrun "chpasswd <<< 'root:$ROOT_PASS'" 2>$ERR + chrun "chpasswd <<< 'root:$ROOT_PASS'" 2>$ERR 2>&1 errshow 1 "set root password" if [[ $MYSHELL != 'zsh' ]]; then # root uses zsh by default - chrun "usermod -s /bin/$MYSHELL root" 2>$ERR + chrun "usermod -s /bin/$MYSHELL root" 2>$ERR 2>&1 errshow 1 "usermod -s /bin/$MYSHELL root" # copy the default mkshrc to /root if it was selected [[ $MYSHELL == 'mksh' ]] && cp -fv "$MNT/etc/skel/.mkshrc" "$MNT/root/.mkshrc" fi echo "Creating new user $NEWUSER and setting password" - chrun "useradd -m -u 1000 -g users -G $groups -s /bin/$MYSHELL $NEWUSER" 2>$ERR + chrun "useradd -m -u 1000 -g users -G $groups -s /bin/$MYSHELL $NEWUSER" 2>$ERR 2>&1 errshow 1 "useradd -m -u 1000 -g users -G $groups -s /bin/$MYSHELL $NEWUSER" - chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2>$ERR + chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2>$ERR 2>&1 errshow 1 "set $NEWUSER password" if [[ $INSTALL_WMS == *dwm* ]];then @@ -1407,7 +1408,7 @@ install_login() EOF fi rm -rf "$serv" "$MNT/home/$NEWUSER/.xinitrc" - chrun "systemctl enable $LOGIN_TYPE.service" 2>$ERR + chrun "systemctl enable $LOGIN_TYPE.service" 2>$ERR 2>&1 errshow 1 "systemctl enable $LOGIN_TYPE.service" ${LOGIN_TYPE}_config ;; @@ -1451,7 +1452,7 @@ install_packages() fi # update and install crucial packages first to avoid issues - chrun "pacman -Syyu $KERNEL $BASE_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $MYSHELL --noconfirm --needed" 2>$ERR + chrun "pacman -Syyu $KERNEL $BASE_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $MYSHELL --noconfirm --needed" 2>$ERR 2>&1 errshow 1 "pacman -Syyu $KERNEL $BASE_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $MYSHELL --noconfirm --needed" # remove the packages we don't want on the installed system @@ -1461,19 +1462,19 @@ install_packages() chrun "pacman -S iputils $UCODE --noconfirm" # install the packages chosen throughout the install - chrun "pacman -S $inpkg --needed --noconfirm" 2>$ERR + chrun "pacman -S $inpkg --needed --noconfirm" 2>$ERR 2>&1 errshow 1 "pacman -S $inpkg --needed --noconfirm" # bootloader packages if [[ $BOOTLDR == 'grub' ]]; then [[ $SYS == 'UEFI' ]] && local efib="efibootmgr" - chrun "pacman -S os-prober grub $efib --needed --noconfirm" 2>$ERR + chrun "pacman -S os-prober grub $efib --needed --noconfirm" 2>$ERR 2>&1 errshow 1 "pacman -S os-prober grub $efib --needed --noconfirm" elif [[ $BOOTLDR == 'refind-efi' ]]; then - chrun "pacman -S refind-efi efibootmgr --needed --noconfirm" 2>$ERR + chrun "pacman -S refind-efi efibootmgr --needed --noconfirm" 2>$ERR 2>&1 errshow 1 "pacman -S refind-efi efibootmgr --needed --noconfirm" elif [[ $SYS == 'UEFI' ]]; then - chrun "pacman -S efibootmgr --needed --noconfirm" 2>$ERR + chrun "pacman -S efibootmgr --needed --noconfirm" 2>$ERR 2>&1 errshow 1 "pacman -S efibootmgr --needed --noconfirm" fi @@ -1489,7 +1490,7 @@ install_mkinitcpio() [[ $LUKS ]] && add="encrypt" [[ $LVM ]] && { [[ $add ]] && add+=" lvm2" || add+="lvm2"; } sed -i "s/block filesystems/block ${add} filesystems ${HOOKS}/g" $MNT/etc/mkinitcpio.conf - chrun "mkinitcpio -p $KERNEL" 2>$ERR + chrun "mkinitcpio -p $KERNEL" 2>$ERR 2>&1 errshow 1 "mkinitcpio -p $KERNEL" } @@ -1621,12 +1622,12 @@ prerun_grub() sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g; s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" $MNT/etc/default/grub if [[ $LUKS_DEV ]]; then - sed -i "s~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g; s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g" $MNT/etc/default/grub 2>$ERR + sed -i "s~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g; s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g" $MNT/etc/default/grub 2>$ERR 2>&1 errshow 1 "sed -i 's~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g; s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g' $MNT/etc/default/grub" fi if [[ $SYS == 'BIOS' && $LVM && -z $SEP_BOOT ]]; then - sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" $MNT/etc/default/grub 2>$ERR + sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" $MNT/etc/default/grub 2>$ERR 2>&1 errshow 1 "sed -i 's/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g' $MNT/etc/default/grub" fi @@ -1767,7 +1768,6 @@ prerun_systemd-boot() lvm_menu() { - msg "Info" "\nGathering device info.\n" 0 no_bg_install || return 1 lvm_detect local choice