summaryrefslogtreecommitdiffstats
path: root/dhcp_wizard
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-10-17 16:54:49 +0000
committerThierry Vignaud <tv@mageia.org>2012-10-17 16:54:49 +0000
commit40e226b14900343e0e203a9761a4031437b7d9c0 (patch)
treeca6cfad3454c13cbf22750724edc0c119a794903 /dhcp_wizard
parent70f78f71033cf75f6bb74ce9d165cae61840018c (diff)
downloaddrakwizard-40e226b14900343e0e203a9761a4031437b7d9c0.tar
drakwizard-40e226b14900343e0e203a9761a4031437b7d9c0.tar.gz
drakwizard-40e226b14900343e0e203a9761a4031437b7d9c0.tar.bz2
drakwizard-40e226b14900343e0e203a9761a4031437b7d9c0.tar.xz
drakwizard-40e226b14900343e0e203a9761a4031437b7d9c0.zip
perl_checker cleanups
Diffstat (limited to 'dhcp_wizard')
-rwxr-xr-xdhcp_wizard/Dhcp.pm34
1 files changed, 17 insertions, 17 deletions
diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm
index 2f7b4c46..07a118ac 100755
--- a/dhcp_wizard/Dhcp.pm
+++ b/dhcp_wizard/Dhcp.pm
@@ -73,7 +73,7 @@ $o->{pages} = {
name => N("Range of addresses used by DHCP") . "\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 in your dhcp server please check the box (Pre-boot eXecution Environment, a protocol that allows computers to boot through the network)."),
pre => sub {
#($wiz_ip_server) = `/sbin/ip addr show dev $o->{var}{interface}` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m;
- ($wiz_ip_server) = $wiz->{net}->{itf}{$o->{var}{interface}}{IPADDR};
+ ($wiz_ip_server) = $wiz->{net}{itf}{$o->{var}{interface}}{IPADDR};
$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})/;
@@ -176,7 +176,7 @@ sub check {
if (!$d1 || !$d2 || $d1 > $d2) { standalone::explanations("DHCP wizard : bad range"); return 'ip_range_error' }
if ($ds >= $d1 && $ds <= $d2) { standalone::explanations("DHCP wizard : server in range"); return 'server_in_range' }
return 'interface' if keys %{$wiz->{net}{itf}} > 1;
- 0
+ 0;
}
sub do_it {
@@ -187,7 +187,7 @@ sub do_it {
my $wiz_host_name = $wiz->{net}->network_get("HOSTNAME");
my $wiz_dns = $wiz->{net}->network_get("dnsServer");
if ($wiz_dns eq '127.0.0.1') {
- $wiz_dns = $wiz_ip_server
+ $wiz_dns = $wiz_ip_server;
}
if (!$o->{var}{gateway}) {
my $t = `LC_ALL=C /sbin/ip route list scope global`;
@@ -207,26 +207,27 @@ sub do_it {
#[ -f /etc/sysconfig/dhcpd ] && cp -f /etc/sysconfig/dhcpd /var/tmp/wiz_bck/orig/dhcpd
my $file = "/etc/sysconfig/dhcpd";
- -f $file and MDK::Common::cp_af($file, $file.".orig");
+ -f $file and MDK::Common::cp_af($file, $file . ".orig");
standalone::explanations("now patching etc/sysconfig/dhcpd");
if (!`grep INTERFACES $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>) {
+ open(my $NEW, "> $tmp") or die "can't open $tmp: $!";
+ open(my $OLD, "< $file") or die "can't open default: $!";
+ local $_;
+ while (<$OLD>) {
if (m|INTERFACE|) {
- print NEW "# $_";
+ print $NEW "# $_";
}
- print NEW $_;
+ print $NEW $_;
}
MDK::Common::append_to_file($tmp, "\n# Added by drakwizard\nINTERFACES=$wiz_device");
- close(OLD);
- close(NEW);
+ close($OLD);
+ close($NEW);
chomp($tmp);
system("mv $tmp $file");
}
$file = "/etc/dhcpd.conf";
- -f $file and 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;
s|__dns__|$wiz_dns|g;
@@ -254,11 +255,11 @@ mask = $wiz_ip_netmask, rng1 = $wiz_ip_range1, rng2 = $wiz_ip_range2, dname = $w
MDK::Wizard::Varspaceval->commit($file, \%mdk);
!$o->{var}{wiz_authoritative} and output($file, map {
s|^\s*not\s*authoritative.*|#$&|i;
- $_
+ $_;
} cat_("/etc/dhcpd.conf"));
}
- if ($o->{var}{pxe} == '0') {
+ if ($o->{var}{pxe} eq '0') {
substInFile {
s/#\s+deny members of "PXE"/deny members of "PXE"/;
} "/etc/dhcpd.conf";
@@ -269,11 +270,10 @@ mask = $wiz_ip_netmask, rng1 = $wiz_ip_range1, rng2 = $wiz_ip_range2, dname = $w
} "/etc/dhcpd.conf";
if (services::is_service_running('dhcpd')) {
- services::restart('dhcpd')
+ services::restart('dhcpd');
} else {
- services::start('dhcpd')
+ services::start('dhcpd');
}
- 10;
check_started('dhcpd');
}