]> git.sesse.net Git - nms/blob - config/make-missing-zones.pl
Add make-missing-zones.pl from TG05, adjusting for TG06.
[nms] / config / make-missing-zones.pl
1 #! /usr/bin/perl -w
2 use strict;
3
4 # les inn nettnavn
5 my %netnames = ();
6 open NAMES, "switches.txt"
7         or die "switches.txt: $!";
8 while (<NAMES>) {
9         chomp;
10         /194\.0\.(\d+\.\d+)\s+(\S+)\s+(\S+)/ or next;
11         $netnames{$1} = $3;
12 }
13 close NAMES;
14
15 for my $net (keys %netnames) {
16         my $domain = $netnames{$net};
17         my @domains;
18         if ($domain =~ /^split:(.*)/) {
19                 @domains = split /,/, $1;
20         } else {
21                 @domains = ($domain);
22         }
23
24         for my $d (@domains) {
25                 -f "/etc/bind/dynamic/$domain.tg06.gathering.org" and next;
26                         
27                 print "/etc/bind/dynamic/$domain.tg06.gathering.org\n";
28                 open ZONE, ">/etc/bind/dynamic/$domain.tg06.gathering.org"
29                         or die "/etc/bind/dynamic/$domain.tg06.gathering.org";
30
31                 print ZONE <<"EOF";
32 ; autogenerated and updated from dhcpd -- DO NOT TOUCH!
33 \$TTL 3600
34 @       IN      SOA     fortran.tg06.gathering.org.     postmaster.fortran.tg06.gathering.org. (
35                         3   ; serial
36                         3600 ; refresh 
37                         1800 ; retry
38                         608400 ; expire
39                         3600 ) ; minimum and default TTL
40
41                 IN      NS      fortran.tg06.gathering.org.
42                 IN      NS      lisp.tg06.gathering.org.
43
44 EOF
45         }
46 }