123 |
|
|
124 |
print "\n"; |
print "\n"; |
125 |
|
|
126 |
|
sub skip($) { |
127 |
|
my $msg = shift; |
128 |
|
print "WARNING: $msg, skipping...\n"; |
129 |
|
goto SKIP; |
130 |
|
} |
131 |
|
|
132 |
|
my $sth_archive_backup = $dbh->prepare( qq{ |
133 |
|
select |
134 |
|
backup_id, |
135 |
|
hosts.name as host, |
136 |
|
shares.name as share, |
137 |
|
backups.num as num |
138 |
|
from archive_backup |
139 |
|
join archive on archive_id = archive.id |
140 |
|
join backups on backup_id = backups.id |
141 |
|
join hosts on hostid = hosts.id |
142 |
|
join shares on shareid = shares.id |
143 |
|
where archive.dvd_nr = ? |
144 |
|
}); |
145 |
|
|
146 |
foreach my $arc (@archives_to_burn) { |
foreach my $arc (@archives_to_burn) { |
147 |
exit if ($arc eq ']quit['); |
exit if ($arc eq ']quit['); |
148 |
|
|
149 |
my $dvd_nr = $1 if ($arc =~ m/DVD #(\d+)/); |
my $dvd_nr = $1 if ($arc =~ m/DVD #(\d+)/); |
150 |
die "BUG: can't find dvd_nr in $arc\n" unless ($dvd_nr); |
die "BUG: can't find dvd_nr in $arc\n" unless ($dvd_nr); |
151 |
|
|
152 |
print "Working on DVD #$dvd_nr\n"; |
my $tmp_dir = "/$iso_dir/$dvd_nr"; |
153 |
|
|
154 |
|
my $t = time(); |
155 |
|
|
156 |
|
print "Working on DVD #$dvd_nr in $tmp_dir\n"; |
157 |
|
|
158 |
|
my $iso_file = "${iso_dir}/${dvd_nr}.iso"; |
159 |
|
|
160 |
|
skip "ISO $iso_file allready exists" if (-e $iso_file); |
161 |
|
|
162 |
|
$sth_archive_backup->execute($dvd_nr); |
163 |
|
|
164 |
|
print "Running mkisofs now...\n"; |
165 |
|
|
166 |
|
my $cmd = qq{ mkisofs -A BackupPC -gui -J -r -T --input-charset ISO-8859-2 -V $dvd_nr -o $iso_file -path-list - }; |
167 |
|
|
168 |
|
open(my $mkisofs, "| $cmd 2>&1") || skip "can't run $cmd: $!"; |
169 |
|
|
170 |
|
while (my $row = $sth_archive_backup->fetchrow_hashref) { |
171 |
|
my $tar_file = BackupPC::SearchLib::getGzipName($row->{'host'}, $row->{'share'}, $row->{'num'}); |
172 |
|
skip "can't find increment $tar_file: $!" unless (-r "$tar_dir/$tar_file"); |
173 |
|
print $mkisofs "$tar_dir/$tar_file\n"; |
174 |
|
} |
175 |
|
|
176 |
|
while(! -e $iso_file) { |
177 |
|
sleep 1; |
178 |
|
} |
179 |
|
|
180 |
|
print "Created $iso_file in ", fmt_time(time() - $t), "\n"; |
181 |
|
|
182 |
|
SKIP: |
183 |
|
|
184 |
} |
} |
185 |
|
|