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; |
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; |
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/) { |
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!"; |
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); |
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>; |