... suess
authorasuess@dns.net.schlittermann.de
Mon, 02 Aug 2010 11:51:16 +0200
branchsuess
changeset 2 129d99ceb301
parent 1 b4dbb957f54b
child 5 a179476e5c87
...
update-serial
--- a/update-serial	Thu Jul 15 16:33:26 2010 +0200
+++ b/update-serial	Mon Aug 02 11:51:16 2010 +0200
@@ -13,18 +13,26 @@
 #   the current directory)
 # . optionally reload the named
 
+use strict;
+
 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 : </etc/bind/p/*>;
+@Zones = @ARGV ? @ARGV : <$master_dir/*>;
 
 
 MAIN: {
@@ -39,12 +47,17 @@
 
 
 	while ($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;
 		}
@@ -114,11 +131,8 @@
 		} else {
 			print "** No PID of a running named found.  Please reload manually.\n";
 		}
-			
 
 	}
-
 }
 
-
 # vim:ts=4:sw=4:ai:aw: