diff options
author | Tao Wang <twang2218@gmail.com> | 2017-01-04 06:26:27 +0300 |
---|---|---|
committer | Benjamin Drung <benjamin.drung@profitbricks.com> | 2017-01-06 19:21:44 +0300 |
commit | e56928ef36ff04d328e4eecf268f04679b1e426e (patch) | |
tree | 8f84cf1f1281879948166f3221f41f5d02a29883 | |
parent | e63ef059b09651f8a37eb76e1189fef0bcb39285 (diff) |
Create directories including their parents
apt-mirror fails when the base_path does not exist. Create the
directories including their parents by replacing mkdir and mkpath with
make_path.
Signed-off-by: Tao Wang <twang2218@gmail.com>
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
-rwxr-xr-x | apt-mirror | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -91,7 +91,7 @@ use warnings; use strict; use File::Copy; use File::Compare; -use File::Path; +use File::Path qw(make_path); use File::Basename; use Fcntl qw(:flock); @@ -351,7 +351,7 @@ foreach my $needed_directory (@needed_directories) { unless ( -d $needed_directory ) { - mkdir($needed_directory) or die("apt-mirror: can't create $needed_directory directory"); + make_path($needed_directory) or die("apt-mirror: can't create $needed_directory directory"); } } # @@ -904,7 +904,7 @@ sub copy_file my ( $from, $to ) = @_; my $dir = dirname($to); return unless -f $from; - mkpath($dir) unless -d $dir; + make_path($dir) unless -d $dir; if ( get_variable("unlink") == 1 ) { if ( compare( $from, $to ) != 0 ) { unlink($to); } |