--- a/bin/update-serial Fri May 27 13:43:05 2011 +0200
+++ b/bin/update-serial Fri May 27 13:45:53 2011 +0200
@@ -237,6 +237,11 @@
rename($out->filename => $file)
or die "Can't rename tmp to $file: $!\n";
+ my $perms = (stat $file)[2] & 07777 | 040
+ or die "Can't stat '$file': $!";
+ chmod $perms, $file
+ or die "Can't 'chmod $perms, $file': $!";
+
$serial =~ s/\s*//g;
say " * $zone: serial incremented to $serial";
@@ -278,11 +283,12 @@
my $indexzone = shift;
+ my $izf = "$config{master_dir}/$indexzone/$indexzone";
my @iz;
{
- open(my $fh, "$config{master_dir}/$indexzone/$indexzone")
- or die "$config{master_dir}/$indexzone/$indexzone: $!\n";
+ open(my $fh, "$izf")
+ or die "$izf: $!\n";
chomp(@iz = grep !/ZONE::/ => <$fh>);
}
@@ -296,13 +302,16 @@
my $fh = File::Temp->new(DIR => "$config{master_dir}/$indexzone")
or die "Can't create tmpdir: $!\n";
print $fh join "\n" => @iz, "";
- rename($fh->filename => "$config{master_dir}/$indexzone/$indexzone")
- or die "Can't rename "
- . $fh->filename
- . " to $config{master_dir}/$indexzone/$indexzone: $!\n";
+ rename($fh->filename => "$izf")
+ or die "Can't rename ", $fh->filename, " to $izf: $!\n";
$fh->unlink_on_destroy(0);
}
+ my $perms = (stat _)[2] & 07777 | 040
+ or die "Can't stat '$izf': $!";
+ chmod $perms, $izf
+ or die "Can't 'chmod $perms, $izf': $!";
+
say "** index-zone aktualisiert";
return $indexzone;
}