diff options
-rw-r--r-- | dns_wizard/scripts/Dnsconf.pm | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/dns_wizard/scripts/Dnsconf.pm b/dns_wizard/scripts/Dnsconf.pm index b73359b5..b03a6345 100644 --- a/dns_wizard/scripts/Dnsconf.pm +++ b/dns_wizard/scripts/Dnsconf.pm @@ -30,21 +30,32 @@ my $o = DrakconnectConf->new(); my $dns1; my $dns2; +sub get_root { + my $file = "/etc/sysconfig/named"; + if (-f $file) { + my %mdk = Vareqval->get($file); + return $mdk{ROOTDIR}; + } + ""; +} + my $file = "/etc/named.conf"; -open (NEW, "< $file"); -DNS : while (<NEW>) { - $dns2 = ""; - if (m/^\s*options\s*\{/s...m/^\s*\}\;/s ) { - if (m/^\s*forwarders\s*\{/s...m/^\s*\}\;/s ) { - if (/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/) { - $dns2 = "$1.$2.$3.$4"; - $dns1 and next DNS; - $dns1 = $dns2; +if (-f $file) { + open (NEW, "< $file"); + DNS : while (<NEW>) { + $dns2 = ""; + if (m/^\s*options\s*\{/s...m/^\s*\}\;/s ) { + if (m/^\s*forwarders\s*\{/s...m/^\s*\}\;/s ) { + if (/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/) { + $dns2 = "$1.$2.$3.$4"; + $dns1 and next DNS; + $dns1 = $dns2; + } } } } + close (NEW); } -close (NEW); sub get_dns1 { $dns1; @@ -87,7 +98,7 @@ sub do_it { MDK::Common::cp_af("__WIZ_HOME__/dns_wizard/scripts/host.conf.default", $file); $file = "/etc/named.conf"; - MDK::Common::cp_af($file, $file.".orig"); + -f $file and MDK::Common::cp_af($file, $file.".orig"); my $ispns1 = $ENV{wiz_ext_dns1} || "// __ISPN1__"; my $ispns2 = $ENV{wiz_ext_dns2} || "// __ISPN2__"; |