From 6189e1dd95b9ca5b90107573b6b11affd2544408 Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Wed, 28 Jan 2004 15:24:57 +0000 Subject: enable/disabel pxe --- dhcp_wizard/Dhcp.pm | 54 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm index 17158cab..1e26dc5b 100755 --- a/dhcp_wizard/Dhcp.pm +++ b/dhcp_wizard/Dhcp.pm @@ -26,7 +26,6 @@ use strict; use common; use MDK::Wizard::Varspaceval; -use services; use MDK::Wizard::Wizcommon; my $wiz = new MDK::Wizard::Wizcommon; @@ -35,11 +34,12 @@ my $wiz_tftpserverip = $wiz_ip_server; my $d = $4 if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; my $s = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; -my $o = { +my $o = { name => N("DHCP Wizard"), - var => { + var => { ip1 => '', ip2 => '', + pxe => '1', wiz_authoritative => 0, einterface => $wiz->{net}->default_itf }, @@ -47,7 +47,7 @@ my $o = { defaultimage => "$ENV{__WIZ_HOME__}dhcp_wizard/images/DHCP.png" }; -$o->{pages} = { +$o->{pages} = { welcome => { name => N("DHCP Wizard") . "\n\n\n" . N("DHCP is a service that automatically assigns networking addresses to your workstations.") . "\n\n\n" . N("This wizard will help you configuring the DHCP services of your server."), post => sub { $wiz->check_dhcp }, @@ -55,15 +55,16 @@ $o->{pages} = { next => 'ip_range' }, ip_range => { - name => N("Range of addresses used by dhcp") . "\n\n\n" . N("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."), + name => N("Range of addresses used by dhcp") . "\n\n\n" . N("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. (ie: 192.168.100.20 192.168.100.40)") . "\n\n" . N("If You want to enable PXE for your dhcp server please check the box."), pre => sub { $o->{var}{ip1} ||= compute_range(); - $o->{var}{ip2} ||= compute_range2() + $o->{var}{ip2} ||= compute_range2(); }, post => \&check, data => [ - { label => N("Lowest IP Address:"), val => \$o->{var}{ip1} }, - { label => N("Highest IP Address:"), val => \$o->{var}{ip2} }, + { label => N("Lowest IP Address:"), val => \$o->{var}{ip1} }, + { label => N("Highest IP Address:"), val => \$o->{var}{ip2} }, + { label => N("Enable PXE:"), type => 'bool', val => \$o->{var}{pxe} }, ], next => 'summary' }, @@ -98,17 +99,21 @@ $o->{pages} = { next => 'ip_range' }, summary => { - name => N("Configuring the DHCP Server") . "\n\n" . N("The wizard collected the following parameters needed to configure your DHCP service:"), - data => [ - { label => N("Lowest IP Address:"), fixed_val => \$o->{var}{ip1} }, - { label => N("Highest IP Address:"), fixed_val => \$o->{var}{ip2} }, - { label => N("Interface:"), fixed_val => \$o->{var}{interface} }, - ], - post => \&do_it, - next => 'end' - }, - end => { - name => N("Congratulations") . "\n\n" . N("The wizard successfully configured the DHCP services of your server."), + name => N("Configuring the DHCP Server") . "\n\n" . N("The wizard collected the following parameters needed to configure your DHCP service:"), + pre => sub { + $o->{var}{pxeornot} = $o->{var}{pxe} ? N("enabled") : N("disabled"); + }, + data => [ + { label => N("Lowest IP Address:"), fixed_val => \$o->{var}{ip1} }, + { label => N("Highest IP Address:"), fixed_val => \$o->{var}{ip2} }, + { label => N("Interface:"), fixed_val => \$o->{var}{interface} }, + { label => N("Enable PXE:"), fixed_val => \$o->{var}{pxeornot} }, + ], + post => \&do_it, + next => 'end' + }, + end => { + name => N("Congratulations") . "\n\n" . N("The wizard successfully configured the DHCP services of your server."), end => 1, next => 0 }, @@ -222,13 +227,20 @@ 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}"); MDK::Wizard::Varspaceval->commit($file, \%mdk); - !$o->{var}{wiz_authoritative} and output($file, map { + !$o->{var}{wiz_authoritative} and output($file, map { s|^\s*not\s*authoritative.*|#$&|i; $_ } cat_("/etc/dhcpd.conf")); } + + if ($o->{var}{pxe} == '0') { + substInFile { + s/#\s+deny members of "PXE"/deny members of "PXE"/; + } "/etc/dhcpd.conf"; + } + if (services::is_service_running('dhcpd')) { - services::restart('dhcpd') + services::restart('dhcpd') } else { services::start('dhcpd') } -- cgit v1.2.1