equal
deleted
inserted
replaced
235 close($out); |
235 close($out); |
236 |
236 |
237 rename($out->filename => $file) |
237 rename($out->filename => $file) |
238 or die "Can't rename tmp to $file: $!\n"; |
238 or die "Can't rename tmp to $file: $!\n"; |
239 |
239 |
|
240 my $perms = (stat $file)[2] & 07777 | 040 |
|
241 or die "Can't stat '$file': $!"; |
|
242 chmod $perms, $file |
|
243 or die "Can't 'chmod $perms, $file': $!"; |
|
244 |
240 $serial =~ s/\s*//g; |
245 $serial =~ s/\s*//g; |
241 say " * $zone: serial incremented to $serial"; |
246 say " * $zone: serial incremented to $serial"; |
242 |
247 |
243 open(my $stamp, ">", dirname($file) . "/.stamp"); |
248 open(my $stamp, ">", dirname($file) . "/.stamp"); |
244 |
249 |
276 |
281 |
277 sub update_index($) { |
282 sub update_index($) { |
278 |
283 |
279 my $indexzone = shift; |
284 my $indexzone = shift; |
280 |
285 |
|
286 my $izf = "$config{master_dir}/$indexzone/$indexzone"; |
281 my @iz; |
287 my @iz; |
282 |
288 |
283 { |
289 { |
284 open(my $fh, "$config{master_dir}/$indexzone/$indexzone") |
290 open(my $fh, "$izf") |
285 or die "$config{master_dir}/$indexzone/$indexzone: $!\n"; |
291 or die "$izf: $!\n"; |
286 chomp(@iz = grep !/ZONE::/ => <$fh>); |
292 chomp(@iz = grep !/ZONE::/ => <$fh>); |
287 } |
293 } |
288 |
294 |
289 for my $dir (glob "$config{master_dir}/*") { |
295 for my $dir (glob "$config{master_dir}/*") { |
290 my $zone = basename($dir); |
296 my $zone = basename($dir); |
294 |
300 |
295 { |
301 { |
296 my $fh = File::Temp->new(DIR => "$config{master_dir}/$indexzone") |
302 my $fh = File::Temp->new(DIR => "$config{master_dir}/$indexzone") |
297 or die "Can't create tmpdir: $!\n"; |
303 or die "Can't create tmpdir: $!\n"; |
298 print $fh join "\n" => @iz, ""; |
304 print $fh join "\n" => @iz, ""; |
299 rename($fh->filename => "$config{master_dir}/$indexzone/$indexzone") |
305 rename($fh->filename => "$izf") |
300 or die "Can't rename " |
306 or die "Can't rename ", $fh->filename, " to $izf: $!\n"; |
301 . $fh->filename |
|
302 . " to $config{master_dir}/$indexzone/$indexzone: $!\n"; |
|
303 $fh->unlink_on_destroy(0); |
307 $fh->unlink_on_destroy(0); |
304 } |
308 } |
|
309 |
|
310 my $perms = (stat _)[2] & 07777 | 040 |
|
311 or die "Can't stat '$izf': $!"; |
|
312 chmod $perms, $izf |
|
313 or die "Can't 'chmod $perms, $izf': $!"; |
305 |
314 |
306 say "** index-zone aktualisiert"; |
315 say "** index-zone aktualisiert"; |
307 return $indexzone; |
316 return $indexzone; |
308 } |
317 } |
309 |
318 |