#!/usr/bin/perl # another quick one to add all those # zone files from flatdns.pl into something # useful, like say, a named.conf. Backs up # your named.conf first. $|++; use strict; use Getopt::Std; use File::Copy; use POSIX; my(@dnsdbs,$file,%args,$dbloc,$tmp); getopt('f:hd:s:',\%args); if(!defined $args{'f'} || !defined $args{'d'} || defined $args{'h'}) { print <>',$file) or die "Cannot open $file: $!"; @dnsdbs = glob("$dbloc*.{com,net,org,biz,us}"); for(@dnsdbs) { $tmp = $_; $tmp =~ s/\/.*\///; $tmp =~ s/db\.//; print DNSCF "zone $tmp {\n"; if(!defined $args{'s'}) { print DNSCF "\ttype master;\n"; print DNSCF "\tfile \"$_\";\n"; print DNSCF "};\n"; } else { print DNSCF "\ttype slave;\n"; print DNSCF "\tfile \"$_\";\n"; print DNSCF "\tmasters {\n"; print DNSCF "\t\t" . $args{'s'} . ";\n"; print DNSCF "\t};\n};\n"; } } close(DNSCF);