1
0
mirror of synced 2026-02-05 07:24:49 +00:00

Create .deb cache directory on systems lacking one

This patch creates a cache directory on systems which do
not have a /var/cache/apt/archives/ directory. Currently
it creates a /var/cache/xen-tools/archives/ directory,
however this can easily be set to a variable which is
parsed from the configuration file.
This commit is contained in:
Dmitry Nedospasov
2010-06-02 15:32:27 +02:00
parent 3fd6e4c941
commit 04acc115ab

View File

@@ -702,6 +702,7 @@ sub do_debootstrap
# to use cdebootstrap.
#
my $cmd = $CONFIG{ 'debootstrap-cmd' };
my $cachepath = '/var/cache/apt/archives/';
if ( !$cmd )
{
if (-x '/usr/sbin/debootstrap') {
@@ -723,8 +724,12 @@ sub do_debootstrap
if ( $CONFIG{ 'cache' } eq "yes" )
{
print "\nCopying files from host to image.\n";
unless( -d $cachepath ) {
$cachepath = '/var/cache/xen-tools/archives';
system "mkdir -p $cachepath";
}
runCommand("mkdir -p $CONFIG{'location'}/var/cache/apt/archives");
copyDebFiles( "/var/cache/apt/archives",
copyDebFiles( "$cachepath",
"$CONFIG{'location'}/var/cache/apt/archives" );
print("Done\n");
}
@@ -767,7 +772,7 @@ sub do_debootstrap
{
print "\nCopying files from new installation to host.\n";
copyDebFiles( "$CONFIG{'location'}/var/cache/apt/archives",
"/var/cache/apt/archives" );
"$cachepath" );
print("Done\n");
}