diff options
author | Florent Villard <warly@mandriva.com> | 2003-02-28 15:26:37 +0000 |
---|---|---|
committer | Florent Villard <warly@mandriva.com> | 2003-02-28 15:26:37 +0000 |
commit | b53593dd74b1c255d6e3cba0eef5ade14b6d6c2b (patch) | |
tree | a446593e92227ae5df575cfb68d59babb2dc7ff3 | |
parent | e50ac7719ada4befb44f5e5ae57f5c3cd4ff2e68 (diff) | |
download | drakwizard-b53593dd74b1c255d6e3cba0eef5ade14b6d6c2b.tar drakwizard-b53593dd74b1c255d6e3cba0eef5ade14b6d6c2b.tar.gz drakwizard-b53593dd74b1c255d6e3cba0eef5ade14b6d6c2b.tar.bz2 drakwizard-b53593dd74b1c255d6e3cba0eef5ade14b6d6c2b.tar.xz drakwizard-b53593dd74b1c255d6e3cba0eef5ade14b6d6c2b.zip |
fix dhcp wizard
-rw-r--r-- | common/scripts/IFCFG.pm | 4 | ||||
-rw-r--r-- | dhcp_wizard/dhcp.wiz | 52 | ||||
-rw-r--r-- | dhcp_wizard/scripts/Dhcpconf.pm | 18 | ||||
-rwxr-xr-x | drakwizard.pl | 4 | ||||
-rw-r--r-- | 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" > <Variable @@ -87,6 +88,19 @@ jumpIndex="1" > </Target> + + <Target + targetName="range_not_in_network" + jumpIndex="2" + > + </Target> + + <Target + targetName="server_in_range" + jumpIndex="3" + > + </Target> + <Target targetName="doit" @@ -104,8 +118,7 @@ helpText="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." > </Info> - - + <Freetext name="dhcpIpLow" variableName="dhcp_range_low" @@ -140,7 +153,6 @@ name="error_dhcp" jumpPage="ask_dhcp_ip_range" executionLevel="NORMAL" - nextFinish="true" canBack="true" canCancel="true" > @@ -170,6 +182,40 @@ <Page helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-dhcp.html" + name="range_not_in_network" + jumpPage="ask_dhcp_ip_range" + nextButtonText="Fix it" + executionLevel="NORMAL" + nextFinish="false" + canBack="true" + canCancel="true" + > + + <Info + helpText="The IP range specified is not in server network address range" + > + </Info> + </Page> + + <Page + helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-dhcp.html" + name="server_in_range" + jumpPage="ask_dhcp_ip_range" + nextButtonText="Fix it" + executionLevel="NORMAL" + nextFinish="false" + canBack="true" + canCancel="true" + > + + <Info + helpText="The IP of the server must not be in range" + > + </Info> + </Page> + + <Page + helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-dhcp.html" name="doit" func="do_it" nextButtonText="Configure" diff --git a/dhcp_wizard/scripts/Dhcpconf.pm b/dhcp_wizard/scripts/Dhcpconf.pm index d3504d5a..d94db67d 100644 --- a/dhcp_wizard/scripts/Dhcpconf.pm +++ b/dhcp_wizard/scripts/Dhcpconf.pm @@ -56,12 +56,12 @@ sub check { my $ds = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; if (!$r1_trunc) { standalone::explanations("DHCP wizard : incorrect adress range 1"); return 1} if (!$r2_trunc) { standalone::explanations("DHCP wizard : incorrect adress range 2"); return 1} - if ($r1_trunc != $s_trunc || $r2_trunc != $s_trunc) { + if ($r1_trunc ne $s_trunc || $r2_trunc ne $s_trunc) { standalone::explanations("DHCP wizard : range not in network"); - return 1; + return 2; } if (!$d1 || !$d2 || $d1 > $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 (<OLD>) { @@ -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 <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\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 |