From 9c9bc103c8e4d62bc19ef5bcb384cf1e8d1005cc Mon Sep 17 00:00:00 2001 From: steve Date: Sat, 24 Dec 2005 12:10:20 +0000 Subject: [PATCH] 2005-12-24 12:10:20 by steve Pass all configuration variables to the child process, via environmental variables. --- xen-create-image | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/xen-create-image b/xen-create-image index 36fe05c..1d3a914 100755 --- a/xen-create-image +++ b/xen-create-image @@ -291,7 +291,7 @@ Show the version number and exit. -- http://www.steve.org.uk/ - $Id: xen-create-image,v 1.62 2005-12-24 10:34:14 steve Exp $ + $Id: xen-create-image,v 1.63 2005-12-24 12:10:20 steve Exp $ =cut @@ -942,7 +942,7 @@ sub parseCommandLineArguments if ( $VERSION ) { - my $REVISION = '$Id: xen-create-image,v 1.62 2005-12-24 10:34:14 steve Exp $'; + my $REVISION = '$Id: xen-create-image,v 1.63 2005-12-24 12:10:20 steve Exp $'; $VERSION = join (' ', (split (' ', $REVISION))[2]); $VERSION =~ s/,v\b//; $VERSION =~ s/(\S+)$/$1/; @@ -1486,6 +1486,15 @@ sub runHooks { my ( $HOOK_DIR, $prefix ) = ( @_ ); + # + # Setup the environment for the child processes. + # + foreach my $key ( keys %CONFIG ) + { + $ENV{$key} = $CONFIG{$key}; + } + + # # Make sure that our scripts run in sorted order, as # the user would expect. @@ -1497,9 +1506,18 @@ sub runHooks # if ( ( -x $file ) && ( -f $file ) ) { - print "Running hook: $file\n"; + # + # Just display the name. + # + my $name = $file; + if ( $file =~ /(.*)\/(.*)/ ) + { + $name = $2; + } + + print "Running hook: $name\n"; runCommand( $file . " " . $prefix . " " . $CONFIG{'hostname'} ); - print "Done\n"; + print "Hook finished: $name\n"; } } }