summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-09-20 09:44:46 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-09-20 09:44:46 +0000
commit20ec97c86e17cc7a392ea49483f13b133b7576a4 (patch)
tree867c9415e423dadca3dccb0caf8dfbd8017cd9fa
parentbcc0931e716d3a7f529cf02051d84c6a94d3ece5 (diff)
downloaddrakwizard-20ec97c86e17cc7a392ea49483f13b133b7576a4.tar
drakwizard-20ec97c86e17cc7a392ea49483f13b133b7576a4.tar.gz
drakwizard-20ec97c86e17cc7a392ea49483f13b133b7576a4.tar.bz2
drakwizard-20ec97c86e17cc7a392ea49483f13b133b7576a4.tar.xz
drakwizard-20ec97c86e17cc7a392ea49483f13b133b7576a4.zip
test /etc/named.conf
-rw-r--r--dns_wizard/scripts/Dnsconf.pm33
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__";