21 |
my %Conf = $bpc->Conf(); |
my %Conf = $bpc->Conf(); |
22 |
%BackupPC::SearchLib::Conf = %Conf; |
%BackupPC::SearchLib::Conf = %Conf; |
23 |
|
|
24 |
my $cdrecord = $Conf{CDRecordBin} || die "Need CDRecordBin in config.pl\n"; |
my $conf_bin; |
25 |
|
|
26 |
|
$conf_bin->{'cdrecord'} = $Conf{CDRecordBin} || die "Need CDRecordBin in config.pl\n"; |
27 |
my $cdr_opts = $Conf{CDRecordOpts} || die "Need CDRecordOpts in config.pl\n"; |
my $cdr_opts = $Conf{CDRecordOpts} || die "Need CDRecordOpts in config.pl\n"; |
28 |
|
$conf_bin->{'eject'} = $Conf{ejectBin} || die "Need ejectBin in config.pl\n"; |
29 |
|
my $eject_opts = $Conf{ejectOpts} || die "Need ejectOpts in config.pl\n"; |
30 |
|
$conf_bin->{'mkisofs'} = $Conf{mkisofsBin} || die "Need mkisofsBin in config.pl\n"; |
31 |
|
|
32 |
|
|
33 |
my $bin; |
my $bin; |
34 |
foreach my $c (qw/mkisofs eject/, $cdrecord) { |
foreach my $c (qw/cdrecord eject mkisofs/) { |
35 |
$bin->{$c} = which($c) || die "$0 needs $c, install it\n"; |
$bin->{$c} = which($conf_bin->{$c}) || die "$0 needs $c ($conf_bin->{$c}), install it\n"; |
36 |
} |
} |
37 |
|
|
38 |
my $start_t = time(); |
my $start_t = time(); |
72 |
sub dumpArchive2XML($$$) |
sub dumpArchive2XML($$$) |
73 |
{ |
{ |
74 |
my ($dbh, $dvd_nr, $filename) = @_; |
my ($dbh, $dvd_nr, $filename) = @_; |
75 |
my %archive; |
my %archive; |
76 |
my $output = new IO::File(">$filename"); |
|
77 |
|
my $output = new IO::File('> '.$filename.'.tmp'); |
78 |
my $writer = new XML::Writer(OUTPUT=>$output, NEWLINES => 1); |
my $writer = new XML::Writer(OUTPUT=>$output, NEWLINES => 1); |
79 |
|
|
80 |
print "Dumping file list for DVD $dvd_nr"; |
print "Dumping file list for DVD $dvd_nr, countdown:"; |
81 |
|
|
82 |
$writer->pi('xml-stylesheet', 'href="archive.css" type="text/css"'); |
$writer->pi('xml-stylesheet', 'href="archive.css" type="text/css"'); |
83 |
|
|
129 |
my $sth_backups = $dbh->prepare( $backups_sql ); |
my $sth_backups = $dbh->prepare( $backups_sql ); |
130 |
$sth_backups->execute( $row_h->{'id'} ); |
$sth_backups->execute( $row_h->{'id'} ); |
131 |
|
|
132 |
|
my $total_backups = $sth_backups->rows; |
133 |
|
my $curr_backup = 0; |
134 |
|
my $last_pcnt = 0; |
135 |
|
|
136 |
while (my $row = $sth_backups->fetchrow_hashref()) { |
while (my $row = $sth_backups->fetchrow_hashref()) { |
137 |
|
|
138 |
print "."; |
$curr_backup++; |
139 |
|
my $pcnt = int(($curr_backup * 10) / $total_backups); |
140 |
|
if ($pcnt > $last_pcnt) { |
141 |
|
print " ",(10 - $pcnt); |
142 |
|
$last_pcnt = $pcnt; |
143 |
|
} |
144 |
|
|
145 |
my $sth_files = $dbh->prepare( $files_sql); |
my $sth_files = $dbh->prepare( $files_sql); |
146 |
$sth_files->execute($row->{'backup_id'}); |
$sth_files->execute($row->{'backup_id'}); |
166 |
$writer->endTag("archive"); |
$writer->endTag("archive"); |
167 |
$writer->end(); |
$writer->end(); |
168 |
|
|
169 |
|
rename $filename.'.tmp', $filename || die "can't rename $filename: $!"; |
170 |
|
|
171 |
print "\n"; |
print "\n"; |
172 |
} |
} |
173 |
|
|
353 |
|
|
354 |
print "Running mkisofs now for $inc increments, disk $disk_name\n"; |
print "Running mkisofs now for $inc increments, disk $disk_name\n"; |
355 |
|
|
356 |
my $cmd = $bin->{'mkisofs'} . qq{ -A BackupPC -gui -J -r -T --input-charset ISO-8859-2 -V $disk_name -o $iso_file -path-list $list_file }; |
my $cmd = $bin->{'mkisofs'} . qq{ -A BackupPC -gui -J -r -T --input-charset ISO-8859-2 -V $disk_name -o ${iso_file}.tmp -path-list $list_file }; |
357 |
|
|
358 |
system($cmd) == 0 or skip "can't run $cmd: $?"; |
system($cmd) == 0 or skip "can't run $cmd: $?"; |
359 |
|
|
360 |
|
rename $iso_file.'.tmp', $iso_file || skip "can't rename $iso_file: $!"; |
361 |
|
|
362 |
$iso_size = (stat($iso_file))[7]; |
$iso_size = (stat($iso_file))[7]; |
363 |
|
|
364 |
print "Created $iso_file [$iso_size bytes] in ", fmt_time(time() - $t), "\n"; |
print "Created $iso_file [$iso_size bytes] in ", fmt_time(time() - $t), "\n"; |
373 |
|
|
374 |
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"; |
375 |
|
|
376 |
system($bin->{'eject'}) == 0 or skip "can't run eject: $?"; |
system($bin->{'eject'}.' '.$eject_opts) == 0 or skip "can't run eject: $?"; |
377 |
|
|
378 |
my $wait = <STDIN>; |
my $wait = <STDIN>; |
379 |
|
|
380 |
my $cmd = $bin->{$cdrecord} . ' ' . $cdr_opts . ' ' . $iso_file; |
my $cmd = $bin->{'cdrecord'} . ' ' . $cdr_opts . ' ' . $iso_file; |
381 |
|
|
382 |
# FIXME |
# FIXME |
383 |
print "## $cmd\n"; |
print "## $cmd\n"; |