# HG changeset patch # User Heiko Schlittermann # Date 1280743392 -7200 # Node ID aa1631182916c175fa6682e11e17205a5291e716 # Parent b4dbb957f54b59c3aaee32eabf7438a47f2e28d0 [merged] diff -r b4dbb957f54b -r aa1631182916 update-serial --- a/update-serial Thu Jul 15 16:33:26 2010 +0200 +++ b/update-serial Mon Aug 02 12:03:12 2010 +0200 @@ -13,18 +13,27 @@ # the current directory) # . optionally reload the named +use strict; +use warnings; + use File::Basename; use File::Copy; + +my $dnssec_sign = "/home/asuess/dnstools/dnssec-sign"; +my $master_dir = "/etc/bind/master"; + my $ME = basename $0; my @tmpfiles; my $verbose = 0; my $opt_yes = 0; +my @Zones; +my $file; sub cleanup() { unlink @tmpfiles; } END { cleanup(); } $ARGV[0] eq "-y" and $opt_yes = 1, shift; -@Zones = @ARGV ? @ARGV : ; +@Zones = @ARGV ? @ARGV : glob("$master_dir/*"); MAIN: { @@ -38,13 +47,17 @@ $date = "$yy$mm$dd"; - while ($file = shift @Zones) { + while (my $file = shift @Zones) { + + my $file_basename = basename($file); + + $file =~ s#($master_dir)(/.*)#$1$2$2#; local (*I, *O); my $done = 0; my $new = "$file.$$.tmp"; my $bak = "$file.bak"; - my $stamp = dirname($file) . "/.stamp/" . basename($file); + my $stamp = $master_dir . "/.stamp/" . basename($file); $file =~ /(\.bak|~)$/ and next; $file !~ /\./ and next; @@ -74,6 +87,10 @@ print " bumping to $sdate$scount"; s/$serial/$sdate$scount/; + # dnssec - new sign + if (-e "$dnssec_sign") { + print `$dnssec_sign $file_basename`; + } }; print O; }