From 2a4af9c053047dc2d7d7f58d297346af8a48550c Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 29 Nov 2006 19:17:55 +0000 Subject: [PATCH] 2006-11-29 19:17:55 by steve Add a --config option, just like in xen-create-image --- bin/xt-install-image | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/bin/xt-install-image b/bin/xt-install-image index 76f04cf..1d8b678 100755 --- a/bin/xt-install-image +++ b/bin/xt-install-image @@ -24,6 +24,8 @@ xt-install-image - Install a fresh copy of GNU/Linux into a directory Misc Options: --arch Pass the given arch setting to debootstrap or rpmstrap. + --config Read the specified config file in addition to the global + configuration file. --mirror The mirror to use when installing with 'debootstrap'. Installation Options: @@ -57,8 +59,8 @@ xt-install-image - Install a fresh copy of GNU/Linux into a directory =over 8 -=item B<--tar> -Untar a .tar file into the new installation location. This tarfile is assumed to contain a complete archived system. +=item B<--debootstrap> +Install the distribution specified by the B<--dist> argument using the debootstrap. If you use this option you must specify a mirror with B<--mirror>. =item B<--copy> Copy the given directory recursively. This local directory is assumed to contain a complete installation. @@ -66,8 +68,8 @@ Copy the given directory recursively. This local directory is assumed to contai =item B<--rpmstrap> Install the distribution specified by B<--dist> using the rpmstrap command. -=item B<--debootstrap> -Install the distribution specified by the B<--dist> argument using the debootstrap. If you use this option you must specify a mirror with B<--mirror>. +=item B<--tar> +Untar a .tar file into the new installation location. This tarfile is assumed to contain a complete archived system. =back @@ -80,7 +82,7 @@ Install the distribution specified by the B<--dist> argument using the debootstr -- http://www.steve.org.uk/ - $Id: xt-install-image,v 1.40 2006-11-19 19:41:34 steve Exp $ + $Id: xt-install-image,v 1.41 2006-11-29 19:17:55 steve Exp $ =cut @@ -128,6 +130,24 @@ readConfigurationFile( "/etc/xen-tools/xen-tools.conf" ); parseCommandLineArguments(); +# +# If we received a configuration file then read it. +# +if ( $CONFIG{'config'} ) +{ + my $path = $CONFIG{'config'}; + + # If not fully-qualified then read from /etc/xen-tools. + if ( $path !~ /^[\/]/ ) + { + $path = "/etc/xen-tools/" . $path; + } + + # Read the file, if it exists. + readConfigurationFile( $path ) if ( -e $path ); +} + + # # Check our arguments # @@ -362,6 +382,7 @@ sub parseCommandLineArguments # Misc "arch=s", \$CONFIG{'arch'}, "cache=s", \$CONFIG{'cache'}, + "config=s", \$CONFIG{'config'}, "mirror=s", \$CONFIG{'mirror'}, # Help. @@ -377,7 +398,7 @@ sub parseCommandLineArguments if ( $VERSION ) { - my $REVISION = '$Revision: 1.40 $'; + my $REVISION = '$Revision: 1.41 $'; if ( $REVISION =~ /1.([0-9.]+) / ) { $REVISION = $1;