diff --git a/xen-create-image b/xen-create-image index 7fbca23..2a0be0d 100755 --- a/xen-create-image +++ b/xen-create-image @@ -240,8 +240,33 @@ Show the version number and exit. xen-create-image --debootstrap='--include=screen,sudo,less' +=head1 HOOKS + + Once the image has been installed using debootstrap there is + the chance for you to run some scripts before the image is unmounted. + + To do this place executable scripts inside the "hook directory" + /etc/xen-tools/xen-create-image.d. Each script there will be + executed in turn. + + The scripts will be passed a single argument which is the prefix + of the mounted filesystem. + + A script could copy some modules to the new system, for example: + +=for example start + + #!/bin/sh + prefix=$1 + + mkdir -p ${prefix}/lib/modules + cp -R /lib/modules/2.6.12.6-xen/ ${prefix}/lib/modules + +=for example cut + =cut + =head1 AUTHOR @@ -249,7 +274,7 @@ Show the version number and exit. -- http://www.steve.org.uk/ - $Id: xen-create-image,v 1.56 2005-12-24 06:58:45 steve Exp $ + $Id: xen-create-image,v 1.57 2005-12-24 07:07:22 steve Exp $ =cut @@ -682,6 +707,19 @@ print "done\n"; +# +# Allow the sysadmin to create scripts to be executed +# post-install. +# +my $HOOK_DIR="/etc/xen-tools/xen-create-image.d/"; +if ( -d $HOOK_DIR ) +{ + print "Running hooks from : $HOOK_DIR\n"; + runHooks( $HOOK_DIR, $dir ); + print "Done\n"; +} + + # # Now unmount the image. @@ -713,19 +751,6 @@ close( XEN ); print "Done\n"; -# -# Allow the sysadmin to create scripts to be executed -# post-install. -# -my $HOOK_DIR="/etc/xen-tools/xen-create-image.d/"; -if ( -d $HOOK_DIR ) -{ - print "Running hooks from : $HOOK_DIR\n"; - runHooks( $HOOK_DIR, $dir ); - print "Done\n"; -} - - # # Clear screen before printing success message, unless @@ -905,7 +930,7 @@ sub parseCommandLineArguments if ( $VERSION ) { - my $REVISION = '$Id: xen-create-image,v 1.56 2005-12-24 06:58:45 steve Exp $'; + my $REVISION = '$Id: xen-create-image,v 1.57 2005-12-24 07:07:22 steve Exp $'; $VERSION = join (' ', (split (' ', $REVISION))[2]); $VERSION =~ s/,v\b//; $VERSION =~ s/(\S+)$/$1/;