Fix: broken redirection

This commit is contained in:
natemaia 2019-10-27 15:16:24 -07:00
parent f51ab5171a
commit aa00f0e206
2 changed files with 26 additions and 21 deletions

View File

View File

@ -8,7 +8,7 @@
# check for syntax errors # check for syntax errors
# set -n # set -n
VER=2.0.93 VER=2.0.94
# default values { # default values {
@ -1149,7 +1149,7 @@ install_main()
errshow 1 "genfstab -U $MNT > $MNT/etc/fstab" errshow 1 "genfstab -U $MNT > $MNT/etc/fstab"
[[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" "$MNT/etc/fstab" [[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" "$MNT/etc/fstab"
install_packages install_packages
# video driver tearfree configs, MUST be done after package install to support nvidia # tear free configs, MUST be done after package install for nvidia
install_tearfree_conf "$MNT/etc/X11/xorg.conf.d" install_tearfree_conf "$MNT/etc/X11/xorg.conf.d"
install_mkinitcpio install_mkinitcpio
install_boot install_boot
@ -1158,7 +1158,7 @@ install_main()
install_login install_login
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER" chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
if [[ "$USER_CMD" ]]; then if [[ "$USER_CMD" ]]; then
chrun "$USER_CMD" > "$ERR" 2>&1 chrun "$USER_CMD" 2> "$ERR" 2>&1
errshow 0 "$USER_CMD" errshow 0 "$USER_CMD"
fi fi
@ -1222,7 +1222,7 @@ install_base()
[[ $DIST != "ArchLabs" ]] || sed -i "s/ArchLabs/$DIST/g" "$MNT/etc/"{lsb-release,os-release} [[ $DIST != "ArchLabs" ]] || sed -i "s/ArchLabs/$DIST/g" "$MNT/etc/"{lsb-release,os-release}
# vmlinuz, if this isn't copied the standard kernel may fail mkinitcpio # vmlinuz, if this isn't copied the standard kernel may fail mkinitcpio
cp -vf "$RUN/x86_64/vmlinuz" "$MNT/boot/vmlinuz-linux" > "$ERR" 2>&1 cp -vf "$RUN/x86_64/vmlinuz" "$MNT/boot/vmlinuz-linux" 2> "$ERR" 2>&1
errshow 1 "cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux" errshow 1 "cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux"
# copy network settings # copy network settings
@ -1286,7 +1286,7 @@ install_boot()
fi fi
prerun_$BOOTLDR prerun_$BOOTLDR
chrun "${BCMDS[$BOOTLDR]}" > "$ERR" 2>&1 chrun "${BCMDS[$BOOTLDR]}" 2> "$ERR" 2>&1
errshow 1 "${BCMDS[$BOOTLDR]}" errshow 1 "${BCMDS[$BOOTLDR]}"
if [[ -d $MNT/hostrun ]]; then if [[ -d $MNT/hostrun ]]; then
@ -1317,19 +1317,19 @@ install_user()
rm -f "$MNT/root/.zlogin" # remove welcome message rm -f "$MNT/root/.zlogin" # remove welcome message
chrun "chpasswd <<< 'root:$ROOT_PASS'" > "$ERR" 2>&1 chrun "chpasswd <<< 'root:$ROOT_PASS'" 2> "$ERR" 2>&1
errshow 1 "set root password" errshow 1 "set root password"
if [[ $MYSHELL != 'zsh' ]]; then # root uses zsh by default if [[ $MYSHELL != 'zsh' ]]; then # root uses zsh by default
chrun "usermod -s /bin/$MYSHELL root" > "$ERR" 2>&1 chrun "usermod -s /bin/$MYSHELL root" 2> "$ERR" 2>&1
errshow 1 "usermod -s /bin/$MYSHELL root" errshow 1 "usermod -s /bin/$MYSHELL root"
# copy the default mkshrc to /root if it was selected # copy the default mkshrc to /root if it was selected
[[ $MYSHELL == 'mksh' ]] && cp -fv "$MNT/etc/skel/.mkshrc" "$MNT/root/.mkshrc" [[ $MYSHELL == 'mksh' ]] && cp -fv "$MNT/etc/skel/.mkshrc" "$MNT/root/.mkshrc"
fi fi
echo "Creating new user $NEWUSER and setting password" echo "Creating new user $NEWUSER and setting password"
chrun "useradd -m -u 1000 -g users -G $groups -s /bin/$MYSHELL $NEWUSER" > "$ERR" 2>&1 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" errshow 1 "useradd -m -u 1000 -g users -G $groups -s /bin/$MYSHELL $NEWUSER"
chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" > "$ERR" 2>&1 chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2> "$ERR" 2>&1
errshow 1 "set $NEWUSER password" errshow 1 "set $NEWUSER password"
if [[ $INSTALL_WMS == *dwm* ]];then if [[ $INSTALL_WMS == *dwm* ]];then
@ -1370,7 +1370,7 @@ install_login()
EOF EOF
fi fi
rm -rf "$serv" "$MNT/home/$NEWUSER/.xinitrc" rm -rf "$serv" "$MNT/home/$NEWUSER/.xinitrc"
chrun "systemctl enable $LOGIN_TYPE.service" > "$ERR" 2>&1 chrun "systemctl enable $LOGIN_TYPE.service" 2> "$ERR" 2>&1
errshow 1 "systemctl enable $LOGIN_TYPE.service" errshow 1 "systemctl enable $LOGIN_TYPE.service"
${LOGIN_TYPE}_config ${LOGIN_TYPE}_config
;; ;;
@ -1416,7 +1416,7 @@ install_packages()
fi fi
# update and install crucial packages first to avoid issues # update and install crucial packages first to avoid issues
chrun "pacman -Syyu $KERNEL $BASE_PKGS base-devel ${LOGIN_PKGS[$LOGIN_TYPE]} $MYSHELL --noconfirm --needed" > "$ERR" 2>&1 chrun "pacman -Syyu $KERNEL $BASE_PKGS base-devel ${LOGIN_PKGS[$LOGIN_TYPE]} $MYSHELL --noconfirm --needed" 2> "$ERR" 2>&1
errshow 1 "pacman -Syyu $KERNEL $BASE_PKGS base-devel ${LOGIN_PKGS[$LOGIN_TYPE]} $MYSHELL --noconfirm --needed" errshow 1 "pacman -Syyu $KERNEL $BASE_PKGS base-devel ${LOGIN_PKGS[$LOGIN_TYPE]} $MYSHELL --noconfirm --needed"
# remove the packages we don't want on the installed system # remove the packages we don't want on the installed system
@ -1426,19 +1426,19 @@ install_packages()
chrun "pacman -S iputils $UCODE --noconfirm" chrun "pacman -S iputils $UCODE --noconfirm"
# install the packages chosen throughout the install # install the packages chosen throughout the install
chrun "pacman -S $inpkg --needed --noconfirm" > "$ERR" 2>&1 chrun "pacman -S $inpkg --needed --noconfirm" 2> "$ERR" 2>&1
errshow 1 "pacman -S $inpkg --needed --noconfirm" errshow 1 "pacman -S $inpkg --needed --noconfirm"
# bootloader packages # bootloader packages
if [[ $BOOTLDR == 'grub' ]]; then if [[ $BOOTLDR == 'grub' ]]; then
[[ $SYS == 'UEFI' ]] && local efib="efibootmgr" [[ $SYS == 'UEFI' ]] && local efib="efibootmgr"
chrun "pacman -S os-prober grub $efib --needed --noconfirm" > "$ERR" 2>&1 chrun "pacman -S os-prober grub $efib --needed --noconfirm" 2> "$ERR" 2>&1
errshow 1 "pacman -S os-prober grub $efib --needed --noconfirm" errshow 1 "pacman -S os-prober grub $efib --needed --noconfirm"
elif [[ $BOOTLDR == 'refind-efi' ]]; then elif [[ $BOOTLDR == 'refind-efi' ]]; then
chrun "pacman -S refind-efi efibootmgr --needed --noconfirm" > "$ERR" 2>&1 chrun "pacman -S refind-efi efibootmgr --needed --noconfirm" 2> "$ERR" 2>&1
errshow 1 "pacman -S refind-efi efibootmgr --needed --noconfirm" errshow 1 "pacman -S refind-efi efibootmgr --needed --noconfirm"
elif [[ $SYS == 'UEFI' ]]; then elif [[ $SYS == 'UEFI' ]]; then
chrun "pacman -S efibootmgr --needed --noconfirm" > "$ERR" 2>&1 chrun "pacman -S efibootmgr --needed --noconfirm" 2> "$ERR" 2>&1
errshow 1 "pacman -S efibootmgr --needed --noconfirm" errshow 1 "pacman -S efibootmgr --needed --noconfirm"
fi fi
@ -1486,7 +1486,7 @@ install_mkinitcpio()
[[ $LUKS ]] && add="encrypt" [[ $LUKS ]] && add="encrypt"
[[ $LVM ]] && { [[ $add ]] && add+=" lvm2" || add+="lvm2"; } [[ $LVM ]] && { [[ $add ]] && add+=" lvm2" || add+="lvm2"; }
sed -i "s/block filesystems/block ${add} filesystems ${HOOKS}/g" "$MNT/etc/mkinitcpio.conf" sed -i "s/block filesystems/block ${add} filesystems ${HOOKS}/g" "$MNT/etc/mkinitcpio.conf"
chrun "mkinitcpio -p $KERNEL" > "$ERR" 2>&1 chrun "mkinitcpio -p $KERNEL" 2> "$ERR" 2>&1
errshow 1 "mkinitcpio -p $KERNEL" errshow 1 "mkinitcpio -p $KERNEL"
} }
@ -1539,6 +1539,7 @@ install_tearfree_conf()
Option "TearFree" "true" Option "TearFree" "true"
EndSection EndSection
EOF EOF
cat "$xpath/20-intel.conf"
elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*RX\|AMD/ATI.*R[579]'; then # newer RX, R5, R7, and R9 cards can use the amdgpu driver elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*RX\|AMD/ATI.*R[579]'; then # newer RX, R5, R7, and R9 cards can use the amdgpu driver
echo "Creating AMD Tear Free config /etc/X11/xorg.conf.d/20-amdgpu.conf" echo "Creating AMD Tear Free config /etc/X11/xorg.conf.d/20-amdgpu.conf"
cat > "$xpath/20-amdgpu.conf" <<- EOF cat > "$xpath/20-amdgpu.conf" <<- EOF
@ -1548,6 +1549,7 @@ install_tearfree_conf()
Option "TearFree" "true" Option "TearFree" "true"
EndSection EndSection
EOF EOF
cat "$xpath/20-amdgpu.conf"
elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*HD [2-6][0-9]*'; then # older HD 2xxx-6xxx cards must use the radeon driver elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*HD [2-6][0-9]*'; then # older HD 2xxx-6xxx cards must use the radeon driver
echo "Creating Radeon Tear Free config /etc/X11/xorg.conf.d/20-radeon.conf" echo "Creating Radeon Tear Free config /etc/X11/xorg.conf.d/20-radeon.conf"
cat > "$xpath/20-radeon.conf" <<- EOF cat > "$xpath/20-radeon.conf" <<- EOF
@ -1557,6 +1559,7 @@ install_tearfree_conf()
Option "TearFree" "on" Option "TearFree" "on"
EndSection EndSection
EOF EOF
cat "$xpath/20-radeon.conf"
elif lspci | grep ' VGA ' | grep -q 'NVIDIA'; then # nvidia cards require a bit of checking for notebook gpus elif lspci | grep ' VGA ' | grep -q 'NVIDIA'; then # nvidia cards require a bit of checking for notebook gpus
echo "Trying nvidia driver install" echo "Trying nvidia driver install"
if lspci | grep ' VGA ' | grep -q 'Intel\|AMD' && lspci | grep ' VGA ' | grep -q 'NVIDIA.*[6-9][1-8][05]M[X]\?\|NVIDIA.*Quadro.*[KMP][1-6][0-2][0]*M'; then # optimus if lspci | grep ' VGA ' | grep -q 'Intel\|AMD' && lspci | grep ' VGA ' | grep -q 'NVIDIA.*[6-9][1-8][05]M[X]\?\|NVIDIA.*Quadro.*[KMP][1-6][0-2][0]*M'; then # optimus
@ -1573,6 +1576,8 @@ install_tearfree_conf()
fi fi
fi fi
if [[ -e $xpath/20-nvidia.conf ]]; then if [[ -e $xpath/20-nvidia.conf ]]; then
cat "$xpath/20-radeon.conf"
echo
echo "NVIDIA driver installed" echo "NVIDIA driver installed"
if [[ $xpath == *"$MNT"* ]]; then if [[ $xpath == *"$MNT"* ]]; then
echo "Trying to load the driver for live session" echo "Trying to load the driver for live session"
@ -1667,12 +1672,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" 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 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" > "$ERR" 2>&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" 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" 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 fi
if [[ $SYS == 'BIOS' && $LVM && -z $SEP_BOOT ]]; then if [[ $SYS == 'BIOS' && $LVM && -z $SEP_BOOT ]]; then
sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" "$MNT/etc/default/grub" > "$ERR" 2>&1 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" errshow 1 "sed -i 's/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g' $MNT/etc/default/grub"
fi fi
@ -1717,11 +1722,11 @@ prerun_syslinux()
s="/usr/lib/syslinux/efi64" s="/usr/lib/syslinux/efi64"
d=''; d='';
fi fi
mkdir -pv "$c" > "$ERR" 2>&1 mkdir -pv "$c" 2> "$ERR" 2>&1
errshow 1 "mkdir -pv $c" errshow 1 "mkdir -pv $c"
cp -rfv "$s/"* "$c/" > "$ERR" 2>&1 cp -rfv "$s/"* "$c/" 2> "$ERR" 2>&1
errshow 1 "cp -rfv $s/* $c/" errshow 1 "cp -rfv $s/* $c/"
cp -fv "$RUN/syslinux/splash.png" "$c/" > "$ERR" 2>&1 cp -fv "$RUN/syslinux/splash.png" "$c/" 2> "$ERR" 2>&1
errshow 0 "cp -fv $RUN/syslinux/splash.png $c/" errshow 0 "cp -fv $RUN/syslinux/splash.png $c/"
cat > "$c/syslinux.cfg" <<- EOF cat > "$c/syslinux.cfg" <<- EOF
UI vesamenu.c32 UI vesamenu.c32