dom0/dispvm: by default use prerun script from inside of VM (#620)
This commit is contained in:
parent
b92bb698be
commit
4aab477f38
@ -1634,12 +1634,6 @@ class QubesTemplateVm(QubesVm):
|
|||||||
raise IOError ("Error while copying {0} to {1}".\
|
raise IOError ("Error while copying {0} to {1}".\
|
||||||
format(self.clean_img, self.volatile_img))
|
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
|
# Create root-cow.img
|
||||||
self.commit_changes(verbose=verbose)
|
self.commit_changes(verbose=verbose)
|
||||||
|
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
get_encoded_script()
|
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 ?
|
echo $1 is not a file ?
|
||||||
exit 1
|
exit 1
|
||||||
|
else
|
||||||
|
SCRIPT_CMD="cat $1"
|
||||||
fi
|
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
|
if [ $# != 2 -a $# != 3 ] ; then
|
||||||
|
@ -21,13 +21,9 @@ if [ "$TEMPLATENAME" = --default-template ] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "X""$2" = "X""--default-script" ] ; then
|
if [ "X""$2" = "X""--default-script" ] ; then
|
||||||
SCRIPTNAME="/var/lib/qubes/vm-templates/$TEMPLATENAME"/dispvm-prerun.sh
|
SCRIPTNAME="vm-default"
|
||||||
if ! [ -f $SCRIPTNAME ] ; then
|
|
||||||
echo $SCRIPTNAME does not exist
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
SCRIPTNAME=$2
|
SCRIPTNAME=$2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -d "/var/lib/qubes/vm-templates/$TEMPLATENAME" ] ; then
|
if ! [ -d "/var/lib/qubes/vm-templates/$TEMPLATENAME" ] ; then
|
||||||
|
Loading…
Reference in New Issue
Block a user