Copy skel to existing home directory

This commit is contained in:
natemaia 2020-05-03 23:02:31 -07:00
parent 1c1ee76cb4
commit f1321c1dd9

View File

@ -7,7 +7,7 @@
# shellcheck disable=SC2086,SC2046,SC2254 # shellcheck disable=SC2086,SC2046,SC2254
VER=2.1.44 VER=2.1.45
# default values { # default values {
@ -1603,6 +1603,7 @@ install_base()
install_user() install_user()
{ {
local i=0
local groups='audio,video,floppy,log,network,rfkill,scanner,storage,optical,power,wheel' 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' [[ -e $MNT/etc/X11/xorg.conf.d/20-nvida.conf && -e $MNT/usr/bin/optirun ]] && groups+=',bumblebee'
@ -1618,6 +1619,10 @@ install_user()
fi fi
echo "Creating new user $NEWUSER and setting password" 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 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'" errshow 1 "chrun 'useradd -m -u 1000 -g users -G $groups -s /bin/$NEWSHELL $NEWUSER'"
chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2> "$ERR" 2>&1 chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2> "$ERR" 2>&1
@ -1625,6 +1630,9 @@ install_user()
[[ $INSTALL_WMS == *dwm* ]] && install_suckless "/home/$NEWUSER" chroot [[ $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" install_cleanup "$NEWUSER"
return 0 return 0
@ -1760,7 +1768,7 @@ install_packages()
for i in ${LOGIN_PKGS[$LOGIN_TYPE]}; do for i in ${LOGIN_PKGS[$LOGIN_TYPE]}; do
loginpkg+=("$i") loginpkg+=("$i")
done done
if [[ $PACSTRAP -eq 1 ]]; then if [[ $PACSTRAP -eq 1 ]]; then
blk=$(lsblk -f) blk=$(lsblk -f)
lspci | grep -qi 'broadcom' && inpkg+=("b43-firmware" "b43-fwcutter" "broadcom-wl") lspci | grep -qi 'broadcom' && inpkg+=("b43-firmware" "b43-fwcutter" "broadcom-wl")
@ -1936,7 +1944,7 @@ install_mkinitcpio()
[[ $LUKS ]] && add+=" encrypt" [[ $LUKS ]] && add+=" encrypt"
[[ $LVM ]] && add+=" lvm2" [[ $LVM ]] && add+=" lvm2"
[[ $SWAP ]] && add+=" resume" [[ $SWAP ]] && add+=" resume"
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" 2> "$ERR" 2>&1 chrun "mkinitcpio -p $KERNEL" 2> "$ERR" 2>&1
errshow 1 "chrun 'mkinitcpio -p $KERNEL'" errshow 1 "chrun 'mkinitcpio -p $KERNEL'"