warning for DVDs with corrupt data
[BackupPC.git] / bin / BackupPC_burnArchiveCLI
index 27a8dac..ab5a29f 100755 (executable)
@@ -1,8 +1,7 @@
 #!/usr/bin/perl
 
 use strict;
-#use lib "__INSTALLDIR__/lib";
-use lib "/data/backuppc-agi/lib";
+use lib "__INSTALLDIR__/lib";
 
 use DBI;
 use BackupPC::Lib;
@@ -296,6 +295,10 @@ foreach my $arc (@archives_to_burn) {
 
        $sth_archive_backup_parts->execute($dvd_nr);
 
+       if ($sth_archive_backup_parts->rows == 0) {
+               warn "ERROR: no backup parts found for $dvd_nr. You should re-create that DVD.\n";
+       }
+
        my @volumes;
        my $v;  # emtpy volume
        my $v_size = 0;
@@ -318,12 +321,14 @@ foreach my $arc (@archives_to_burn) {
        }
        push @volumes, $v if ($v);
 
+       #warn "# volumes: ",Dumper(\@volumes),"\n";
+
        my $volumes = $#volumes + 1;
        my $volume_nr = 1;
 
        foreach my $v (@volumes) {
 
-               print Dumper($v);
+               #print Dumper($v);
 
                my $iso_size = 0;
                my $disk_name = $dvd_nr;
@@ -369,8 +374,8 @@ foreach my $arc (@archives_to_burn) {
                                my $rel_path = $tar_file;
 
                                if (-d "$tar_dir/$rel_path") {
-                                       $rel_path .= '/' . $p->{part_nr};
                                        mkpath("$stage/$rel_path") unless (-d "$stage/$rel_path");
+                                       $rel_path .= '/' . $p->{part_nr};
                                }
                                $rel_path .= '.tar.gz';
 
@@ -410,8 +415,7 @@ foreach my $arc (@archives_to_burn) {
 
                        print "Created $iso_file [$iso_size bytes] in ", fmt_time(time() - $t), "\n";
 
-                       # FIXME
-                       #rmtree($stage) || warn "can't remove stage directory $stage: $!";
+                       rmtree($stage) || warn "can't remove stage directory $stage: $!";
 
                } else {
                        print "ISO $iso_file allready exists\n";