equal
deleted
inserted
replaced
22 use Getopt::Long; |
22 use Getopt::Long; |
23 use Pod::Usage; |
23 use Pod::Usage; |
24 |
24 |
25 #my $dnssec_sign = "../dnstools/dnssec-sign"; |
25 #my $dnssec_sign = "../dnstools/dnssec-sign"; |
26 my $ME = basename $0; |
26 my $ME = basename $0; |
|
27 my $VERSION = '__VERSION__'; |
27 |
28 |
28 my $master_dir = "/etc/bind/master"; |
29 my $master_dir = "/etc/bind/master"; |
29 my $opt_verbose = 0; |
30 my $opt_verbose = 0; |
30 my $opt_reload = 0; |
31 my $opt_reload = 0; |
31 my $opt_dnssec = 0; |
32 my $opt_dnssec = 0; |
32 |
33 |
33 { |
34 { |
|
35 # remove temporary files |
34 my @cleanup; |
36 my @cleanup; |
35 |
37 |
36 sub cleanup(@) { |
38 sub cleanup(@) { |
37 return push @cleanup, @_ if @_; |
39 return push @cleanup, @_ if @_; |
38 unlink @cleanup; |
40 unlink @cleanup; |
39 } |
41 } |
40 } |
42 } |
41 |
43 |
|
44 sub next_serial($); |
|
45 |
42 END { cleanup(); } |
46 END { cleanup(); } |
43 |
47 $SIG{INT} = sub { exit 1 }; |
44 sub next_serial($); |
|
45 |
48 |
46 MAIN: { |
49 MAIN: { |
47 |
50 |
48 GetOptions( |
51 GetOptions( |
49 "verbose!" => \$opt_verbose, |
52 "v|verbose!" => \$opt_verbose, |
50 "yes|reload!" => \$opt_reload, |
53 "y|r|yes|reload!" => \$opt_reload, |
51 "dnssec!" => \$opt_dnssec, |
54 "dnssec!" => \$opt_dnssec, |
|
55 "h|help" => sub { pod2usage(-exit => 0, -verbose => 1) }, |
|
56 "m|man" => sub { pod2usage(-exit => 0, -verbose => 2) }, |
|
57 "version" => sub { print "$0 $VERSION\n"; exit 0; }, |
52 ) or pod2usage(); |
58 ) or pod2usage(); |
53 |
59 |
54 warn "DNSSEC support is currently disabled!\n" |
60 warn "DNSSEC support is currently disabled!\n" |
55 if not $opt_dnssec; |
61 if not $opt_dnssec; |
56 |
62 |
105 |
111 |
106 copy($file => "$file~") or die("Can't copy $file -> $file~: $!\n"); |
112 copy($file => "$file~") or die("Can't copy $file -> $file~: $!\n"); |
107 seek($in, 0, 0) or die "Can't seek in $file: $!\n"; |
113 seek($in, 0, 0) or die "Can't seek in $file: $!\n"; |
108 truncate($in, 0) or die "Can't truncate $file: $!\n"; |
114 truncate($in, 0) or die "Can't truncate $file: $!\n"; |
109 print $in $_; |
115 print $in $_; |
110 |
116 close($in); |
|
117 |
|
118 # touch the stamp |
111 open(my $out, ">$stamp_file"); |
119 open(my $out, ">$stamp_file"); |
112 close($out); |
120 close($out); |
113 |
121 |
114 print "$file\n" if not $opt_verbose; |
122 print "$file\n" if not $opt_verbose; |
115 |
123 |