#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 2.1.2, released 5 Sep 2005.
#
# See http://backuppc.sourceforge.net.
#
use strict;
no utf8;
-use lib "/usr/local/BackupPC/lib";
+use lib "/usr/local/BackupPC2.1.0/lib";
use BackupPC::Lib;
use BackupPC::Attrib qw(:all);
use BackupPC::FileZIO;
#
my($nRead);
#print("Reading $f->{name}, $f->{size} bytes, type $f->{type}\n");
+ pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $file, $f);
my $poolWrite = BackupPC::PoolWrite->new($bpc,
"$OutDir/$ShareName/$f->{mangleName}",
$f->{size}, $Compress);
# a plain file.
#
$f->{size} = length($f->{linkname});
+ pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $file, $f);
my $poolWrite = BackupPC::PoolWrite->new($bpc,
"$OutDir/$ShareName/$f->{mangleName}",
$f->{size}, $Compress);
# contents.
#
$f->{size} = length($f->{linkname});
+ pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $file, $f);
my $poolWrite = BackupPC::PoolWrite->new($bpc,
"$OutDir/$ShareName/$f->{mangleName}",
$f->{size}, $Compress);
} else {
$data = "$f->{devmajor},$f->{devminor}";
}
+ pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $file, $f);
my $poolWrite = BackupPC::PoolWrite->new($bpc,
"$OutDir/$ShareName/$f->{mangleName}",
length($data), $Compress);
$name);
}
+#
+# Create the parent directory of $file if necessary
+#
+sub pathCreate
+{
+ my($dir, $fullPath, $file, $f) = @_;
+
+ #
+ # Get parent directory of each of $dir and $fullPath
+ #
+ $dir =~ s{/[^/]*$}{};
+ $fullPath =~ s{/[^/]*$}{};
+ return if ( -d $fullPath );
+ mkpath($fullPath, 0, 0777);
+ $Attrib{$dir} = BackupPC::Attrib->new({ compress => $Compress })
+ if ( !defined($Attrib{$dir}) );
+ $Attrib{$dir}->set($file, {
+ type => BPC_FTYPE_DIR,
+ mode => 0755,
+ uid => $f->{uid},
+ gid => $f->{gid},
+ size => 0,
+ mtime => 0,
+ });
+}
+
sub catch_signal
{
my $sigName = shift;