From cb593a0e09a322b25357fa8884c3f65d81780c56 Mon Sep 17 00:00:00 2001 From: steve Date: Tue, 19 Jun 2007 22:35:34 +0000 Subject: [PATCH] 2007-06-19 22:35:34 by steve Search for template files in /etc/xen-tools.conf. --- bin/xen-create-image | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/bin/xen-create-image b/bin/xen-create-image index 7c9b5e3..fbf9d6c 100755 --- a/bin/xen-create-image +++ b/bin/xen-create-image @@ -563,7 +563,7 @@ Install an X11 server, using VNC and XDM -- http://www.steve.org.uk/ - $Id: xen-create-image,v 1.157 2007-06-19 10:44:24 steve Exp $ + $Id: xen-create-image,v 1.158 2007-06-19 22:35:34 steve Exp $ =cut @@ -1239,7 +1239,7 @@ sub parseCommandLineArguments if ( $VERSION ) { - my $REVISION = '$Revision: 1.157 $'; + my $REVISION = '$Revision: 1.158 $'; if ( $REVISION =~ /1.([0-9.]+) / ) { $REVISION = $1; @@ -1459,12 +1459,24 @@ EOF # # Make sure that any specified template file exists. # - if ( ( defined( $CONFIG{'template'} ) ) && - ( length( $CONFIG{'template'} ) ) && - ( ! -e $CONFIG{'template'} ) ) + if ( defined( $CONFIG{'template'} ) && + length( $CONFIG{'template'} ) ) { - logprint( "The specified template file, $CONFIG{'template'}, does not exist.\n" ); - exit 1; + if ( -e $CONFIG{'template'} ) + { + # nop + } + elsif ( -e "/etc/xen-tools/$CONFIG{'template'}" ) + { + $CONFIG{'template'} = "/etc/xen-tools/$CONFIG{'template'}"; + } + else + { + # failed to find either by fully qualified path, + # or inside /etc/xen-tools. + logprint( "The specified template file, $CONFIG{'template'}, does not exist.\n" ); + exit 1; + } }