merged
authorHeiko Schlittermann <hs@schlittermann.de>
Tue, 10 Aug 2010 13:03:48 +0200
changeset 9 7ca31b207366
parent 8 654be00c18ee (current diff)
parent 7 7df21c1807a6 (diff)
child 10 09883d94ba30
merged
update-serial
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.perltidyrc	Tue Aug 10 13:03:48 2010 +0200
@@ -0,0 +1,2 @@
+--paren-tightness=2
+--square-bracket-tightness=2
--- a/update-serial	Mon Aug 02 15:50:54 2010 +0200
+++ b/update-serial	Tue Aug 10 13:03:48 2010 +0200
@@ -1,5 +1,8 @@
 #! /usr/bin/perl
 # (c) 1998 Heiko Schlittermann <heiko@datom.de>
+#
+# … work in progress do integrate dnssec (branch suess)
+#
 # Update the serial numbers in zone files
 # The serial number needs to match a specified pattern (see 
 # the line marked w/ PATTERN.
@@ -15,17 +18,23 @@
 
 use File::Basename;
 use File::Copy;
+
+#my $dnssec_sign = "../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;
-my @Zones = @ARGV ? @ARGV : </etc/bind/p/*>;
+@ARGV and $ARGV[0] eq "-y" and $opt_yes = 1, shift;
+@Zones = @ARGV ? @ARGV : glob("$master_dir/*");
 
 
 MAIN: {
@@ -40,12 +49,16 @@
 
 
 	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;
@@ -75,6 +88,10 @@
 				print " bumping to $sdate$scount";
 				s/$serial/$sdate$scount/;
 
+				# dnssec - new sign
+				system "cd ../dnstools && ./dnssec-sign $file_basename";
+				#die "$dnssec_sign not found ($!)" if $? == -1;
+				exit 1 if $?;
 			};
 			print O;
 		}
@@ -115,11 +132,8 @@
 		} else {
 			print "** No PID of a running named found.  Please reload manually.\n";
 		}
-			
 
 	}
-
 }
 
-
 # vim:ts=4:sw=4:ai:aw: