my $volumes = $#volumes + 1;
my $volume_nr = 1;
- foreach my $v (@volumes) {
+ my $copies = $Conf{BurnMultipleCopies} || 1;
- #print Dumper($v);
+ foreach my $copy_nr ( 1 .. $copies ) {
- my $iso_size = 0;
- my $disk_name = $dvd_nr;
- # suffix added to multi-volume archives
- my $volume_suffix = '';
+ foreach my $v (@volumes) {
- if ($volumes > 1) {
- $volume_suffix = '_' . $volume_nr;
- $disk_name .= ' ' . $volume_nr . '/' . $volumes;
- }
+ #print Dumper($v);
- print "Processing DVD #$dvd_nr, volume $volume_nr/$volumes\n";
+ my $iso_size = 0;
+ my $disk_name = $dvd_nr;
+ # suffix added to multi-volume archives
+ my $volume_suffix = '';
- my $iso_file = my $xml_file = my $stage =
- "${iso_dir}/${dvd_nr}";
+ if ($volumes > 1) {
+ $volume_suffix = '_' . $volume_nr;
+ $disk_name .= ' ' . $volume_nr . '/' . $volumes;
+ }
- $iso_file .= $volume_suffix . '.iso';
- $xml_file .= '.xml';
+ print "Processing DVD #$dvd_nr, volume $volume_nr/$volumes\n";
- $stage .= $volume_suffix . '.stage';
+ my $iso_file = my $xml_file = my $stage =
+ "${iso_dir}/${dvd_nr}";
- my $md5_file = "${stage}/${dvd_nr}${volume_suffix}.md5";
+ $iso_file .= $volume_suffix . '.iso';
+ $xml_file .= '.xml';
- #
- # check if ISO file exists
- #
+ $stage .= $volume_suffix . '.stage';
- if (! -e $iso_file) {
+ my $md5_file = "${stage}/${dvd_nr}${volume_suffix}.md5";
- # create stage directory
- if (-e $stage) {
- rmtree($stage) || die "can't remove $stage: $!";
- }
- mkpath($stage);
+ #
+ # check if ISO file exists
+ #
- # open file for md5sums
- open(my $md5, "> $md5_file") || skip "can't open $md5_file: $!";
+ if (! -e $iso_file) {
- my $parts_on_this_volume = 0;
+ # create stage directory
+ if (-e $stage) {
+ rmtree($stage) || die "can't remove $stage: $!";
+ }
+ mkpath($stage);
- foreach my $p (@{ $v->{parts} }) {
- my $tar_file = $p->{filename} || die "no filename in part", Dumper($p);
- my $rel_path = $tar_file;
+ # open file for md5sums
+ open(my $md5, "> $md5_file") || skip "can't open $md5_file: $!";
- if (-d "$tar_dir/$rel_path") {
- mkpath("$stage/$rel_path") unless (-d "$stage/$rel_path");
- $rel_path .= '/' . $p->{part_nr};
- }
- $rel_path .= '.tar.gz';
+ my $parts_on_this_volume = 0;
- skip "can't find increment $rel_path: $!" unless (-r "$tar_dir/$rel_path");
+ foreach my $p (@{ $v->{parts} }) {
+ my $tar_file = $p->{filename} || die "no filename in part", Dumper($p);
+ my $rel_path = $tar_file;
- add_symlink("$tar_dir/$rel_path", "$stage/$rel_path");
+ if (-d "$tar_dir/$rel_path") {
+ mkpath("$stage/$rel_path") unless (-d "$stage/$rel_path");
+ $rel_path .= '/' . $p->{part_nr};
+ }
+ $rel_path .= '.tar.gz';
- my $md5sum = $p->{md5} || die "no md5 in part ", Dumper($p);
- chomp($md5sum);
- print $md5 "$md5sum $rel_path\n" || die "can't write md5sum: $!";
+ skip "can't find increment $rel_path: $!" unless (-r "$tar_dir/$rel_path");
- $parts_on_this_volume++;
- }
+ add_symlink("$tar_dir/$rel_path", "$stage/$rel_path");
- # add file list and note in xml
- dumpArchive2XML($dbh, $dvd_nr, $xml_file) unless (-f $xml_file);
+ my $md5sum = $p->{md5} || die "no md5 in part ", Dumper($p);
+ chomp($md5sum);
+ print $md5 "$md5sum $rel_path\n" || die "can't write md5sum: $!";
- add_symlink($xml_file, "$stage/${dvd_nr}.xml");
+ $parts_on_this_volume++;
+ }
- # add css file for archive
- my $css_file = $Conf{CgiImageDir} . '/archive.css';
- if (-r $css_file) {
- add_symlink($css_file, "$stage/archive.css");
- } else {
- print "WARNING: missing $css_file, not added to iso image!\n";
- }
+ # add file list and note in xml
+ dumpArchive2XML($dbh, $dvd_nr, $xml_file) unless (-f $xml_file);
- print "Running mkisofs now for $parts_on_this_volume increments, disk $disk_name\n";
+ add_symlink($xml_file, "$stage/${dvd_nr}.xml");
- my $cmd = $bin->{'mkisofs'} . qq{ -A BackupPC -gui -J -r -T --input-charset ISO-8859-2 -V "$disk_name" -o ${iso_file}.tmp -f $stage };
+ # add css file for archive
+ my $css_file = $Conf{CgiImageDir} . '/archive.css';
+ if (-r $css_file) {
+ add_symlink($css_file, "$stage/archive.css");
+ } else {
+ print "WARNING: missing $css_file, not added to iso image!\n";
+ }
- system($cmd) == 0 or skip "can't run $cmd: $?";
+ print "Running mkisofs now for $parts_on_this_volume increments, disk $disk_name\n";
- rename $iso_file.'.tmp', $iso_file || skip "can't rename $iso_file: $!";
+ my $cmd = $bin->{'mkisofs'} . qq{ -A BackupPC -gui -J -r -T --input-charset ISO-8859-2 -V "$disk_name" -o ${iso_file}.tmp -f $stage };
- $iso_size = (stat($iso_file))[7];
+ system($cmd) == 0 or skip "can't run $cmd: $?";
- print "Created $iso_file [$iso_size bytes] in ", fmt_time(time() - $t), "\n";
+ rename $iso_file.'.tmp', $iso_file || skip "can't rename $iso_file: $!";
- rmtree($stage) || warn "can't remove stage directory $stage: $!";
+ $iso_size = (stat($iso_file))[7];
- } else {
- print "ISO $iso_file allready exists\n";
- }
+ print "Created $iso_file [$iso_size bytes] in ", fmt_time(time() - $t), "\n";
- my $copies = $Conf{BurnMultipleCopies} || 1;
+ rmtree($stage) || warn "can't remove stage directory $stage: $!";
- foreach my $copy_nr ( 1 .. $copies ) {
+ } else {
+ print "ISO $iso_file allready exists\n";
+ }
print "\nREADY TO BURN MEDIA $disk_name copy $copy_nr\n\nPlease insert blank media and press ENTER\n\n";