dispvm: honour current choice of template for dispvm

... when auto-refreshing the dispvm savefile.
While at it, also copy dispvm-prerun.sh script in qvm-clone.
This commit is contained in:
Rafal Wojtczuk 2011-07-26 17:09:59 +02:00
parent 3df2e9783d
commit 6fc358bd20
3 changed files with 19 additions and 6 deletions

View File

@ -1137,6 +1137,13 @@ class QubesTemplateVm(QubesVm):
if retcode != 0:
raise IOError ("Error while copying {0} to {1}".\
format(self.clean_volatile_img, self.volatile_img))
if verbose:
print "--> Copying the template's DispVM prerun script..."
retcode = subprocess.call (["cp", src_template_vm.dir_path + '/dispvm-prerun.sh', self.dir_path + '/dispvm-prerun.sh'])
if retcode != 0:
raise IOError ("Error while copying DispVM prerun script")
if verbose:
print "--> Copying the template's appmenus templates dir:\n{0} ==>\n{1}".\
format(src_template_vm.appmenus_templates_dir, self.appmenus_templates_dir)

View File

@ -3,7 +3,7 @@ trap "exit 1" USR1 TERM
export SHELL_PID=$$
(
echo "1"
if ! qvm-create-default-dvm --default-template --default-script >/var/run/qubes/qvm-create-default-dvm.stdout </dev/null ; then
if ! qvm-create-default-dvm --used-template --default-script >/var/run/qubes/qvm-create-default-dvm.stdout </dev/null ; then
kill -USR1 $SHELL_PID
fi
echo 100

View File

@ -1,16 +1,23 @@
#!/bin/sh
if [ $# != 1 -a $# != 2 ] ; then
echo 'Usage: qvm-create-default-dvm templatename|--default-template [script-name|--default-script]'
echo 'Usage: qvm-create-default-dvm templatename|--default-template|--used-template [script-name|--default-script]'
exit 1
fi
if [ "$1" = --default-template ] ; then
export ROOT=/var/lib/qubes/dvmdata/savefile_root
TEMPLATENAME=$1
if [ "$TEMPLATENAME" = --used-template ] ; then
if [ -e $ROOT ] ; then
TEMPLATENAME=$(readlink $ROOT | sed -e 's/.root.img//' -e 's/.*\///')
else
TEMPLATENAME=--default-template
fi
fi
if [ "$TEMPLATENAME" = --default-template ] ; then
TEMPLATENAME=$(qvm-get-default-template)
if [ "X"$TEMPLATENAME = "X" ] ; then
echo No default template ?
exit 1
fi
else
TEMPLATENAME=$1
fi
if [ "X""$2" = "X""--default-script" ] ; then
@ -38,7 +45,6 @@ if ! /usr/lib/qubes/qubes_prepare_saved_domain.sh \
"$DVMTMPL" "/var/lib/qubes/appvms/$DVMTMPL/dvm-savefile" $SCRIPTNAME ; then
exit 1
fi
ROOT=/var/lib/qubes/dvmdata/savefile_root
DEFAULT=/var/lib/qubes/dvmdata/default_savefile
DEFAULTCONF=/var/lib/qubes/dvmdata/default_dvm.conf
CURRENT=/var/run/qubes/current_savefile