Copy skel to existing home directory
This commit is contained in:
parent
1c1ee76cb4
commit
f1321c1dd9
@ -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
|
||||
|
Reference in New Issue
Block a user