/[BackupPC]/trunk/bin/BackupPC_tarIncCreate
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_tarIncCreate

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

revision 169 by dpavlin, Mon Oct 10 14:12:33 2005 UTC revision 251 by dpavlin, Mon Dec 12 12:16:01 2005 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl  #!/usr/bin/perl -w
2  #============================================================= -*-perl-*-  #============================================================= -*-perl-*-
3  #  #
4  # BackupPC_tarIncCreate: create a tar archive of an existing incremental dump  # BackupPC_tarIncCreate: create a tar archive of an existing incremental dump
# Line 72  use BackupPC::View; Line 72  use BackupPC::View;
72  use BackupPC::SearchLib;  use BackupPC::SearchLib;
73  use Time::HiRes qw/time/;  use Time::HiRes qw/time/;
74  use POSIX qw/strftime/;  use POSIX qw/strftime/;
75    use File::Which;
76    use File::Path;
77    use File::Slurp;
78  use Data::Dumper;       ### FIXME  use Data::Dumper;       ### FIXME
79    
80  die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );  die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
81  my $TopDir = $bpc->TopDir();  my $TopDir = $bpc->TopDir();
82  my $BinDir = $bpc->BinDir();  my $BinDir = $bpc->BinDir();
83  my %Conf   = $bpc->Conf();  my %Conf   = $bpc->Conf();
84    %BackupPC::SearchLib::Conf = %Conf;
85  my %opts;  my %opts;
86  my $in_backup_increment;  my $in_backup_increment;
87    
88    
89  if ( !getopts("th:n:p:r:s:b:w:v", \%opts) ) {  if ( !getopts("th:n:p:r:s:b:w:vd", \%opts) ) {
90      print STDERR <<EOF;      print STDERR <<EOF;
91  usage: $0 [options]  usage: $0 [options]
92    Required options:    Required options:
# Line 99  usage: $0 [options] Line 103  usage: $0 [options]
103       -b BLOCKS       BLOCKS x 512 bytes per record (default 20; same as tar)       -b BLOCKS       BLOCKS x 512 bytes per record (default 20; same as tar)
104       -w writeBufSz   write buffer size (default 1048576 = 1MB)       -w writeBufSz   write buffer size (default 1048576 = 1MB)
105       -v              verbose output       -v              verbose output
106         -d              debug output
107  EOF  EOF
108      exit(1);      exit(1);
109  }  }
110    
111  if ( $opts{h} !~ /^([\w\.\s-]+)$/ ) {  if ( $opts{h} !~ /^([\w\.\s-]+)$/ ) {
112      print(STDERR "$0: bad host name '$opts{h}'\n");      die "$0: bad host name '$opts{h}'\n";
     exit(1);  
113  }  }
114  my $Host = $opts{h};  my $Host = $opts{h};
115    
116  if ( $opts{n} !~ /^(-?\d+)$/ ) {  if ( $opts{n} !~ /^(-?\d+)$/ ) {
117      print(STDERR "$0: bad dump number '$opts{n}'\n");      die "$0: bad dump number '$opts{n}'\n";
     exit(1);  
118  }  }
119  my $Num = $opts{n};  my $Num = $opts{n};
120    
121    my $bin;
122    foreach my $c (qw/gzip md5sum tee/) {
123            $bin->{$c} = which($c) || die "$0 needs $c, install it\n";
124    }
125    
126  my @Backups = $bpc->BackupInfoRead($Host);  my @Backups = $bpc->BackupInfoRead($Host);
127  my $FileCnt = 0;  my $FileCnt = 0;
128  my $ByteCnt = 0;  my $ByteCnt = 0;
129  my $DirCnt = 0;  my $DirCnt = 0;
130  my $SpecialCnt = 0;  my $SpecialCnt = 0;
131  my $ErrorCnt = 0;  my $ErrorCnt = 0;
132    my $current_tar_size = 0;
133    my $total_increment_size = 0;
134    
135  my $i;  my $i;
136  $Num = $Backups[@Backups + $Num]{num} if ( -@Backups <= $Num && $Num < 0 );  $Num = $Backups[@Backups + $Num]{num} if ( -@Backups <= $Num && $Num < 0 );
# Line 128  for ( $i = 0 ; $i < @Backups ; $i++ ) { Line 138  for ( $i = 0 ; $i < @Backups ; $i++ ) {
138      last if ( $Backups[$i]{num} == $Num );      last if ( $Backups[$i]{num} == $Num );
139  }  }
140  if ( $i >= @Backups ) {  if ( $i >= @Backups ) {
141      print(STDERR "$0: bad backup number $Num for host $Host\n");      die "$0: bad backup number $Num for host $Host\n";
     exit(1);  
142  }  }
143    
144  my $PathRemove = $1 if ( $opts{r} =~ /(.+)/ );  my $PathRemove = $1 if ( $opts{r} =~ /(.+)/ );
145  my $PathAdd    = $1 if ( $opts{p} =~ /(.+)/ );  my $PathAdd    = $1 if ( $opts{p} =~ /(.+)/ );
146  if ( $opts{s} !~ /^([\w\s\.\/\$-]+)$/ && $opts{s} ne "*" ) {  if ( $opts{s} !~ /^([\w\s\.\/\$-]+)$/ && $opts{s} ne "*" ) {
147      print(STDERR "$0: bad share name '$opts{s}'\n");      die "$0: bad share name '$opts{s}'\n";
     exit(1);  
148  }  }
149  our $ShareName = $opts{s};  our $ShareName = $opts{s};
150  our $view = BackupPC::View->new($bpc, $Host, \@Backups);  our $view = BackupPC::View->new($bpc, $Host, \@Backups);
151    
152    # database
153    
154    my $dsn = $Conf{SearchDSN};
155    my $db_user = $Conf{SearchUser} || '';
156    
157    my $dbh = DBI->connect($dsn, $db_user, "", { RaiseError => 1, AutoCommit => 0} );
158    
159    my $sth_inc_size = $dbh->prepare(qq{
160            update backups set
161                    inc_size = ?,
162                    parts = ?,
163                    inc_deleted = false
164            where id = ?
165    });
166    my $sth_backup_parts = $dbh->prepare(qq{
167            insert into backup_parts (
168                    backup_id,
169                    part_nr,
170                    tar_size,
171                    size,
172                    md5,
173                    items
174            ) values (?,?,?,?,?,?)
175    });
176    
177  #  #
178  # This constant and the line of code below that uses it are borrowed  # This constant and the line of code below that uses it are borrowed
179  # from Archive::Tar.  Thanks to Calle Dybedahl and Stephen Zander.  # from Archive::Tar.  Thanks to Calle Dybedahl and Stephen Zander.
# Line 163  my(%HardLinkExtraFiles, @HardLinks); Line 196  my(%HardLinkExtraFiles, @HardLinks);
196  #  #
197  # Write out all the requested files/directories  # Write out all the requested files/directories
198  #  #
199  binmode(STDOUT);  
200  my $fh = *STDOUT;  my $max_file_size = $Conf{'MaxArchiveFileSize'} || die "problem with MaxArchiveFileSize parametar";
201    $max_file_size *= 1024;
202    
203    my $tar_dir = $Conf{InstallDir}.'/'.$Conf{GzipTempDir};
204    die "problem with $tar_dir, check GzipTempDir in configuration\n" unless (-d $tar_dir && -w $tar_dir);
205    
206    my $tar_file = BackupPC::SearchLib::getGzipName($Host, $ShareName, $Num) || die "can't getGzipName($Host, $ShareName, $Num)";
207    
208    my $tar_path_final = $tar_dir . '/' . $tar_file;
209    my $tar_path = $tar_path_final . '.tmp';
210    
211    $tar_path =~ s#//#/#g;
212    
213    my $sth = $dbh->prepare(qq{
214            SELECT
215                    backups.id
216            FROM backups
217                    JOIN shares on shares.id = shareid
218                    JOIN hosts on hosts.id = shares.hostid
219            WHERE hosts.name = ? and shares.name = ? and backups.num = ?
220    });
221    $sth->execute($Host, $ShareName, $Num);
222    my ($backup_id) = $sth->fetchrow_array;
223    $sth->finish;
224    
225    print STDERR "backup_id: $backup_id working dir: $tar_dir, max uncompressed size $max_file_size bytes, tar $tar_file\n" if ($opts{d});
226    
227    
228    my $fh;
229    my $part = 0;
230    my $no_files = 0;
231    my $items_in_part = 0;
232    
233    sub new_tar_part {
234            my $arg = {@_};
235    
236            if ($fh) {
237                    return if ($current_tar_size == 0);
238    
239                    print STDERR " $part" if ($opts{v});
240    
241                    #
242                    # Finish with two null 512 byte headers,
243                    # and then round out a full block.
244                    #
245                    my $data = "\0" x ($tar_header_length * 2);
246                    TarWrite($fh, \$data);
247                    TarWrite($fh, undef);
248    
249                    close($fh) || die "can't close archive part $part: $!";
250    
251                    my $file = $tar_path . '/' . $part;
252    
253                    my $md5 = read_file( $file . '.md5' ) || die "can't read md5sum file ${file}.md5";
254                    $md5 =~ s/\s.*$//;
255    
256                    my $size = (stat( $file . '.tar.gz' ))[7] || die "can't stat ${file}.tar.gz";
257    
258                    $sth_backup_parts->execute(
259                            $backup_id,
260                            $part,
261                            $current_tar_size,
262                            $size,
263                            $md5,
264                            $items_in_part,
265                    );
266    
267                    $total_increment_size += int( ( $size + 1023 ) / 1024 ) * 1024;
268    
269                    if ($arg->{close}) {
270    
271                            if ($part == 1) {
272                                    print STDERR " single";
273                                    rename "${tar_path}/1.tar.gz", "${tar_path_final}/.tar.gz" || die "can't move tar ${tar_path}: $! ";
274                                    rename "${tar_path}/1.md5", "${tar_path_final}/.md5" || die "can't move md5 ${tar_path}: $! ";
275                            } else {
276                                    print STDERR " [last]";
277                                    rename "${tar_path}", "${tar_path_final}" || die "can't move tar ${tar_path}: $! ";
278                            }
279    
280                            $sth_inc_size->execute(
281                                    $total_increment_size,
282                                    $part,
283                                    $backup_id
284                            );
285    
286                            print STDERR ", $total_increment_size bytes\n" if ($opts{v});
287    
288                            return;
289                    }
290    
291            }
292    
293            $part++;
294    
295            # if this is first part, create directory
296    
297            if ($part == 1) {
298                    if (-d $tar_path) {
299                            print STDERR "# deleting existing $tar_path\n" if ($opts{d});
300                            rmtree($tar_path);
301                    }
302                    mkdir($tar_path) || die "can't create directory $tar_path: $!";
303    
304                    sub abort_cleanup {
305                            print STDERR "ABORTED: cleanup temp dir";
306                            rmtree($tar_path);
307                            $dbh->rollback;
308                            exit 1;
309                    }
310    
311                    $SIG{'INT'}  = \&abort_cleanup;
312                    $SIG{'QUIT'} = \&abort_cleanup;
313                    $SIG{'__DIE__'} = \&abort_cleanup;
314    
315            }
316    
317            my $file = $tar_path . '/' . $part;
318    
319            #
320            # create comprex pipe which will pass output through gzip
321            # for compression, create file on disk using tee
322            # and pipe same output to md5sum to create checksum
323            #
324    
325            my $cmd = '| ' . $bin->{'gzip'}   . ' ' . $Conf{GzipLevel} .      ' ' .
326                      '| ' . $bin->{'tee'}    . ' ' . $file . '.tar.gz' . ' ' .
327                      '| ' . $bin->{'md5sum'} . ' - > ' . $file . '.md5';
328    
329            print STDERR "## $cmd\n" if ($opts{d});
330    
331            open($fh, $cmd) or die "can't open $cmd: $!";
332            binmode($fh);
333    
334            $current_tar_size = 0;
335            $items_in_part = 0;
336    }
337    
338    new_tar_part();
339    
340  if (seedCache($Host, $ShareName, $Num)) {  if (seedCache($Host, $ShareName, $Num)) {
341          archiveWrite($fh, '/');          archiveWrite($fh, '/');
342          archiveWriteHardLinks($fh);          archiveWriteHardLinks($fh);
343  } else {  } else {
344          print STDERR "NOTE: no files found for $Host:$ShareName, increment $Num\n" if ($opt{v});          print STDERR "NOTE: no files found for $Host:$ShareName, increment $Num\n" if ($opts{v});
345            $no_files = 1;
346  }  }
347    
348  #  new_tar_part( close => 1 );
349  # Finish with two null 512 byte headers, and then round out a full  
350  # block.  # remove temporary files if there are no files
351  #  if ($no_files) {
352  my $data = "\0" x ($tar_header_length * 2);          rmtree($tar_path);
353  TarWrite($fh, \$data);  } elsif ($part == 1) {
354  TarWrite($fh, undef);          warn "FIXME: if there is only one part move to parent directory and rename";
355    }
356    
357  #  #
358  # print out totals if requested  # print out totals if requested
# Line 193  if ( $ErrorCnt && !$FileCnt && !$DirCnt Line 366  if ( $ErrorCnt && !$FileCnt && !$DirCnt
366      # Got errors, with no files or directories; exit with non-zero      # Got errors, with no files or directories; exit with non-zero
367      # status      # status
368      #      #
369      exit(1);      die "got errors or no files\n";
370  }  }
371  exit(0);  
372    $sth_inc_size->finish;
373    $sth_backup_parts->finish;
374    
375    $dbh->commit || die "can't commit changes to database";
376    $dbh->disconnect();
377    
378    exit;
379    
380  ###########################################################################  ###########################################################################
381  # Subroutines  # Subroutines
# Line 260  sub TarWrite Line 440  sub TarWrite
440  {  {
441      my($fh, $dataRef) = @_;      my($fh, $dataRef) = @_;
442    
443    
444      if ( !defined($dataRef) ) {      if ( !defined($dataRef) ) {
445          #          #
446          # do flush by padding to a full $WriteBufSz          # do flush by padding to a full $WriteBufSz
# Line 267  sub TarWrite Line 448  sub TarWrite
448          my $data = "\0" x ($WriteBufSz - length($WriteBuf));          my $data = "\0" x ($WriteBufSz - length($WriteBuf));
449          $dataRef = \$data;          $dataRef = \$data;
450      }      }
451    
452        # poor man's tell :-)
453        $current_tar_size += length($$dataRef);
454    
455      if ( length($WriteBuf) + length($$dataRef) < $WriteBufSz ) {      if ( length($WriteBuf) + length($$dataRef) < $WriteBufSz ) {
456          #          #
457          # just buffer and return          # just buffer and return
# Line 277  sub TarWrite Line 462  sub TarWrite
462      my $done = $WriteBufSz - length($WriteBuf);      my $done = $WriteBufSz - length($WriteBuf);
463      if ( syswrite($fh, $WriteBuf . substr($$dataRef, 0, $done))      if ( syswrite($fh, $WriteBuf . substr($$dataRef, 0, $done))
464                                  != $WriteBufSz ) {                                  != $WriteBufSz ) {
465          print(STDERR "Unable to write to output file ($!)\n");          die "Unable to write to output file ($!)\n";
         exit(1);  
466      }      }
467      while ( $done + $WriteBufSz <= length($$dataRef) ) {      while ( $done + $WriteBufSz <= length($$dataRef) ) {
468          if ( syswrite($fh, substr($$dataRef, $done, $WriteBufSz))          if ( syswrite($fh, substr($$dataRef, $done, $WriteBufSz))
469                              != $WriteBufSz ) {                              != $WriteBufSz ) {
470              print(STDERR "Unable to write to output file ($!)\n");              die "Unable to write to output file ($!)\n";
             exit(1);  
471          }          }
472          $done += $WriteBufSz;          $done += $WriteBufSz;
473      }      }
# Line 389  sub TarWriteFileInfo Line 572  sub TarWriteFileInfo
572  sub seedCache($$$) {  sub seedCache($$$) {
573          my ($host, $share, $dumpNo) = @_;          my ($host, $share, $dumpNo) = @_;
574    
575          my $dsn = $Conf{SearchDSN};          print STDERR curr_time(), "$host:$share #$dumpNo" if ($opts{v});
         my $db_user = $Conf{SearchUser} || '';  
           
         print STDERR curr_time(), "getting files for $host:$share increment $dumpNo..." if ($opts{v});  
576          my $sql = q{          my $sql = q{
577                  SELECT path                  SELECT path,size
578                  FROM files                  FROM files
579                          JOIN shares on shares.id = shareid                          JOIN shares on shares.id = shareid
580                          JOIN hosts on hosts.id = shares.hostid                          JOIN hosts on hosts.id = shares.hostid
581                  WHERE hosts.name = ? and shares.name = ? and backupnum = ?                  WHERE hosts.name = ? and shares.name = ? and backupnum = ?
582          };          };
583    
         my $dbh = DBI->connect($dsn, $db_user, "", { RaiseError => 1, AutoCommit => 1} );        
584          my $sth = $dbh->prepare($sql);            my $sth = $dbh->prepare($sql);  
585          $sth->execute($host, $share, $dumpNo);          $sth->execute($host, $share, $dumpNo);
586          my $count = $sth->rows;          my $count = $sth->rows;
587          print STDERR " found $count items\n" if ($opts{v});          print STDERR " $count items, parts:" if ($opts{v});
588          while (my $row = $sth->fetchrow_arrayref) {          while (my $row = $sth->fetchrow_arrayref) {
589  #print STDERR "+ ", $row->[0],"\n";  #print STDERR "+ ", $row->[0],"\n";
590                  $in_backup_increment->{ $row->[0] }++;                  $in_backup_increment->{ $row->[0] } = $row->[1];
591          }          }
592                    
593          $sth->finish();          $sth->finish();
         $dbh->disconnect();  
594    
595          return $count;          return $count;
596  }  }
597    
598    #
599    # calculate overhad for one file in tar
600    #
601    sub tar_overhead($) {
602            my $name = shift || '';
603    
604            # header, padding of file and two null blocks at end
605            my $len = 4 * $tar_header_length;
606    
607            # if filename is longer than 99 chars subtract blocks for
608            # long filename
609            if ( length($name) > 99 ) {
610                    $len += int( ( length($name) + $tar_header_length ) / $tar_header_length ) * $tar_header_length;
611            }
612    
613            return $len;
614    }
615    
616  my $Attr;  my $Attr;
617  my $AttrDir;  my $AttrDir;
618    
# Line 429  sub TarWriteFile Line 625  sub TarWriteFile
625    
626      $tarPath =~ s{//+}{/}g;      $tarPath =~ s{//+}{/}g;
627    
628  #print STDERR "? $tarPath\n";      #print STDERR "? $tarPath\n" if ($opts{d});
629      return unless ($in_backup_increment->{$tarPath});      my $size = $in_backup_increment->{$tarPath};
630  #print STDERR "A $tarPath\n";      return unless (defined($size));
631    
632        # is this file too large to fit into MaxArchiveFileSize?
633    
634        if ( ($current_tar_size + tar_overhead($tarPath) + $size) > $max_file_size ) {
635            print STDERR "# tar file $current_tar_size + $tar_header_length + $size > $max_file_size, splitting\n" if ($opts{d});
636            new_tar_part();
637        }
638    
639        #print STDERR "A $tarPath [$size] tell: $current_tar_size\n" if ($opts{d});
640        $items_in_part++;
641    
642      if ( defined($PathRemove)      if ( defined($PathRemove)
643              && substr($tarPath, 0, length($PathRemove)) eq $PathRemove ) {              && substr($tarPath, 0, length($PathRemove)) eq $PathRemove ) {
# Line 445  sub TarWriteFile Line 651  sub TarWriteFile
651          #          #
652          # Directory: just write the header          # Directory: just write the header
653          #          #
           
                   
654          $hdr->{name} .= "/" if ( $hdr->{name} !~ m{/$} );          $hdr->{name} .= "/" if ( $hdr->{name} !~ m{/$} );
655          TarWriteFileInfo($fh, $hdr);          TarWriteFileInfo($fh, $hdr);
656          $DirCnt++;          $DirCnt++;
# Line 460  sub TarWriteFile Line 664  sub TarWriteFile
664              $ErrorCnt++;              $ErrorCnt++;
665              return;              return;
666          }          }
667          TarWriteFileInfo($fh, $hdr);          # do we need to split file?
668          my($data, $size);          if ($hdr->{size} < $max_file_size) {
669          while ( $f->read(\$data, $BufSize) > 0 ) {                  TarWriteFileInfo($fh, $hdr);
670              TarWrite($fh, \$data);                  my($data, $size);
671              $size += length($data);                  while ( $f->read(\$data, $BufSize) > 0 ) {
672          }                      TarWrite($fh, \$data);
673          $f->close;                      $size += length($data);
674          TarWritePad($fh, $size);                  }
675                    $f->close;
676                    TarWritePad($fh, $size);
677                  $FileCnt++;                  $FileCnt++;
678                  $ByteCnt += $size;                  $ByteCnt += $size;
679            } else {
680                    my $full_size = $hdr->{size};
681                    my $orig_name = $hdr->{name};
682                    my $max_part_size = $max_file_size - tar_overhead($hdr->{name});
683    
684                    my $parts = int(($full_size + $max_part_size - 1) / $max_part_size);
685                    print STDERR "# splitting $orig_name [$full_size bytes] into $parts parts\n" if ($opts{d});
686                    foreach my $subpart ( 1 .. $parts ) {
687                            new_tar_part();
688                            if ($subpart < $parts) {
689                                    $hdr->{size} = $max_part_size;
690                            } else {
691                                    $hdr->{size} = $full_size % $max_part_size;
692                            }
693                            $hdr->{name} = $orig_name . '/' . $subpart;
694                            print STDERR "## creating part $subpart ",$hdr->{name}, " [", $hdr->{size}," bytes]\n";
695    
696                            TarWriteFileInfo($fh, $hdr);
697                            my($data, $size);
698    if (0) {
699                            for ( 1 .. int($hdr->{size} / $BufSize) ) {
700                                    my $r_size = $f->read(\$data, $BufSize);
701                                    die "expected $BufSize bytes read, got $r_size bytes!" if ($r_size != $BufSize);
702                                    TarWrite($fh, \$data);
703                                    $size += length($data);
704                            }
705    }
706                            my $size_left = $hdr->{size} % $BufSize;
707                            my $r_size = $f->read(\$data, $size_left);
708                            die "expected $size_left bytes last read, got $r_size bytes!" if ($r_size != $size_left);
709    
710                            TarWrite($fh, \$data);
711                            $size += length($data);
712                            TarWritePad($fh, $size);
713    
714                            $items_in_part++;
715                    }
716                    $f->close;
717                    $FileCnt++;
718                    $ByteCnt += $full_size;
719                    new_tar_part();
720            }
721      } elsif ( $hdr->{type} == BPC_FTYPE_HARDLINK ) {      } elsif ( $hdr->{type} == BPC_FTYPE_HARDLINK ) {
722          #          #
723          # Hardlink file: either write a hardlink or the complete file          # Hardlink file: either write a hardlink or the complete file
724                  # depending upon whether the linked-to file will be written          # depending upon whether the linked-to file will be written
725                  # to the archive.          # to the archive.
726          #          #
727                  # Start by reading the contents of the link.          # Start by reading the contents of the link.
728                  #          #
729          my $f = BackupPC::FileZIO->open($hdr->{fullPath}, 0, $hdr->{compress});          my $f = BackupPC::FileZIO->open($hdr->{fullPath}, 0, $hdr->{compress});
730          if ( !defined($f) ) {          if ( !defined($f) ) {
731              print(STDERR "Unable to open file $hdr->{fullPath}\n");              print(STDERR "Unable to open file $hdr->{fullPath}\n");
# Line 488  sub TarWriteFile Line 736  sub TarWriteFile
736          while ( $f->read(\$data, $BufSize) > 0 ) {          while ( $f->read(\$data, $BufSize) > 0 ) {
737              $hdr->{linkname} .= $data;              $hdr->{linkname} .= $data;
738          }          }
739                  $f->close;          $f->close;
740                  my $done = 0;          my $done = 0;
741                  my $name = $hdr->{linkname};          my $name = $hdr->{linkname};
742                  $name =~ s{^\./}{/};          $name =~ s{^\./}{/};
743                  if ( $HardLinkExtraFiles{$name} ) {          if ( $HardLinkExtraFiles{$name} ) {
744                      #              #
745                      # Target file will be or was written, so just remember              # Target file will be or was written, so just remember
746                      # the hardlink so we can dump it later.              # the hardlink so we can dump it later.
747                      #              #
748                      push(@HardLinks, $hdr);              push(@HardLinks, $hdr);
749                      $SpecialCnt++;              $SpecialCnt++;
750                  } else {          } else {
751                      #              #
752                      # Have to dump the original file.  Just call the top-level              # Have to dump the original file.  Just call the top-level
753                      # routine, so that we save the hassle of dealing with              # routine, so that we save the hassle of dealing with
754                      # mangling, merging and attributes.              # mangling, merging and attributes.
755                      #              #
756                      $HardLinkExtraFiles{$hdr->{linkname}} = 1;              $HardLinkExtraFiles{$hdr->{linkname}} = 1;
757                      archiveWrite($fh, $hdr->{linkname}, $hdr->{name});              archiveWrite($fh, $hdr->{linkname}, $hdr->{name});
758                  }          }
759      } elsif ( $hdr->{type} == BPC_FTYPE_SYMLINK ) {      } elsif ( $hdr->{type} == BPC_FTYPE_SYMLINK ) {
760          #          #
761          # Symbolic link: read the symbolic link contents into the header          # Symbolic link: read the symbolic link contents into the header

Legend:
Removed from v.169  
changed lines
  Added in v.251

  ViewVC Help
Powered by ViewVC 1.1.26