--- a/update-serial Thu Nov 04 22:26:18 2010 +0100
+++ b/update-serial Thu Nov 04 22:26:39 2010 +0100
@@ -23,6 +23,8 @@
use Pod::Usage;
#my $dnssec_sign = "../dnstools/dnssec-sign";
+my $ME = basename $0;
+
my $master_dir = "/etc/bind/master";
my $opt_verbose = 0;
my $opt_reload = 0;
@@ -49,6 +51,8 @@
"dnssec!" => \$opt_dnssec,
) or pod2usage();
+ warn "DNSSEC support is currently disabled!\n"
+ if not $opt_dnssec;
-d $master_dir or die "directory $master_dir not found\n" if not @ARGV;
my @files = map { (-d) ? glob("$_/*") : $_ } @ARGV ? @ARGV : $master_dir;
@@ -130,4 +134,55 @@
}
}
+{
+ my $date;
+sub next_serial($) {
+ if (not defined $date) {
+ my ($dd, $mm, $yy) = (localtime)[3..5];
+ $date = sprintf "%04d%02d%02d" => $yy < 1900 ? $yy + 1900 : $yy, $mm + 1, $dd;
+ }
+
+ $_[0] =~ /(?<date>\d{8})(?<cnt>\d\d)/;
+ return $date . sprintf("%02d", $+{cnt}+1) if $date eq $+{date};
+ return "${date}00";
+}
+}
+
+__END__
+
+=head1 NAME
+
+ update-serial - update the serial numbers or dns zone files
+
+=head1 SYNOPSIS
+
+ update-serial [-r] [-v] [file...]
+
+=head1 DESCRIPTION
+
+This script scans DNS (bind9 format) zone files and increments the
+serial number if the file is newer than some timestamp file.
+
+=head1 OPTIONS
+
+=over
+
+=item B<-r>|B<--reload>
+
+Automatically reload the bind (rndc reload) if some changes are applied.
+(default: off)
+
+=item B<-v>|B<--verbose>
+
+Be more verbose about the actions we're doing. (default: off)
+
+=back
+
+=head1 AUTHOR
+
+ Heiko Schlittermann <hs@schlittermann.de>
+ Andre Suess (dnssec specific parts)
+
+=cut
+
# vim:ts=4:sw=4:ai:aw: