--- a/zone-mk Thu Jul 29 14:19:56 2010 +0200
+++ b/zone-mk Mon Aug 02 11:15:18 2010 +0200
@@ -2,16 +2,30 @@
use strict;
-
if (@ARGV < 2) {
print "usage: zone-mk kundennummer domain ... \n";
exit 1;
}
-my $primary = "pu.schlittermann.de";
-my $secondary= "hh.schlittermann.de";
-my $zone_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 $primary = $config{primary};
+my $secondary= $config{secondary};
+my $zone_conf_dir= $config{zone_conf_dir};
+my $master_dir = $config{master_dir};
my $customer = shift @ARGV;
chomp (my $primary_ip = `dig +short $primary`);
chomp (my $secondary_ip = `dig +short $secondary`);
@@ -22,11 +36,11 @@
chomp (my $start= `date -I`);
my $hostmaster = "hostmaster.$this_domain";
-if (! -e $master_dir) {
+unless (-e $master_dir) {
print "$master_dir nicht vorhanden \n";
exit 1;
}
-if (! -e $zone_conf_dir) {
+unless (-e $zone_conf_dir) {
print "$zone_conf_dir nicht vorhanden \n";
exit 1;
}
@@ -36,14 +50,14 @@
# schreibt aus den angegebenen templates die dateien $zonefile und $config
# in die entsprechenden verzeichnisse.
-foreach (@ARGV) {
+for (@ARGV) {
chomp (my $domain = `idn --quiet "$_"`);
my $zonefile = "$master_dir/$domain/$domain";
my $config = "$zone_conf_dir/$domain";
my $utf8domain = "$_";
- if (! -e "$master_dir/$domain") {
+ unless ( -e "$master_dir/$domain") {
`mkdir $master_dir/$domain`;
}
@@ -64,7 +78,7 @@
my @tempzone = <TEMPZONE>;
close (TEMPZONE);
- foreach (@tempzone) {
+ for (@tempzone) {
s#<start>#$start#;
s#<domain>#$domain#;
s#<time>#$time#;
@@ -83,7 +97,7 @@
my @tempconf = <TEMPCONF>;
close (TEMPCONF);
- foreach (@tempconf) {
+ for (@tempconf) {
s#<domain>#$domain#;
s#<start>#$start#;
s#<customer>#$customer#;