38 my $customer = shift; |
38 my $customer = shift; |
39 |
39 |
40 die "$cf{master_dir}: $!" if not -d -r -x $cf{master_dir}; |
40 die "$cf{master_dir}: $!" if not -d -r -x $cf{master_dir}; |
41 die "$cf{zone_conf_dir}: $!" if not -d -r -x $cf{zone_conf_dir}; |
41 die "$cf{zone_conf_dir}: $!" if not -d -r -x $cf{zone_conf_dir}; |
42 |
42 |
43 # legt fuer jede domain in @ARGV ein verzeichnis in $master_dir an. |
43 # legt fuer jede Zone in @ARGV ein verzeichnis in $master_dir an. |
44 # schreibt aus den angegebenen templates die dateien $zonefile und $config |
44 # schreibt aus den angegebenen templates die dateien $zonefile und $config |
45 # in die entsprechenden verzeichnisse. |
45 # in die entsprechenden verzeichnisse. |
46 for my $utf8domain (@ARGV) { |
46 for my $utf8zone (@ARGV) { |
47 |
47 |
48 my $domain = idn_to_ascii($utf8domain, $CHARSET); |
48 my $zone = idn_to_ascii($utf8zone, $CHARSET); |
49 my $zonefile = "$cf{master_dir}/$domain/$domain"; |
49 my $zonefile = "$cf{master_dir}/$zone/$zone"; |
50 my $configfile = "$cf{zone_conf_dir}/$domain"; |
50 my $configfile = "$cf{zone_conf_dir}/$zone"; |
51 my $now = time; |
51 my $now = time; |
52 |
52 |
53 make_path dirname $zonefile; |
53 make_path dirname $zonefile; |
54 |
54 |
55 if (-f $zonefile and not $opt_force) { |
55 if (-f $zonefile and not $opt_force) { |
56 say "skipping $utf8domain: zone file '$zonefile' exists."; |
56 say "skipping $utf8zone: zone file '$zonefile' exists."; |
57 next; |
57 next; |
58 } |
58 } |
59 |
59 |
60 if (-f $configfile and not $opt_force) { |
60 if (-f $configfile and not $opt_force) { |
61 say "skipping $utf8domain: config file '$configfile' exists."; |
61 say "skipping $utf8zone: config file '$configfile' exists."; |
62 next; |
62 next; |
63 } |
63 } |
64 |
64 |
65 say "domain $utf8domain ($domain) for $customer."; |
65 say "zone $utf8zone ($zone) for $customer."; |
66 |
66 |
67 my %vars = ( |
67 my %vars = ( |
68 domain => $domain, |
68 zone => $zone, |
69 utf8domain => $utf8domain, |
69 utf8zone => $utf8zone, |
70 now => $now, |
70 now => $now, |
71 zonefile => abs_path($zonefile), |
71 zonefile => abs_path($zonefile), |
72 customer => $customer, |
72 customer => $customer, |
73 hostmaster => $cf{hostmaster}, |
73 hostmaster => $cf{hostmaster}, |
74 primary => $cf{primary}, |
74 primary => $cf{primary}, |