From 3e572eac6fbc3a23d4917551a0f1e58bed320871 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 9 Jun 2006 14:48:29 +0000 Subject: [PATCH] 2006-06-09 14:48:29 by steve Remap sid/sarge/etc -> debian. Setup default options. --- bin/xen-create-image | 71 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 4 deletions(-) diff --git a/bin/xen-create-image b/bin/xen-create-image index dc763a0..5be624d 100755 --- a/bin/xen-create-image +++ b/bin/xen-create-image @@ -2,7 +2,7 @@ =head1 NAME - xen-create-image - Create a new Xen instance +xen-create-image - Create a new Xen instance =cut @@ -31,7 +31,7 @@ -- http://www.steve.org.uk/ - $Id: xen-create-image,v 1.3 2006-06-09 14:41:22 steve Exp $ + $Id: xen-create-image,v 1.4 2006-06-09 14:48:29 steve Exp $ =cut @@ -60,6 +60,7 @@ use Pod::Usage; # my %CONFIG; + # # Release number. # @@ -75,6 +76,12 @@ my $RELEASE = '2.0'; checkSystem(); +# +# Setup default options. +# +setupDefaultOptions(); + + # # Parse the command line arguments. # @@ -160,6 +167,49 @@ sub checkSystem +=head2 setupDefaultOptions + + Setup the default options we'd expect into our global CONFIG hash. + +=cut + +sub setupDefaultOptions +{ + + # + # Paths and files. + # + $CONFIG{'dir'} = ''; + $CONFIG{'xm'} = '/usr/sbin/xm'; + $CONFIG{'kernel'} = '/boot/vmlinuz-2.6.16-1-xen-686'; + $CONFIG{'initrd'} = '/boot/initrd.img-2.6.16-1-xen-686'; + + # + # Sizing options. + # + $CONFIG{'memory'} = '96Mb'; + $CONFIG{'size'} = '2000Mb'; + $CONFIG{'swap'} = '128M'; + $CONFIG{'cache'} = 'yes'; + + # + # Misc. options. + # + $CONFIG{'mirror'} = 'http://ftp.us.debian.org/debian'; + $CONFIG{'dist'} = 'sarge'; + $CONFIG{'fs'} = 'ext3'; + $CONFIG{'force'} = 0; + + # + # Installation methods + # + $CONFIG{'rpmstrap'} = 0; + $CONFIG{'debootstrap'} = 0; + $CONFIG{'copy'} = ''; + $CONFIG{'tar'} = ''; +} + + =head2 parseCommandLineArguments @@ -204,7 +254,7 @@ sub parseCommandLineArguments if ( $VERSION ) { - my $REVISION = '$Revision: 1.3 $'; + my $REVISION = '$Revision: 1.4 $'; if ( $REVISION =~ /1.([0-9.]+) / ) { @@ -235,6 +285,19 @@ sub checkArguments exit 1; } + # + # Cheat and remap distributions names. + # + # TODO: Alternative create symlinks in the hook.d + if ( ( $CONFIG{'dist'} =~ /^sarge$/i ) || + ( $CONFIG{'dist'} =~ /^etch$/i ) || + ( $CONFIG{'dist'} =~ /^sid$/i ) ) + { + $CONFIG{'dist'} = 'debian'; + } + + + # # # Test that the distribution name we've been given # to configure has a collection of hook scripts. @@ -249,7 +312,7 @@ sub checkArguments print <