dom0/dispvm: by default use prerun script from inside of VM (#620)

This commit is contained in:
Marek Marczykowski 2012-07-12 14:21:59 +02:00
parent 718f5c2bdb
commit 8d8ce2de31
3 changed files with 8 additions and 14 deletions

View File

@ -1612,12 +1612,6 @@ class QubesTemplateVm(QubesVm):
raise IOError ("Error while copying {0} to {1}".\
format(self.clean_img, self.volatile_img))
if verbose:
print >> sys.stderr, "--> Copying the template's DispVM prerun script..."
retcode = subprocess.call (["cp", src_vm.dir_path + '/dispvm-prerun.sh', self.dir_path + '/dispvm-prerun.sh'])
if retcode != 0:
raise IOError ("Error while copying DispVM prerun script")
# Create root-cow.img
self.commit_changes(verbose=verbose)

View File

@ -1,11 +1,15 @@
#!/bin/bash
get_encoded_script()
{
if ! [ -f "$1" ] ; then
if [ "$1" == "vm-default" ]; then
SCRIPT_CMD="echo /usr/lib/qubes/dispvm-prerun.sh"
elif ! [ -f "$1" ] ; then
echo $1 is not a file ?
exit 1
else
SCRIPT_CMD="cat $1"
fi
ENCODED_SCRIPT=`cat "$1" | perl -e 'use MIME::Base64 qw(encode_base64); local($/) = undef;print encode_base64(<STDIN>)'|tr -d "\n"`
ENCODED_SCRIPT=`$SCRIPT_CMD | perl -e 'use MIME::Base64 qw(encode_base64); local($/) = undef;print encode_base64(<STDIN>)'|tr -d "\n"`
}
if [ $# != 2 -a $# != 3 ] ; then

View File

@ -21,13 +21,9 @@ if [ "$TEMPLATENAME" = --default-template ] ; then
fi
if [ "X""$2" = "X""--default-script" ] ; then
SCRIPTNAME="/var/lib/qubes/vm-templates/$TEMPLATENAME"/dispvm-prerun.sh
if ! [ -f $SCRIPTNAME ] ; then
echo $SCRIPTNAME does not exist
exit 1
fi
SCRIPTNAME="vm-default"
else
SCRIPTNAME=$2
SCRIPTNAME=$2
fi
if ! [ -d "/var/lib/qubes/vm-templates/$TEMPLATENAME" ] ; then