Allow to provide customized DispVM home directly in the template VM

This significantly speeds up DispVM creation for large customized
homes, since no data has to be copied, and instead CoW is used.
This commit is contained in:
qubesuser 2015-11-12 15:30:00 +01:00
parent 914bab048a
commit f380c346cf
2 changed files with 12 additions and 8 deletions

View File

@ -3,10 +3,12 @@
apps="/usr/libexec/evinced" apps="/usr/libexec/evinced"
#If user have customized DispVM settings, use its home instead of default dotfiles #If user have customized DispVM settings, use its home instead of default dotfiles
if [ -e /rw/home/user/.qubes-dispvm-customized ]; then if [ ! -e /home/user/.qubes-dispvm-customized ]; then
if [ -e /rw/home/user/.qubes-dispvm-customized ]; then
cp -af /rw/home/user /home/ cp -af /rw/home/user /home/
else else
cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >/tmp/dispvm-dotfiles-errors.log cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >/tmp/dispvm-dotfiles-errors.log
fi
fi fi
for app in $apps ; do for app in $apps ; do

View File

@ -79,11 +79,13 @@ if [ -e /var/run/qubes-service/qubes-dvm ]; then
touch /etc/this-is-dvm touch /etc/this-is-dvm
#If user have customized DispVM settings, use its home instead of default dotfiles #If user have customized DispVM settings, use its home instead of default dotfiles
if [ ! -e /home/user/.qubes-dispvm-customized ]; then
if [ -e /rw/home/user/.qubes-dispvm-customized ]; then if [ -e /rw/home/user/.qubes-dispvm-customized ]; then
cp -af /rw/home/user /home/ cp -af /rw/home/user /home/
else else
cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >/tmp/dispvm-dotfiles-errors.log cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >/tmp/dispvm-dotfiles-errors.log
fi fi
fi
else else
mount /home mount /home
fi fi