mkready
changeset 27 d5337081ed02
parent 25 c02caf4e0eb6
--- a/mkready	Thu Aug 05 10:49:36 2010 +0200
+++ b/mkready	Mon Aug 09 11:45:43 2010 +0200
@@ -3,105 +3,104 @@
 use strict;
 use FindBin;
 
-
 # liest die Konfiguration ein
-my @configs = ("$FindBin::Bin/dnstools.conf", "/etc/dnstools.conf");
+my @configs = ( "$FindBin::Bin/dnstools.conf", "/etc/dnstools.conf" );
 my %config;
 
-foreach (grep {-f} @configs) {
-        open(CONFIG, $_) or die "Can't open $_: $!\n";
+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"
+unless ( seek( CONFIG, 0, 0 ) ) {
+    die "Can't open config (searched: @configs)\n";
 }
 
 while (<CONFIG>) {
-        chomp;
-        s/#.*//;
-        s/\t//g;
-        s/\s//g;
-        next unless length;
-        my ($cname, $ccont) = split (/\s*=\s*/, $_,2);
-        $config{$cname} = $ccont;
+    chomp;
+    s/#.*//;
+    s/\t//g;
+    s/\s//g;
+    next unless length;
+    my ( $cname, $ccont ) = split( /\s*=\s*/, $_, 2 );
+    $config{$cname} = $ccont;
 }
-close (CONFIG);
+close(CONFIG);
 
-my $bind_dir = $config{bind_dir};
-my $conf_dir = $config{zone_conf_dir};
+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 $master_dir and -r $master_dir ) {
+    die "$master_dir: $!\n";
 }
 
-unless (-d $bind_dir and -r $bind_dir) {
-        die "$bind_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 
+# 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 = $_;
+    s#($master_dir/)(.*)#$2#;
+    my $zone = $_;
 
-	my $zone_file = "$master_dir/$zone/$zone";
-	my $conf_file = "$conf_dir/$zone";
-	my @c_content;
+    my $zone_file = "$master_dir/$zone/$zone";
+    my $conf_file = "$conf_dir/$zone";
+    my @c_content;
 
-	unless (-f "$conf_file" ) {
-		die "$conf_file: $! \n";	
-	}
+    unless ( -f "$conf_file" ) {
+        die "$conf_file: $! \n";
+    }
 
-	if (-f "$zone_file.signed") {
+    if ( -f "$zone_file.signed" ) {
 
-		open (FILE, "<$conf_file") or die "$conf_file: $!\n";
-		@c_content = <FILE>;
-		close (FILE);
+        open( FILE, "<$conf_file" ) or die "$conf_file: $!\n";
+        @c_content = <FILE>;
+        close(FILE);
 
-		for (@c_content) {
-			if (m{(.*)($zone_file)(";)}) {
-				print "$2 ==> $2.signed\n";
-				$_ = "$1$2.signed$3\n";
-			}
+        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);
+            open( FILE, ">$conf_file" ) or die "$conf_file: $!\n";
+            print FILE @c_content;
+            close(FILE);
 
-		}
-	}
-	else {
+        }
+    }
+    else {
+
+        open( FILE, "<$conf_file" ) or die "$conf_file: $!\n";
+        @c_content = <FILE>;
+        close(FILE);
 
-		open (FILE, "<$conf_file") or die "$conf_file: $!\n";
-		@c_content = <FILE>;
-		close (FILE);
-		
-		for (@c_content) {
-			if (m{(.*)($zone_file)\.signed(.*)}) {
-				print "$2.signed ==> $2\n";
-				$_ = "$1$2$3\n";
-			}
-		}
+        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);
-	}
+        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";
+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 <FROM>;
-	close (FROM);
+    open( FROM, "$_" ) or die "$_: $! \n";
+    print TO <FROM>;
+    close(FROM);
 }
 close(TO);
 
-
 system "named-checkconf";
 system "named-checkconf -z";
 system "rndc reload";