#!/usr/bin/perl -I /root/tgmanage use strict; use NetAddr::IP; BEGIN { require "include/config.pm"; eval { require "include/config.local.pm"; }; } use Net::IP; use Net::IP qw(:PROC); unless ( (($#ARGV == 0 ) || ( $#ARGV == 1)) && (( $ARGV[0] eq "master" ) || ( $ARGV[0] eq "slave" )) ) { print STDERR "Invalid usage!\ncat netnames.txt | $0 [basedir]\n"; exit 1; } my $role = $ARGV[0]; my $base = "/etc"; $base = $ARGV[1] if $#ARGV == 1; $base .= "/" if not $base =~ m/\/$/ and not $base eq ""; my $bind_base = $base . "bind/"; my $named_file = $bind_base . "named.conf"; if ( -f $named_file ) { print STDERR $named_file . " already exists. Cowardly refusing to continue.\n"; exit; } my $run = `date +%Y%m%d-%H%M`; open NFILE, ">" . $named_file or die ( $! . " " . $named_file ); chomp $run; print NFILE <new($nms::config::base_ipv6net)->split(32)){ my $ipv6 = Net::IP->new($ipv6_net); (my $ipv6zone = $ipv6->reverse_ip()) =~ s/\.$//; print NFILE <new($nms::config::base_ipv6net)->split(32)){ my $ipv6 = Net::IP->new($ipv6_net); (my $ipv6zone = $ipv6->reverse_ip()) =~ s/\.$//; print NFILE <