Use only /etc/skel to provision user's home directory of new VM

Get rid of non-standard /home.orig handling.

Fixes QubesOS/qubes-issues#3771
This commit is contained in:
Marek Marczykowski-Górecki 2018-04-13 00:35:08 +02:00
parent 7fa3c51fd2
commit 82937e129e
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -158,15 +158,9 @@ initialize_home() {
homedir=$(echo "$pair" | awk -F : ' { print $4 } ') homedir=$(echo "$pair" | awk -F : ' { print $4 } ')
homedirwithouthome=${homedir#/home/} homedirwithouthome=${homedir#/home/}
if ! test -d "$home_root/$homedirwithouthome" || [ "$mode" = "unconditionally" ] ; then if ! test -d "$home_root/$homedirwithouthome" || [ "$mode" = "unconditionally" ] ; then
if [ "$homedir" == "/home/user" ] && [ -d "/home.orig/$homedirwithouthome" ] ; then echo "initialize_home: populating $mode $home_root/$homedirwithouthome from /etc/skel" >&2
echo "initialize_home: populating $mode $home_root/$homedirwithouthome from /home.orig/$homedirwithouthome" >&2 mkdir -p "$home_root/$homedirwithouthome"
mkdir -p "$home_root/$homedirwithouthome" cp -af -T /etc/skel "$home_root/$homedirwithouthome"
cp -af -T "/home.orig/$homedirwithouthome" "$home_root/$homedirwithouthome"
else
echo "initialize_home: populating $mode $home_root/$homedirwithouthome from /etc/skel" >&2
mkdir -p "$home_root/$homedirwithouthome"
cp -af -T /etc/skel "$home_root/$homedirwithouthome"
fi
echo "initialize_home: adjusting permissions $mode on $home_root/$homedirwithouthome" >&2 echo "initialize_home: adjusting permissions $mode on $home_root/$homedirwithouthome" >&2
chown -R "$uid" "$home_root/$homedirwithouthome" & chown -R "$uid" "$home_root/$homedirwithouthome" &
waitpids="$!" waitpids="$!"