# HG changeset patch # User Heiko Schlittermann (JUMPER) # Date 1400847357 -7200 # Node ID ae069be66c3f41876952288f226bad30feab0fd9 # Parent efba68ef7f89609da06c887bdef303442d49223c automatic server detection diff -r efba68ef7f89 -r ae069be66c3f bin/dnsvi --- a/bin/dnsvi Fri May 23 13:04:19 2014 +0200 +++ b/bin/dnsvi Fri May 23 14:15:57 2014 +0200 @@ -28,11 +28,16 @@ && @ARGV == 1 or pod2usage(); + my $zone = shift @ARGV; + + $o{server} = (split ' ', `dig +short soa $zone`)[0] + if not defined $o{server}; + my @dig = ( dig => 'AXFR', defined $o{key} ? (-k => $o{key}) : (), defined $o{server} ? ("\@$o{server}") : (), - $ARGV[0] + $zone ); my @zone1 = grep { @@ -57,6 +62,7 @@ (grep { $_->{rrtype} eq 'SOA' } map { $_->{rrset} } @zone1)[0]; my @cmds = ( + "server $o{server}", "prereq yxrrset @{$orig_soa}{qw{label rrtype data}}", (map { "update delete $_" } @$del), (map { "update add $_" } @$add), @@ -103,6 +109,25 @@ =head1 DESCRIPTION +This tools supports you in maintaining a dynamic +zone. + +=head2 OPTIONS + +=over + +=item B<-s>|B<--server> B + +The name of the server to contact for the AXFR and the update. +(default: main nameserver from the SOA record) + +=item B<-k>|B<--key> B + +The name of the key file we need for TSIG (the AXFR will use it, +as well as the update). + +=back + =head1 PREREQUISITES We need some tools to be installed: