/[BackupPC]/trunk/bin/BackupPC_tarExtract
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/BackupPC_tarExtract

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 315 by dpavlin, Wed Jun 22 19:12:42 2005 UTC revision 316 by dpavlin, Mon Jan 30 13:37:17 2006 UTC
# Line 27  Line 27 
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  #  #
# Line 313  sub TarReadFile Line 313  sub TarReadFile
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);
# Line 350  sub TarReadFile Line 351  sub TarReadFile
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);
# Line 367  sub TarReadFile Line 369  sub TarReadFile
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);
# Line 390  sub TarReadFile Line 393  sub TarReadFile
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);
# Line 478  sub logFileAction Line 482  sub logFileAction
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;

Legend:
Removed from v.315  
changed lines
  Added in v.316

  ViewVC Help
Powered by ViewVC 1.1.26