From 3149ec2cea798403594b24ce181141e08f8484ab Mon Sep 17 00:00:00 2001 From: Jorj Bauer Date: Wed, 15 Jan 2020 10:49:40 -0500 Subject: [PATCH] move data out of /etc and in to /var --- bin/sync-master-vhosts | 10 +++++----- bin/validate-master | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/sync-master-vhosts b/bin/sync-master-vhosts index c0b46fe..d9373c8 100755 --- a/bin/sync-master-vhosts +++ b/bin/sync-master-vhosts @@ -12,7 +12,7 @@ my @vh = $ddns->get('_vhosts'); # For each virtual host, generate a vhost zone file if there isn't one my $changecount = 0; foreach my $i (@vh) { - my $zf = "/etc/bind/vhost/db.$i->{zone}"; + my $zf = "/var/lib/bind/bind/vhost/db.$i->{zone}"; unless ( -f $zf ) { print "Generating new zone file for $i->{zone}\n"; open(my $fh, ">", $zf) @@ -22,8 +22,8 @@ foreach my $i (@vh) { } } -# For each vhost in /etc/bind/vhost, make sure it has an entry in the zone file. -foreach my $i () { +# For each vhost in /var/lib/bind/vhost, make sure it has an entry in the zone file. +foreach my $i () { my ($zone) = ($i =~ /\/db.(.+)$/); next unless ($zone); unless (contains_zone($zone, @vh)) { @@ -37,11 +37,11 @@ if ($changecount) { # If we made any changes, then generate the full vhost list my ($fh, $path) = tempfile(); foreach my $i (sort {$a->{zone} cmp $b->{zone}} @vh) { - print $fh "zone \"$i->{zone}\" { type master; file \"/etc/bind/vhost/db.$i->{zone}\"; };\n"; + print $fh "zone \"$i->{zone}\" { type master; file \"/var/lib/bind/vhost/db.$i->{zone}\"; };\n"; } close $fh; print "Installing new vhost list\n"; - system("install -o bind -g bind $path /etc/bind/vhost.zones.9"); + system("install -o bind -g bind $path /var/lib/bind/vhost.zones.9"); print "Reloading DNS files\n"; system("rndc reload"); } diff --git a/bin/validate-master b/bin/validate-master index 6a23e7e..ac5b971 100755 --- a/bin/validate-master +++ b/bin/validate-master @@ -6,7 +6,7 @@ use Martnet::DDNS; my $ddns = Martnet::DDNS->new(); -my $path = '/etc/bind'; +my $datapath = '/var/lib/bind'; my %files = ( 'custom.zones.9' => '_custom', 'martnet.zones.9' => '_custom', @@ -21,7 +21,7 @@ our %fixes = ( '_custom' => 'add-custom', ); foreach my $i (keys %files) { - validate_file($path . '/' . $i, $files{$i}); + validate_file($datapath . '/' . $i, $files{$i}); } exit 0;