equal
deleted
inserted
replaced
22 use File::Basename; |
22 use File::Basename; |
23 use Getopt::Long; |
23 use Getopt::Long; |
24 use Pod::Usage; |
24 use Pod::Usage; |
25 |
25 |
26 #my $dnssec_sign = "../dnstools/dnssec-sign"; |
26 #my $dnssec_sign = "../dnstools/dnssec-sign"; |
27 my $ME = basename $0; |
27 my $ME = basename $0; |
28 my $VERSION = '__VERSION__'; |
28 my $VERSION = '__VERSION__'; |
29 |
29 |
30 my $master_dir = "/etc/bind/master"; |
30 my $master_dir = "/etc/bind/master"; |
31 my $opt_verbose = 0; |
31 my $opt_verbose = 0; |
32 my $opt_reload = 0; |
32 my $opt_reload = 0; |
33 my $opt_dnssec = 0; |
33 my $opt_dnssec = 0; |
34 |
34 |
35 { |
35 { |
36 # remove temporary files |
36 |
|
37 # remove temporary files |
37 my @cleanup; |
38 my @cleanup; |
38 |
39 |
39 sub cleanup(@) { |
40 sub cleanup(@) { |
40 return push @cleanup, @_ if @_; |
41 return push @cleanup, @_ if @_; |
41 unlink @cleanup; |
42 unlink @cleanup; |
48 $SIG{INT} = sub { exit 1 }; |
49 $SIG{INT} = sub { exit 1 }; |
49 |
50 |
50 MAIN: { |
51 MAIN: { |
51 |
52 |
52 GetOptions( |
53 GetOptions( |
53 "v|verbose!" => \$opt_verbose, |
54 "v|verbose!" => \$opt_verbose, |
54 "y|r|yes|reload!" => \$opt_reload, |
55 "y|r|yes|reload!" => \$opt_reload, |
55 "dnssec!" => \$opt_dnssec, |
56 "dnssec!" => \$opt_dnssec, |
56 "h|help" => sub { pod2usage(-exit => 0, -verbose => 1) }, |
57 "h|help" => sub { pod2usage(-exit => 0, -verbose => 1) }, |
57 "m|man" => sub { pod2usage(-noperldoc => system(perldoc => "-V"), -exit => 0, -verbose => 2) }, |
58 "m|man" => sub { |
58 "version" => sub { print "$0 $VERSION\n"; exit 0; }, |
59 pod2usage( |
|
60 -noperldoc => system("perldoc -V &>/dev/null"), |
|
61 -exit => 0, |
|
62 -verbose => 2 |
|
63 ); |
|
64 }, |
|
65 "version" => sub { print "$0 $VERSION\n"; exit 0; }, |
59 ) or pod2usage(); |
66 ) or pod2usage(); |
60 |
67 |
61 warn "DNSSEC support is currently disabled!\n" |
68 warn "DNSSEC support is currently disabled!\n" |
62 if not $opt_dnssec; |
69 if not $opt_dnssec; |
63 |
70 |
112 |
119 |
113 copy($file => "$file~") or die("Can't copy $file -> $file~: $!\n"); |
120 copy($file => "$file~") or die("Can't copy $file -> $file~: $!\n"); |
114 seek($in, 0, 0) or die "Can't seek in $file: $!\n"; |
121 seek($in, 0, 0) or die "Can't seek in $file: $!\n"; |
115 truncate($in, 0) or die "Can't truncate $file: $!\n"; |
122 truncate($in, 0) or die "Can't truncate $file: $!\n"; |
116 print $in $_; |
123 print $in $_; |
117 close($in); |
124 close($in); |
118 |
125 |
119 # touch the stamp |
126 # touch the stamp |
120 open(my $out, ">$stamp_file"); |
127 open(my $out, ">$stamp_file"); |
121 close($out); |
128 close($out); |
122 |
129 |
123 print "$file\n" if not $opt_verbose; |
130 print "$file\n" if not $opt_verbose; |
124 |
131 |