/[BackupPC]/trunk/bin/BackupPC_burnArchiveCLI
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_burnArchiveCLI

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

revision 341 by dpavlin, Tue Mar 7 10:06:52 2006 UTC revision 371 by iklaric, Mon May 7 08:48:47 2007 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl  #!/usr/local/bin/perl
2    
3  use strict;  use strict;
4  use lib "__INSTALLDIR__/lib";  use lib "/data/backuppc-agi//lib";
5    
6  use DBI;  use DBI;
7  use BackupPC::Lib;  use BackupPC::Lib;
# Line 12  use Term::Menus; Line 12  use Term::Menus;
12  use File::Which;  use File::Which;
13  use File::Path;  use File::Path;
14  use Filesys::Df;  use Filesys::Df;
15    use Cwd qw/abs_path/;
16  use Data::Dumper;  use Data::Dumper;
17    
18  my $debug = 0;  my $debug = 0;
# Line 33  $conf_bin->{'eject'} = $Conf{ejectBin} | Line 33  $conf_bin->{'eject'} = $Conf{ejectBin} |
33  my $eject_opts = $Conf{ejectOpts} || die "Need ejectOpts in config.pl\n";  my $eject_opts = $Conf{ejectOpts} || die "Need ejectOpts in config.pl\n";
34  $conf_bin->{'mkisofs'} = $Conf{mkisofsBin} || die "Need mkisofsBin in config.pl\n";  $conf_bin->{'mkisofs'} = $Conf{mkisofsBin} || die "Need mkisofsBin in config.pl\n";
35    
36    my $path = abs_path($0);
37    $path =~ s#/[^/]+$#/#;
38    my $tarIncCreate = $path .= 'BackupPC_tarIncCreate';
39    
40  my $bin;  my $bin;
41  foreach my $c (qw/cdrecord eject mkisofs/) {  foreach my $c (qw/cdrecord eject mkisofs/) {
# Line 394  foreach my $copy_nr ( 1 .. $copies ) { Line 397  foreach my $copy_nr ( 1 .. $copies ) {
397                          # this part                          # this part
398                          my $p = {                          my $p = {
399                                  filename => BackupPC::SearchLib::getGzipName($row->{'host'}, $row->{'share'}, $row->{'num'}),                                  filename => BackupPC::SearchLib::getGzipName($row->{'host'}, $row->{'share'}, $row->{'num'}),
400                                    host => $row->{'host'},
401                                    share => $row->{'share'},
402                                    num => $row->{'num'}
403                          };                          };
404                          foreach my $fld (qw/part_nr md5/) {                          foreach my $fld (qw/part_nr md5/) {
405                                  $p->{$fld} = $row->{$fld} || die "missing $fld in row!";                                  $p->{$fld} = $row->{$fld} || die "missing $fld in row!";
# Line 469  foreach my $copy_nr ( 1 .. $copies ) { Line 475  foreach my $copy_nr ( 1 .. $copies ) {
475                                          }                                          }
476                                          $rel_path .= '.tar.gz';                                          $rel_path .= '.tar.gz';
477    
478                                          skip "can't find increment $rel_path: $!" unless (-r "$tar_dir/$rel_path");                                          
479                                            unless (-r "$tar_dir/$rel_path") {
480                                                    print "WARNING: can't find increment $rel_path , trying to recreate it using BackupPC_tarIncCreate...\n";
481                                                    my $host = $p->{host};
482                                                    my $share = $p->{share};
483                                                    my $dump = $p->{num};
484                                                    
485                                                    my $cmd = $tarIncCreate. " -h $host -s $share -n $dump";
486                                                    print "$cmd ";
487                                                    if (system($cmd) != 0) {
488                                                            print " FAILED.\n";
489                                                    } else {
490                                                            print " done.\n";
491                                                    }
492                                            }
493    
494                                            skip "can't find increment $rel_path, recreateing obviously did not work: $!" unless (-r "$tar_dir/$rel_path");
495                                            
496                                          add_symlink("$tar_dir/$rel_path", "$stage/$rel_path");                                          add_symlink("$tar_dir/$rel_path", "$stage/$rel_path");
497    
498                                          my $md5sum = $p->{md5} || die "no md5 in part ", Dumper($p);                                          my $md5sum = $p->{md5} || die "no md5 in part ", Dumper($p);
# Line 514  foreach my $copy_nr ( 1 .. $copies ) { Line 536  foreach my $copy_nr ( 1 .. $copies ) {
536    
537                          print "\nREADY TO BURN MEDIA $disk_name copy $copy_nr\n\nPlease insert blank media and press ENTER\n\n";                          print "\nREADY TO BURN MEDIA $disk_name copy $copy_nr\n\nPlease insert blank media and press ENTER\n\n";
538    
539                            die("debugging only!");
540    
541                          system($bin->{'eject'}.' '.$eject_opts) == 0 or skip "can't run eject: $?";                          system($bin->{'eject'}.' '.$eject_opts) == 0 or skip "can't run eject: $?";
542    
543                          my $wait = <STDIN>;                          my $wait = <STDIN>;

Legend:
Removed from v.341  
changed lines
  Added in v.371

  ViewVC Help
Powered by ViewVC 1.1.26