27 |
# |
# |
28 |
#======================================================================== |
#======================================================================== |
29 |
# |
# |
30 |
# Version 2.1.0, released 20 Jun 2004. |
# Version 2.1.2, released 5 Sep 2005. |
31 |
# |
# |
32 |
# See http://backuppc.sourceforge.net. |
# See http://backuppc.sourceforge.net. |
33 |
# |
# |
313 |
# |
# |
314 |
my($nRead); |
my($nRead); |
315 |
#print("Reading $f->{name}, $f->{size} bytes, type $f->{type}\n"); |
#print("Reading $f->{name}, $f->{size} bytes, type $f->{type}\n"); |
316 |
|
pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $file, $f); |
317 |
my $poolWrite = BackupPC::PoolWrite->new($bpc, |
my $poolWrite = BackupPC::PoolWrite->new($bpc, |
318 |
"$OutDir/$ShareName/$f->{mangleName}", |
"$OutDir/$ShareName/$f->{mangleName}", |
319 |
$f->{size}, $Compress); |
$f->{size}, $Compress); |
351 |
# a plain file. |
# a plain file. |
352 |
# |
# |
353 |
$f->{size} = length($f->{linkname}); |
$f->{size} = length($f->{linkname}); |
354 |
|
pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $file, $f); |
355 |
my $poolWrite = BackupPC::PoolWrite->new($bpc, |
my $poolWrite = BackupPC::PoolWrite->new($bpc, |
356 |
"$OutDir/$ShareName/$f->{mangleName}", |
"$OutDir/$ShareName/$f->{mangleName}", |
357 |
$f->{size}, $Compress); |
$f->{size}, $Compress); |
369 |
# contents. |
# contents. |
370 |
# |
# |
371 |
$f->{size} = length($f->{linkname}); |
$f->{size} = length($f->{linkname}); |
372 |
|
pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $file, $f); |
373 |
my $poolWrite = BackupPC::PoolWrite->new($bpc, |
my $poolWrite = BackupPC::PoolWrite->new($bpc, |
374 |
"$OutDir/$ShareName/$f->{mangleName}", |
"$OutDir/$ShareName/$f->{mangleName}", |
375 |
$f->{size}, $Compress); |
$f->{size}, $Compress); |
393 |
} else { |
} else { |
394 |
$data = "$f->{devmajor},$f->{devminor}"; |
$data = "$f->{devmajor},$f->{devminor}"; |
395 |
} |
} |
396 |
|
pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $file, $f); |
397 |
my $poolWrite = BackupPC::PoolWrite->new($bpc, |
my $poolWrite = BackupPC::PoolWrite->new($bpc, |
398 |
"$OutDir/$ShareName/$f->{mangleName}", |
"$OutDir/$ShareName/$f->{mangleName}", |
399 |
length($data), $Compress); |
length($data), $Compress); |
482 |
$name); |
$name); |
483 |
} |
} |
484 |
|
|
485 |
|
# |
486 |
|
# Create the parent directory of $file if necessary |
487 |
|
# |
488 |
|
sub pathCreate |
489 |
|
{ |
490 |
|
my($dir, $fullPath, $file, $f) = @_; |
491 |
|
|
492 |
|
# |
493 |
|
# Get parent directory of each of $dir and $fullPath |
494 |
|
# |
495 |
|
$dir =~ s{/[^/]*$}{}; |
496 |
|
$fullPath =~ s{/[^/]*$}{}; |
497 |
|
return if ( -d $fullPath ); |
498 |
|
mkpath($fullPath, 0, 0777); |
499 |
|
$Attrib{$dir} = BackupPC::Attrib->new({ compress => $Compress }) |
500 |
|
if ( !defined($Attrib{$dir}) ); |
501 |
|
$Attrib{$dir}->set($file, { |
502 |
|
type => BPC_FTYPE_DIR, |
503 |
|
mode => 0755, |
504 |
|
uid => $f->{uid}, |
505 |
|
gid => $f->{gid}, |
506 |
|
size => 0, |
507 |
|
mtime => 0, |
508 |
|
}); |
509 |
|
} |
510 |
|
|
511 |
sub catch_signal |
sub catch_signal |
512 |
{ |
{ |
513 |
my $sigName = shift; |
my $sigName = shift; |