move data out of /etc and in to /var
This commit is contained in:
@ -12,7 +12,7 @@ my @vh = $ddns->get('_vhosts');
|
|||||||
# For each virtual host, generate a vhost zone file if there isn't one
|
# For each virtual host, generate a vhost zone file if there isn't one
|
||||||
my $changecount = 0;
|
my $changecount = 0;
|
||||||
foreach my $i (@vh) {
|
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 ) {
|
unless ( -f $zf ) {
|
||||||
print "Generating new zone file for $i->{zone}\n";
|
print "Generating new zone file for $i->{zone}\n";
|
||||||
open(my $fh, ">", $zf)
|
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.
|
# For each vhost in /var/lib/bind/vhost, make sure it has an entry in the zone file.
|
||||||
foreach my $i (</etc/bind/vhost/*>) {
|
foreach my $i (</var/lib/bind/vhost/*>) {
|
||||||
my ($zone) = ($i =~ /\/db.(.+)$/);
|
my ($zone) = ($i =~ /\/db.(.+)$/);
|
||||||
next unless ($zone);
|
next unless ($zone);
|
||||||
unless (contains_zone($zone, @vh)) {
|
unless (contains_zone($zone, @vh)) {
|
||||||
@ -37,11 +37,11 @@ if ($changecount) {
|
|||||||
# If we made any changes, then generate the full vhost list
|
# If we made any changes, then generate the full vhost list
|
||||||
my ($fh, $path) = tempfile();
|
my ($fh, $path) = tempfile();
|
||||||
foreach my $i (sort {$a->{zone} cmp $b->{zone}} @vh) {
|
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;
|
close $fh;
|
||||||
print "Installing new vhost list\n";
|
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";
|
print "Reloading DNS files\n";
|
||||||
system("rndc reload");
|
system("rndc reload");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ use Martnet::DDNS;
|
|||||||
|
|
||||||
my $ddns = Martnet::DDNS->new();
|
my $ddns = Martnet::DDNS->new();
|
||||||
|
|
||||||
my $path = '/etc/bind';
|
my $datapath = '/var/lib/bind';
|
||||||
|
|
||||||
my %files = ( 'custom.zones.9' => '_custom',
|
my %files = ( 'custom.zones.9' => '_custom',
|
||||||
'martnet.zones.9' => '_custom',
|
'martnet.zones.9' => '_custom',
|
||||||
@ -21,7 +21,7 @@ our %fixes = ( '_custom' => 'add-custom',
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach my $i (keys %files) {
|
foreach my $i (keys %files) {
|
||||||
validate_file($path . '/' . $i, $files{$i});
|
validate_file($datapath . '/' . $i, $files{$i});
|
||||||
}
|
}
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user