mkready
changeset 22 7229d1c95ea8
parent 21 6715f8f9d04c
child 25 c02caf4e0eb6
--- a/mkready	Thu Jul 29 14:19:56 2010 +0200
+++ b/mkready	Mon Aug 02 11:15:18 2010 +0200
@@ -2,9 +2,24 @@
 
 use strict;
 
-my $bind_dir = "/etc/bind";
-my $conf_dir = "/etc/bind/zones.d";
-my $master_dir = "/etc/bind/master";
+my %config;
+open (CONFIG, "dnstools.conf");
+while (<CONFIG>) {
+        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};
 chomp (my @conf_dir_files = `ls $conf_dir`);
 
 # prueft jede domain, die ein verzeichnis in $master_dir hat, ob es eine
@@ -25,7 +40,7 @@
 		@c_content = <FILE>;
 		close (FILE);
 
-		foreach (@c_content) {
+		for (@c_content) {
 			if (m{(.*)($zone_file)(";)}) {
 				print "$2 ==> $2.signed\n";
 				$_ = "$1$2.signed$3\n";
@@ -43,7 +58,7 @@
 		@c_content = <FILE>;
 		close (FILE);
 		
-		foreach (@c_content) {
+		for (@c_content) {
 			if (m{(.*)($zone_file)\.signed(.*)}) {
 				print "$2.signed ==> $2\n";
 				$_ = "$1$2$3\n";
@@ -58,7 +73,7 @@
 
 # erzeugt eine named.conf-datei aus den entsprechenden vorlagen.
 open( TO, ">$bind_dir/named.conf.zones");
-foreach (@conf_dir_files) {
+for (@conf_dir_files) {
 	open (FROM, "$conf_dir/$_");
 	print TO <FROM>;
 	close (FROM);