From f380c346cf9af3f058b8ece853d7d4a5ece28815 Mon Sep 17 00:00:00 2001 From: qubesuser Date: Thu, 12 Nov 2015 15:30:00 +0100 Subject: [PATCH] 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. --- misc/dispvm-prerun.sh | 10 ++++++---- vm-systemd/mount-dirs.sh | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/misc/dispvm-prerun.sh b/misc/dispvm-prerun.sh index 971a429..297750b 100755 --- a/misc/dispvm-prerun.sh +++ b/misc/dispvm-prerun.sh @@ -3,10 +3,12 @@ apps="/usr/libexec/evinced" #If user have customized DispVM settings, use its home instead of default dotfiles -if [ -e /rw/home/user/.qubes-dispvm-customized ]; then - cp -af /rw/home/user /home/ -else - cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >/tmp/dispvm-dotfiles-errors.log +if [ ! -e /home/user/.qubes-dispvm-customized ]; then + if [ -e /rw/home/user/.qubes-dispvm-customized ]; then + cp -af /rw/home/user /home/ + else + cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >/tmp/dispvm-dotfiles-errors.log + fi fi for app in $apps ; do diff --git a/vm-systemd/mount-dirs.sh b/vm-systemd/mount-dirs.sh index 4fd761e..0647d88 100644 --- a/vm-systemd/mount-dirs.sh +++ b/vm-systemd/mount-dirs.sh @@ -79,10 +79,12 @@ if [ -e /var/run/qubes-service/qubes-dvm ]; then touch /etc/this-is-dvm #If user have customized DispVM settings, use its home instead of default dotfiles - if [ -e /rw/home/user/.qubes-dispvm-customized ]; then - cp -af /rw/home/user /home/ - else - cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >/tmp/dispvm-dotfiles-errors.log + if [ ! -e /home/user/.qubes-dispvm-customized ]; then + if [ -e /rw/home/user/.qubes-dispvm-customized ]; then + cp -af /rw/home/user /home/ + else + cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >/tmp/dispvm-dotfiles-errors.log + fi fi else mount /home