summaryrefslogtreecommitdiffstats
path: root/dns_wizard/scripts
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-08-19 15:19:31 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-08-19 15:19:31 +0000
commit292d58ccde72dd1bb351367a2302efb4c16d0c81 (patch)
treed34674ea67ff44d32a66dd683f52bb6c6ef703cd /dns_wizard/scripts
parent20c5db6f16b2a2cb7e2ab4402c3eced6dbf1789d (diff)
downloaddrakwizard-292d58ccde72dd1bb351367a2302efb4c16d0c81.tar
drakwizard-292d58ccde72dd1bb351367a2302efb4c16d0c81.tar.gz
drakwizard-292d58ccde72dd1bb351367a2302efb4c16d0c81.tar.bz2
drakwizard-292d58ccde72dd1bb351367a2302efb4c16d0c81.tar.xz
drakwizard-292d58ccde72dd1bb351367a2302efb4c16d0c81.zip
use of drakconnect db
Diffstat (limited to 'dns_wizard/scripts')
-rw-r--r--dns_wizard/scripts/Dnsconf.pm37
1 files changed, 13 insertions, 24 deletions
diff --git a/dns_wizard/scripts/Dnsconf.pm b/dns_wizard/scripts/Dnsconf.pm
index 744f6cc7..f5a00abb 100644
--- a/dns_wizard/scripts/Dnsconf.pm
+++ b/dns_wizard/scripts/Dnsconf.pm
@@ -2,10 +2,13 @@
package Dnsconf;
require "__WIZ_HOME__/common/scripts/Vareqval.pm";
+require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
use MDK::Common;
use strict;
use standalone;
+my $o = DrakconnectConf->new();
+
sub up_serial {
my ($file) = @_;
@@ -26,24 +29,13 @@ sub up_serial {
}
sub do_it {
- my %mdk = Vareqval->get("/etc/sysconfig/mdk_serv");
- my $wiz_domain_name = $mdk{wiz_domain_name} if defined $mdk{wiz_domain_name} or
- die "wiz_domain_name not in /etc/sysconfig/mdk_serv";
- my $wiz_host_name = $mdk{wiz_host_name} if defined $mdk{wiz_host_name} or
- die "wiz_host_name not in /etc/sysconfig/mdk_serv";
- my $device = $mdk{wiz_device} if defined $mdk{wiz_host_name} or
- die "wiz_device not in /etc/sysconfig/mdk_serv";
-
- my %mdk = Vareqval->get("/etc/sysconfig/network-scripts/ifcfg-".$device);
- my $wiz_ip_net = $mdk{NETWORK} if defined $mdk{NETWORK} or
- die "NETWORK not in /etc/sysconfig/network-scripts/ifcfg-$device";
- my $wiz_ip_server = $mdk{IPADDR} if defined $mdk{IPADDR} or
- die "IPADDR not in /etc/sysconfig/network-scripts/ifcfg-$device";
-
- my $s_trunc = "$1.$2.$3" if $wiz_ip_net =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
+ my $wiz_ip_server = $o->get_from_known_dev("IP");
+ my $wiz_domain_name = $o->get("DomainName");
+ my $wiz_host_name = $o->get("SystemName");
+ my $s_trunc = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $ds = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $host = "$1" if $wiz_host_name =~ /(.*?)\..*/;
- my $reversnet = "$3$2$1" if $wiz_ip_net =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
+ my $reversnet = "$3$2$1" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $file = "/etc/host.conf";
MDK::Common::cp_af($file, $file.".orig");
@@ -70,12 +62,12 @@ sub do_it {
# root.hints
$file="/var/named/root.hints";
- MDK::Common::cp_af($file, $file . ".orig");
+ -f $file and MDK::Common::cp_af($file, $file . ".orig");
MDK::Common::cp_af("__WIZ_HOME__/dns_wizard/scripts/root.hints.default", $file);
# 127.0.0.rev
$file="/var/named/127.0.0.rev";
- MDK::Common::cp_af($file, $file . ".orig");
+ -f $file and MDK::Common::cp_af($file, $file . ".orig");
output($file, map {
s|__hname__|$wiz_host_name|g;
$_;
@@ -84,7 +76,7 @@ sub do_it {
# $ipnet.rev
$file = "/var/named/$s_trunc.rev";
- MDK::Common::cp_af($file, $file.".orig");
+ -f $file and MDK::Common::cp_af($file, $file.".orig");
output($file, map {
s|__dname__|$wiz_domain_name|g;
s|__hname__|$wiz_host_name|g;
@@ -96,7 +88,7 @@ sub do_it {
# $domain.db
$file = "/var/named/$wiz_domain_name.db";
- MDK::Common::cp_af($file, $file.".orig");
+ -f $file and MDK::Common::cp_af($file, $file.".orig");
output($file, map {
s|__dname__|$wiz_domain_name|g;
s|__hname__|$wiz_host_name|g;
@@ -109,15 +101,12 @@ sub do_it {
#resolv.conf
$file = "/etc/resolv.conf";
- MDK::Common::cp_af($file, $file.".orig");
+ -f $file and MDK::Common::cp_af($file, $file.".orig");
open(NEW, "> $file");
print NEW "domain $wiz_domain_name\n";
print NEW "nameserver $wiz_ip_server\n";
system("/sbin/chkconfig --level 235 named on");
system("/etc/rc.d/init.d/named restart");
- %mdk = Vareqval->get("/etc/sysconfig/mdk_serv");
- $mdk{wiz_caching_dns} = "1";
- Vareqval->commit("/etc/sysconfig/mdk_serv", \%mdk);
10;
}