From f1321c1dd9b41eb62eae44b0a245d9066bf50148 Mon Sep 17 00:00:00 2001 From: natemaia Date: Sun, 3 May 2020 23:02:31 -0700 Subject: [PATCH] Copy skel to existing home directory --- archlabs-installer | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/archlabs-installer b/archlabs-installer index 9d138b8..48b197b 100755 --- a/archlabs-installer +++ b/archlabs-installer @@ -7,7 +7,7 @@ # shellcheck disable=SC2086,SC2046,SC2254 -VER=2.1.44 +VER=2.1.45 # default values { @@ -1603,6 +1603,7 @@ install_base() install_user() { + local i=0 local groups='audio,video,floppy,log,network,rfkill,scanner,storage,optical,power,wheel' [[ -e $MNT/etc/X11/xorg.conf.d/20-nvida.conf && -e $MNT/usr/bin/optirun ]] && groups+=',bumblebee' @@ -1618,6 +1619,10 @@ install_user() fi echo "Creating new user $NEWUSER and setting password" + + # check if there's an existing user home for new user (separate /home) + [[ -d "$MNT/home/$NEWUSER" ]] && i=1 + chrun "useradd -m -u 1000 -g users -G $groups -s /bin/$NEWSHELL $NEWUSER" 2> "$ERR" 2>&1 errshow 1 "chrun 'useradd -m -u 1000 -g users -G $groups -s /bin/$NEWSHELL $NEWUSER'" chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2> "$ERR" 2>&1 @@ -1625,6 +1630,9 @@ install_user() [[ $INSTALL_WMS == *dwm* ]] && install_suckless "/home/$NEWUSER" chroot + # upgrade existing home with new skeleton configs + [[ $i == 1 ]] && cp -aT "$MNT/etc/skel/" "$MNT/home/$NEWUSER" + install_cleanup "$NEWUSER" return 0 @@ -1760,7 +1768,7 @@ install_packages() for i in ${LOGIN_PKGS[$LOGIN_TYPE]}; do loginpkg+=("$i") done - + if [[ $PACSTRAP -eq 1 ]]; then blk=$(lsblk -f) lspci | grep -qi 'broadcom' && inpkg+=("b43-firmware" "b43-fwcutter" "broadcom-wl") @@ -1936,7 +1944,7 @@ install_mkinitcpio() [[ $LUKS ]] && add+=" encrypt" [[ $LVM ]] && add+=" lvm2" - [[ $SWAP ]] && add+=" resume" + [[ $SWAP ]] && add+=" resume" sed -i "s/block filesystems/block${add} filesystems ${HOOKS}/g" "$MNT/etc/mkinitcpio.conf" chrun "mkinitcpio -p $KERNEL" 2> "$ERR" 2>&1 errshow 1 "chrun 'mkinitcpio -p $KERNEL'"