--- a/Makefile Fri Nov 05 07:10:18 2010 +0100
+++ b/Makefile Fri Nov 05 08:40:53 2010 +0100
@@ -23,5 +23,9 @@
done ;\
test $$rc = 0
@perl -c $<
- @cp -f $< $@
+ @test -f .hg_archival.txt \
+ && version=`grep ^node: | cut -f2 -d ' ' .hg_archival.txt` ;\
+ version=`hg id | cut -f1 -d' '` ;\
+ perl -pe 's/__VERSION__/'$$version'/' $< >$<.tmp
+ @mv -f $<.tmp $@
@chmod +x-w $@
--- a/update-serial.pl Fri Nov 05 07:10:18 2010 +0100
+++ b/update-serial.pl Fri Nov 05 08:40:53 2010 +0100
@@ -24,6 +24,7 @@
#my $dnssec_sign = "../dnstools/dnssec-sign";
my $ME = basename $0;
+my $VERSION = '__VERSION__';
my $master_dir = "/etc/bind/master";
my $opt_verbose = 0;
@@ -31,6 +32,7 @@
my $opt_dnssec = 0;
{
+ # remove temporary files
my @cleanup;
sub cleanup(@) {
@@ -39,16 +41,20 @@
}
}
-END { cleanup(); }
+sub next_serial($);
-sub next_serial($);
+END { cleanup(); }
+$SIG{INT} = sub { exit 1 };
MAIN: {
GetOptions(
- "verbose!" => \$opt_verbose,
- "yes|reload!" => \$opt_reload,
+ "v|verbose!" => \$opt_verbose,
+ "y|r|yes|reload!" => \$opt_reload,
"dnssec!" => \$opt_dnssec,
+ "h|help" => sub { pod2usage(-exit => 0, -verbose => 1) },
+ "m|man" => sub { pod2usage(-exit => 0, -verbose => 2) },
+ "version" => sub { print "$0 $VERSION\n"; exit 0; },
) or pod2usage();
warn "DNSSEC support is currently disabled!\n"
@@ -107,7 +113,9 @@
seek($in, 0, 0) or die "Can't seek in $file: $!\n";
truncate($in, 0) or die "Can't truncate $file: $!\n";
print $in $_;
+ close($in);
+ # touch the stamp
open(my $out, ">$stamp_file");
close($out);