Move chown for new user home to after creating login files.

This commit is contained in:
natemaia 2020-11-05 12:59:53 -08:00
parent a7b7ad8f20
commit 0e1030016b

View File

@ -6,7 +6,7 @@
# AIF, Calamares, and the Arch Wiki.. Credit where credit is due # AIF, Calamares, and the Arch Wiki.. Credit where credit is due
# shellcheck disable=SC2086,SC2046,SC2254,SC2164 # shellcheck disable=SC2086,SC2046,SC2254,SC2164
VER=2.2 VER=2.3
# default values { # default values {
@ -1676,6 +1676,9 @@ install_main()
install_user install_user
install_login install_login
# make sure the new user owns files in their $HOME
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
# changing distro name? # changing distro name?
if [[ -f "$MNT/etc/os-release" ]] && ! grep -q "$DIST" "$MNT/etc/os-release"; then if [[ -f "$MNT/etc/os-release" ]] && ! grep -q "$DIST" "$MNT/etc/os-release"; then
n=$(awk '/^NAME=/ {gsub(/^NAME=|"|'\''/, ""); print $1}' "$MNT/etc/os-release" 2> /dev/null) n=$(awk '/^NAME=/ {gsub(/^NAME=|"|'\''/, ""); print $1}' "$MNT/etc/os-release" 2> /dev/null)
@ -1823,11 +1826,6 @@ install_user()
(( i )) && cp -rfaT -b --suffix='.bak' "$MNT/etc/skel/" "$MNT/home/$NEWUSER" (( i )) && cp -rfaT -b --suffix='.bak' "$MNT/etc/skel/" "$MNT/home/$NEWUSER"
install_cleanup "$NEWUSER" install_cleanup "$NEWUSER"
# make sure the new user owns files in their $HOME
chrun "chown -Rf $NEWUSER:users /home/$NEWUSER"
return 0
} }
install_login() install_login()