diff -r 5ac92c1ffdf9 -r 1cea07056124 mkready --- a/mkready Wed Aug 11 14:08:33 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -#!/usr/bin/perl - -use strict; -use FindBin; - -# liest die Konfiguration ein -my @configs = ( "$FindBin::Bin/dnstools.conf", "/etc/dnstools.conf" ); -my %config; - -foreach ( grep {-f} @configs ) { - open( CONFIG, $_ ) or die "Can't open $_: $!\n"; -} - -unless ( seek( CONFIG, 0, 0 ) ) { - die "Can't open config (searched: @configs)\n"; -} - -while () { - chomp; - s/#.*//; - s/\t//g; - s/\s//g; - next unless length; - my ( $cname, $ccont ) = split( /\s*=\s*/, $_, 2 ); - $config{$cname} = $ccont; -} -close(CONFIG); - -my $bind_dir = $config{bind_dir}; -my $conf_dir = $config{zone_conf_dir}; -my $master_dir = $config{master_dir}; - -unless ( -d $master_dir and -r $master_dir ) { - die "$master_dir: $!\n"; -} - -unless ( -d $bind_dir and -r $bind_dir ) { - die "$bind_dir: $!\n"; -} - -# prueft jede domain, die ein verzeichnis in $master_dir hat, ob es eine -# datei $zone_file.signed gibt und ob diese datei in $config_file eingetragen -# ist. -# passt die eintraege in $config_file falls noetig an. -while (<$master_dir/*>) { - s#($master_dir/)(.*)#$2#; - my $zone = $_; - - my $zone_file = "$master_dir/$zone/$zone"; - my $conf_file = "$conf_dir/$zone"; - my @c_content; - - unless ( -f "$conf_file" ) { - die "$conf_file: $! \n"; - } - - if ( -f "$zone_file.signed" ) { - - open( FILE, "<$conf_file" ) or die "$conf_file: $!\n"; - @c_content = ; - close(FILE); - - for (@c_content) { - if (m{(.*)($zone_file)(";)}) { - print "$2 ==> $2.signed\n"; - $_ = "$1$2.signed$3\n"; - } - - open( FILE, ">$conf_file" ) or die "$conf_file: $!\n"; - print FILE @c_content; - close(FILE); - - } - } - else { - - open( FILE, "<$conf_file" ) or die "$conf_file: $!\n"; - @c_content = ; - close(FILE); - - for (@c_content) { - if (m{(.*)($zone_file)\.signed(.*)}) { - print "$2.signed ==> $2\n"; - $_ = "$1$2$3\n"; - } - } - - open( FILE, ">$conf_file" ) or die "$conf_file: $!\n"; - print FILE @c_content; - close(FILE); - } -} - -# erzeugt eine named.conf-datei aus den entsprechenden vorlagen. -open( TO, ">$bind_dir/named.conf.zones" ) - or die "$bind_dir/named.conf.zones: $!\n"; -while (<$conf_dir/*>) { - open( FROM, "$_" ) or die "$_: $! \n"; - print TO ; - close(FROM); -} -close(TO); - -system "named-checkconf"; -system "named-checkconf -z"; -system "rndc reload";