diff --git a/Makefile.PL b/Makefile.PL index 0d38d27..bf9b8d7 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -3,8 +3,8 @@ use ExtUtils::MakeMaker; WriteMakefile( 'NAME' => 'Martnet::DDNS', 'VERSION_FROM' => 'DDNS.pm', - 'PREREQ_PM' => { Net::DNS => 0.8, - File::Temp => 0.2304, + 'PREREQ_PM' => { Net::DNS => 0.66, + File::Temp => 0.22, Regexp::Common => 2013031301, }, 'EXE_FILES' => [ 'bin/add-vhost', diff --git a/bin/sync-slave b/bin/sync-slave index bf2f6c6..bb27d11 100755 --- a/bin/sync-slave +++ b/bin/sync-slave @@ -5,6 +5,8 @@ use warnings; use Martnet::DDNS; use File::Temp qw/tempfile/; +my $force = shift; # a "force" flag, if the update is big + my $ddns = Martnet::DDNS->new(); my @vh = $ddns->get(); @@ -15,12 +17,17 @@ my @all = parse_slavefile("/etc/bind/martnet.slave.zones.9"); my $changecount = 0; foreach my $i (@vh) { unless (contains_zone($i, @all)) { - # If we find any differences, we rewrite the file - do_rewrite(@vh); - last; + $changecount++; } } +die "Cowardly refusing to make a big update automatically" + if ($changecount > 10 && !$force); + +if ($changecount) { + do_rewrite(@vh); +} + exit 0; sub parse_slavefile {