equal
deleted
inserted
replaced
|
1 #!/usr/bin/perl -w |
|
2 |
|
3 use strict; |
|
4 use File::Path; |
|
5 use FindBin; |
|
6 |
|
7 # liest die Konfiguration ein |
|
8 my @configs = ( "$FindBin::Bin/dnstools.conf", "/etc/dnstools.conf" ); |
|
9 my %config; |
|
10 |
|
11 foreach ( grep {-f} @configs ) { |
|
12 open( CONFIG, $_ ) or die "Can't open $_: $!\n"; |
|
13 } |
|
14 |
|
15 unless ( seek( CONFIG, 0, 0 ) ) { |
|
16 die "Can't open config (searched: @configs)\n"; |
|
17 } |
|
18 |
|
19 while (<CONFIG>) { |
|
20 chomp; |
|
21 s/#.*//; |
|
22 s/\t//g; |
|
23 s/\s//g; |
|
24 next unless length; |
|
25 my ( $cname, $ccont ) = split( /\s*=\s*/, $_, 2 ); |
|
26 $config{$cname} = $ccont; |
|
27 } |
|
28 close(CONFIG); |
|
29 |
|
30 my $master_dir = $config{"master_dir"}; |
|
31 my $conf_dir = $config{"zone_conf_dir"}; |
|
32 |
|
33 for (@ARGV) { |
|
34 chomp( my $zone = `idn --quiet "$_"` ); |
|
35 |
|
36 if ( -d "$master_dir/$zone" ) { |
|
37 rmtree "$master_dir/$zone/" |
|
38 and print "zone-dir for $zone removed\n"; |
|
39 } |
|
40 else { |
|
41 print "$master_dir/$zone: $!\n"; |
|
42 } |
|
43 |
|
44 if ( -e "$conf_dir/$zone" ) { |
|
45 unlink "$conf_dir/$zone" |
|
46 and print "configuration-file for $zone removed\n"; |
|
47 } |
|
48 else { |
|
49 print "$conf_dir/$zone: $!\n"; |
|
50 } |
|
51 } |