From 20ec97c86e17cc7a392ea49483f13b133b7576a4 Mon Sep 17 00:00:00 2001 From: Arnaud Desmons Date: Fri, 20 Sep 2002 09:44:46 +0000 Subject: test /etc/named.conf --- dns_wizard/scripts/Dnsconf.pm | 33 ++++++++++++++++++++++----------- 1 file 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 () { - $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 () { + $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__"; -- cgit v1.2.1