-#!/usr/bin/perl
+#!/usr/local/bin/perl
use strict;
-use lib "__INSTALLDIR__/lib";
+use lib "/data/backuppc-agi//lib";
use DBI;
use BackupPC::Lib;
use File::Which;
use File::Path;
use Filesys::Df;
-
+use Cwd qw/abs_path/;
use Data::Dumper;
my $debug = 0;
my $eject_opts = $Conf{ejectOpts} || die "Need ejectOpts in config.pl\n";
$conf_bin->{'mkisofs'} = $Conf{mkisofsBin} || die "Need mkisofsBin in config.pl\n";
+my $path = abs_path($0);
+$path =~ s#/[^/]+$#/#;
+my $tarIncCreate = $path .= 'BackupPC_tarIncCreate';
my $bin;
foreach my $c (qw/cdrecord eject mkisofs/) {
# this part
my $p = {
filename => BackupPC::SearchLib::getGzipName($row->{'host'}, $row->{'share'}, $row->{'num'}),
+ host => $row->{'host'},
+ share => $row->{'share'},
+ num => $row->{'num'}
};
foreach my $fld (qw/part_nr md5/) {
$p->{$fld} = $row->{$fld} || die "missing $fld in row!";
}
$rel_path .= '.tar.gz';
- skip "can't find increment $rel_path: $!" unless (-r "$tar_dir/$rel_path");
+
+ unless (-r "$tar_dir/$rel_path") {
+ print "WARNING: can't find increment $rel_path , trying to recreate it using BackupPC_tarIncCreate...\n";
+ my $host = $p->{host};
+ my $share = $p->{share};
+ my $dump = $p->{num};
+
+ my $cmd = $tarIncCreate. " -h $host -s $share -n $dump";
+ print "$cmd ";
+ if (system($cmd) != 0) {
+ print " FAILED.\n";
+ } else {
+ print " done.\n";
+ }
+ }
+ skip "can't find increment $rel_path, recreateing obviously did not work: $!" unless (-r "$tar_dir/$rel_path");
+
add_symlink("$tar_dir/$rel_path", "$stage/$rel_path");
my $md5sum = $p->{md5} || die "no md5 in part ", Dumper($p);
print "\nREADY TO BURN MEDIA $disk_name copy $copy_nr\n\nPlease insert blank media and press ENTER\n\n";
+ die("debugging only!");
+
system($bin->{'eject'}.' '.$eject_opts) == 0 or skip "can't run eject: $?";
my $wait = <STDIN>;