From a7046122194dd05c674d2ef21101bceb36e1a455 Mon Sep 17 00:00:00 2001 From: steve Date: Sat, 11 Mar 2006 21:37:04 +0000 Subject: [PATCH] 2006-03-11 21:37:04 by steve BUGFIX: .deb file caching now works as expected. --- xen-create-image | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/xen-create-image b/xen-create-image index 453cab4..b4f8a43 100755 --- a/xen-create-image +++ b/xen-create-image @@ -402,7 +402,7 @@ Install an X11 server, using VNC and XDM -- http://www.steve.org.uk/ - $Id: xen-create-image,v 1.105 2006-03-11 20:57:12 steve Exp $ + $Id: xen-create-image,v 1.106 2006-03-11 21:37:04 steve Exp $ =cut @@ -764,6 +764,24 @@ my $debootstrap = "debootstrap $CONFIG{'debootstrap'} $CONFIG{'dist'} $dir $CONF runCommandWithProgress( $debootstrap ); +# +# Copy the newly installed files from the virtual image to the host, +# these will then be copied back the next time an image is created. +# +# Big win. +# +# NOTE: We do before running any hook or role scripts. This might +# not be ideal, but it avoids problems if any of those scripts run +# "apt-get clean" inside the new instance. +# +if ( $CONFIG{'cache'} eq "yes" ) +{ + print "\n\nCaching debootstrap files to the host system\n"; + copyDebFiles( "$dir/var/cache/apt/archives", "/var/cache/apt/archives/" ); + printWideMessage( "\rDone" ); +} + + # # Now run any hook scripts post-install. These will be the ones # we ship to setup the new image, or any local additions. @@ -789,22 +807,6 @@ if ( $CONFIG{'role'} ) -# -# Copy the newly installed files from the virtual image to the host, -# these will then be copied back the next time an image is created. -# -# Big win. -# -# NOTE: We do this after running any hook or role scripts, to ensure -# that any packages installed by either may be cached successfully. -# -if ( $CONFIG{'cache'} eq "yes" ) -{ - print "\n\nCaching debootstrap files to the host system\n"; - copyDebFiles( "$dir/var/cache/apt/archives", "/var/cache/apt/archives/" ); - printWideMessage( "\rDone" ); -} - # # We can not run this through hooks since it's interactive @@ -1005,7 +1007,7 @@ sub parseCommandLineArguments if ( $VERSION ) { - my $REVISION = '$Revision: 1.105 $'; + my $REVISION = '$Revision: 1.106 $'; if ( $REVISION =~ /1.([0-9.]+) / ) {