From b53593dd74b1c255d6e3cba0eef5ade14b6d6c2b Mon Sep 17 00:00:00 2001 From: Florent Villard Date: Fri, 28 Feb 2003 15:26:37 +0000 Subject: fix dhcp wizard --- common/scripts/IFCFG.pm | 4 +++- dhcp_wizard/dhcp.wiz | 52 ++++++++++++++++++++++++++++++++++++++--- dhcp_wizard/scripts/Dhcpconf.pm | 18 +++++++------- drakwizard.pl | 4 ++-- po/drakwizard.pot | 34 ++++++++++++++++----------- 5 files changed, 85 insertions(+), 27 deletions(-) diff --git a/common/scripts/IFCFG.pm b/common/scripts/IFCFG.pm index 2d1171ba..669525f7 100644 --- a/common/scripts/IFCFG.pm +++ b/common/scripts/IFCFG.pm @@ -43,6 +43,8 @@ sub new { } } %{$self->{network}} = getVarsFromSh("/etc/sysconfig/network"); + $self->{network}{HOSTNAME} ||= `hostname` and chomp $self->{network}{HOSTNAME}; + ($self->{network}{DOMAINNAME}) = $self->{network}{HOSTNAME} =~ /\.(.*)/ || (`dnsdomainname`) and chomp $self->{network}{DOMAINNAME}; bless $self; } @@ -72,7 +74,7 @@ sub network_get { my $self = shift; my ($key) = @_; - exists $self->{network}->{$key} or die "no $key field in network hash"; + exists $self->{network}{$key} or die "no $key field in network hash"; $self->{network}{$key}; } diff --git a/dhcp_wizard/dhcp.wiz b/dhcp_wizard/dhcp.wiz index f95284f1..93164559 100644 --- a/dhcp_wizard/dhcp.wiz +++ b/dhcp_wizard/dhcp.wiz @@ -9,6 +9,7 @@ defaultImage="__WIZ_HOME__/dhcp_wizard/images/DHCP.png" perlModule="__WIZ_HOME__/dhcp_wizard/scripts/Dhcpconf.pm" rpm="dhcp-server" + summaryFunc="do_it" > + + + + + + + - - + @@ -168,6 +180,40 @@ + + + + + + + + + + + + $d2) { standalone::explanations("DHCP wizard : bad range"); return 1} - if ($ds >= $d1 && $ds <= $d2) { standalone::explanations("DHCP wizard : server in range"); return 1} + if ($ds >= $d1 && $ds <= $d2) { standalone::explanations("DHCP wizard : server in range"); return 3} 10; } @@ -74,6 +74,8 @@ sub do_it { my $wiz_domain_name = $o->network_get("DOMAINNAME"); my $wiz_host_name = $o->network_get("HOSTNAME"); my $wiz_ip_net = "$1.$2.$3.0" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + my $err = check(); + return $err if $err != 10; my $wiz_ip_range1 = $ENV{wiz_ip_range1}; my $wiz_ip_range2 = $ENV{wiz_ip_range2}; my $wiz_ip_netmask = $o->itf_get("NETMASK"); @@ -92,7 +94,7 @@ sub do_it { if (!`grep INTERFACES $file`){ MDK::Common::append_to_file($file, "\nINTERFACES=$wiz_device"); MDK::Common::cp_af($file, $file . ".orig"); - my $tmp = `mktemp /tmp/Dhcpconf.XXXXXX` or die "can't make a temp file: $!"; + my $tmp = `/bin/mktemp /tmp/Dhcpconf.XXXXXX` or die "can't make a temp file: $!"; open(NEW, "> $tmp") or die "can't open $tmp: $!"; open(OLD, "< $file") or die "can't open default: $!"; while () { @@ -132,11 +134,11 @@ mask = $wiz_ip_netmask, rng1 = $wiz_ip_range1, rng2 = $wiz_ip_range2, dname = $w $mdk{interfaces} = $wiz_device; standalone::explanations("$file: lease_file = $mdk{lease_file}, interfaces = $mdk{interfaces}"); Vareqval->commit($file, \%mdk); + !$ENV{wiz_authoritative} and output($file, map { + s|^\s*not\s*authoritative.*|\#$&|i; + $_ + } cat_ ("/etc/dhcpd.conf")); } - !$ENV{wiz_authoritative} and output($file, map { - s|^\s*not\s*authoritative.*|\#$&|i; - $_; - } cat_ ("/etc/dhcpd.conf")); system("/etc/rc.d/init.d/dhcpd restart"); 10; diff --git a/drakwizard.pl b/drakwizard.pl index 9583ddc7..f79c163e 100755 --- a/drakwizard.pl +++ b/drakwizard.pl @@ -315,8 +315,8 @@ sub display { if ($page->{nextFinish} eq 'true') { $::Wizard_no_previous = 1; $in->ask_okcancel(translate($page->{name}), - translate($page->{info})) or quit_global($in, 0); - die; + translate($page->{info})); # or quit_global($in, 0); + exit; } elsif (!$page->{freetext}) { $in->ask_okcancel(translate($page->{name}), diff --git a/po/drakwizard.pot b/po/drakwizard.pot index 4bdb34e8..bb123e2d 100644 --- a/po/drakwizard.pot +++ b/po/drakwizard.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2003-02-28 11:55+0100\n" +"POT-Creation-Date: 2003-03-01 12:29+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -84,7 +84,7 @@ msgstr "" msgid "Adding a new client to your network" msgstr "" -#: ../client_wizard/client.wiz_.c:14 ../dhcp_wizard/dhcp.wiz_.c:18 +#: ../client_wizard/client.wiz_.c:14 ../dhcp_wizard/dhcp.wiz_.c:19 #: ../dns_wizard/dns.wiz_.c:21 msgid "System error, no configuration done" msgstr "" @@ -145,7 +145,7 @@ msgid "DNS Wizard (add client)" msgstr "" #: ../client_wizard/client.wiz_.c:26 ../db_wizard/db.wiz_.c:12 -#: ../dhcp_wizard/dhcp.wiz_.c:14 ../dns_wizard/dns.wiz_.c:15 +#: ../dhcp_wizard/dhcp.wiz_.c:15 ../dns_wizard/dns.wiz_.c:15 #: ../firewall_wizard/firewall.wiz_.c:14 ../ftp_wizard/ftp.wiz_.c:17 #: ../news_wizard/news.wiz_.c:14 ../nfs_wizard/nfs.wiz_.c:12 #: ../postfix_wizard/postfix.wiz_.c:16 ../proxy_wizard/proxy.wiz_.c:44 @@ -155,7 +155,7 @@ msgstr "" msgid "Quit" msgstr "" -#: ../client_wizard/client.wiz_.c:27 ../dhcp_wizard/dhcp.wiz_.c:15 +#: ../client_wizard/client.wiz_.c:27 ../dhcp_wizard/dhcp.wiz_.c:16 #: ../ftp_wizard/ftp.wiz_.c:19 ../web_wizard/apache2.wiz_.c:22 #: ../web_wizard/web.wiz_.c:22 msgid "Warning\\nYou are in dhcp, server may not work with your configuration." @@ -168,7 +168,7 @@ msgid "" msgstr "" #: ../client_wizard/client.wiz_.c:29 ../db_wizard/db.wiz_.c:18 -#: ../dhcp_wizard/dhcp.wiz_.c:17 ../dns_wizard/dns.wiz_.c:19 +#: ../dhcp_wizard/dhcp.wiz_.c:18 ../dns_wizard/dns.wiz_.c:19 #: ../firewall_wizard/firewall.wiz_.c:20 ../ftp_wizard/ftp.wiz_.c:23 #: ../news_wizard/news.wiz_.c:21 ../nfs_wizard/nfs.wiz_.c:17 #: ../postfix_wizard/postfix.wiz_.c:24 ../proxy_wizard/proxy.wiz_.c:49 @@ -342,36 +342,44 @@ msgid "Range of addresses used by dhcp" msgstr "" #: ../dhcp_wizard/dhcp.wiz_.c:12 -msgid "The wizard successfully configured the DHCP services of your server." +msgid "The IP of the server must not be in range" msgstr "" #: ../dhcp_wizard/dhcp.wiz_.c:13 +msgid "The wizard successfully configured the DHCP services of your server." +msgstr "" + +#: ../dhcp_wizard/dhcp.wiz_.c:14 msgid "" "Select the range of addresses assigned to the workstations by the DHCP " "service; unless you have special needs, you can safely accept the proposed " "values." msgstr "" -#: ../dhcp_wizard/dhcp.wiz_.c:16 +#: ../dhcp_wizard/dhcp.wiz_.c:17 msgid "The IP range specified is not correct" msgstr "" -#: ../dhcp_wizard/dhcp.wiz_.c:19 +#: ../dhcp_wizard/dhcp.wiz_.c:20 +msgid "The IP range specified is not in server network address range" +msgstr "" + +#: ../dhcp_wizard/dhcp.wiz_.c:21 msgid "" "DHCP is a service that automatically assigns networking addresses to your " "workstations." msgstr "" -#: ../dhcp_wizard/dhcp.wiz_.c:20 +#: ../dhcp_wizard/dhcp.wiz_.c:22 msgid "Highest IP Address:" msgstr "" -#: ../dhcp_wizard/dhcp.wiz_.c:21 -msgid "DHCP Configuration Wizard" +#: ../dhcp_wizard/dhcp.wiz_.c:23 +msgid "Configuring the DHCP Server" msgstr "" -#: ../dhcp_wizard/dhcp.wiz_.c:22 -msgid "Configuring the DHCP Server" +#: ../dhcp_wizard/dhcp.wiz_.c:24 +msgid "DHCP Configuration Wizard" msgstr "" #: ../dns_wizard/dns.wiz_.c:1 -- cgit v1.2.1