summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xclient_wizard/Bind_client.pm25
-rw-r--r--common/IFCFG.pm20
-rw-r--r--common/Varspaceval.pm10
-rw-r--r--common/Wizcommon.pm2
-rwxr-xr-xdrakwizard.pl2
-rw-r--r--installsrv_wizard/Installsrv.pm2
-rw-r--r--ldap_wizard/ldap.pm18
-rwxr-xr-xnews_wizard/Inn.pm8
-rwxr-xr-xnfs_wizard/NFS.pm6
-rw-r--r--nisautofs_wizard/Nisautofs.pm9
-rwxr-xr-xproxy_wizard/Squid.pm34
-rw-r--r--pxe_wizard/Pxe.pm12
-rwxr-xr-xsamba_wizard/Samba.pm63
-rw-r--r--time_wizard/Ntp.pm9
-rwxr-xr-xweb_wizard/Apache.pm1
15 files changed, 110 insertions, 111 deletions
diff --git a/client_wizard/Bind_client.pm b/client_wizard/Bind_client.pm
index 8da87403..bfd1c675 100755
--- a/client_wizard/Bind_client.pm
+++ b/client_wizard/Bind_client.pm
@@ -40,7 +40,7 @@ my $o = {
client_ip => '',
client_name => ''
},
- needed_rpm => [ ],
+ needed_rpm => [],
defaultimage => "$ENV{__WIZ_HOME__}client_wizard/images/DNS.png",
init => sub {
if (! -f "/var/named/$wiz_domain_name.db") {
@@ -101,7 +101,7 @@ $o->{pages} = {
};
sub check_dhcp {
- $wiz->{net}->is_dhcp() and return 'dhcp_warning';
+ $wiz->{net}->is_dhcp and return 'dhcp_warning';
}
sub name {
@@ -122,9 +122,9 @@ sub get_root {
}
sub up_serial {
- my ($file) = @_;
+ my ($file) = @_;
- my (undef, undef, undef, $mday, $mon, $year) = gmtime(time);
+ my (undef, undef, undef, $mday, $mon, $year) = gmtime(time());
$year += 1900;
my $serial_nbm = sprintf "%4dY%2dm%2d00", $year, $mon, $mday;
output($file, map {
@@ -146,31 +146,32 @@ sub test {
!$o->{client_name} and return 'error';
!$o->{client_ip} and return 'error';
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 $dc = "$4" if $o->{var}{client_ip} =~ /(\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 $dc = $4 if $o->{var}{client_ip} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $sc_trunc = "$1.$2.$3" if $o->{var}{client_ip} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
- (!$sc_trunc || !$dc || !$ds || !$s_trunc || ($s_trunc != $sc_trunc) || ($dc == $ds || $dc < 0 || $dc > 255)) and return 'error';
+ (!$sc_trunc || !$dc || !$ds || !$s_trunc || $s_trunc != $sc_trunc || ($dc == $ds || $dc < 0 || $dc > 255)) and return 'error';
}
sub do_it {
$::testing and return;
my $date = `date`;
chomp($date);
- 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 $wiz_ip_net = "$1.$2.$3.0" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
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 $dc = "$4" if $o->{var}{client_ip} =~ /(\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 $dc = $4 if $o->{var}{client_ip} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $file="/var/named/$wiz_domain_name.db";
my $client_name = $o->{var}{client_name};
$client_name =~ s/\.$wiz_domain_name$//;
MDK::Common::cp_af($file, $file.".orig");
+ local *NEW;
open(NEW, ">> $file") or die "can not open $file";
print NEW "\n$client_name IN A $o->{var}{client_ip} ; $date\n\n";
close(NEW) or die "can not close $file";
up_serial($file);
- my $file="/var/named/$s_trunc.rev";
+ $file="/var/named/$s_trunc.rev";
MDK::Common::cp_af($file, $file.".orig");
open(NEW, ">> $file") or die "can not open $file";
print NEW "\n$dc IN PTR $o->{var}{client_name}. ; $date\n\n";
@@ -184,7 +185,7 @@ sub do_it {
}
sub new {
- my ($class, $conf) = @_;
+ my ($class) = @_;
bless {
o => $o,
}, $class;
diff --git a/common/IFCFG.pm b/common/IFCFG.pm
index 24441494..f6d793e6 100644
--- a/common/IFCFG.pm
+++ b/common/IFCFG.pm
@@ -34,15 +34,14 @@ sub new {
my $ifconfig = `LC_ALL=C /sbin/ifconfig -a`;
my $device = 'NONE';
- my @interfaces;
foreach (split('\n', $ifconfig)) {
- my ($temp) = /(^eth[0-9]*:?[0-9]*).*/;
+ my ($temp) = /(^eth[0-9]*:?[0-9]*)/;
$device = $temp if defined $temp;
- my ($ip, $bcast, $netmask) = /\s*inet addr:([0-9\.]*)\s*Bcast:([0-9\.]*)\s*Mask:([0-9\.]*).*/;
+ my ($ip, $bcast, $netmask) = /\s*inet addr:([0-9\.]*)\s*Bcast:([0-9\.]*)\s*Mask:([0-9\.]*)/;
if (defined $ip && defined $bcast && defined $netmask) {
- $self->{itf}{$device} = {IPADDR => $ip, BROADCAST => $bcast, NETMASK => $netmask};
+ $self->{itf}{$device} = { IPADDR => $ip, BROADCAST => $bcast, NETMASK => $netmask };
my %conf = getVarsFromSh("/etc/sysconfig/network-scripts/ifcfg-$device");
- $self->{itf}{$device}{$_} = $conf{$_} foreach ('BOOTPROTO');
+ $self->{itf}{$device}{$_} = $conf{$_} foreach 'BOOTPROTO';
}
}
%{$self->{network}} = getVarsFromSh("/etc/sysconfig/network");
@@ -57,8 +56,7 @@ sub new {
}
sub is_dhcp {
- my $self = shift;
- my ($itf) = @_;
+ my ($self, $itf) = @_;
$itf ||= default_itf();
$self->{itf}{$itf}{BOOTPROTO} eq 'dhcp';
@@ -70,17 +68,15 @@ sub default_itf {
}
sub itf_get {
- my $self = shift;
- my ($key, $itf) = @_;
+ my ($self, $key, $itf) = @_;
- $itf ||= default_itf;
+ $itf ||= default_itf();
exists $self->{itf}{$itf}{$key} or print "ERROR: no $key field in $itf hash\n";
$self->{itf}{$itf}{$key}
}
sub network_get {
- my $self = shift;
- my ($key) = @_;
+ my ($self, $key) = @_;
exists $self->{network}{$key} or print "ERROR: no $key field in network hash\n";
$self->{network}{$key}
diff --git a/common/Varspaceval.pm b/common/Varspaceval.pm
index 3f35a992..9e996368 100644
--- a/common/Varspaceval.pm
+++ b/common/Varspaceval.pm
@@ -4,7 +4,7 @@
#
# Author: Philippe Hetroy, phetroy@mandrakesoft.com
#
-# $Id: Varspaceval.pm,v 1.4 2004-01-20 11:29:39 tvignaud Exp $
+# $Id: Varspaceval.pm,v 1.5 2004-01-22 20:24:48 tvignaud Exp $
# Module for loding and committing informations in a VAR = value file type
package MDK::Wizard::Varspaceval;
@@ -16,8 +16,7 @@ use Data::Dumper;
# Return a hash containg the key and the value
# ATTENTION : in the conf file, an empty value is returnes as a spaced value (mandatory because of XML compatibility)
sub get {
- my $self = shift;
- my $file = shift;
+ my ($_self, $file) = @_;
my %l;
local *F; open F, $file or return;
local $_;
@@ -43,8 +42,7 @@ sub get {
# Commits changes in conf files and ifconfig
sub commit {
- my $self = shift;
- my ($file, $hash) = @_;
+ my ($_self, $file, $hash) = @_;
local *F;
my $output = "";
@@ -58,7 +56,7 @@ sub commit {
$output .= $_;
next;
};
- next if (!exists $hash->{$key}); #Elt has been removed
+ next if !exists $hash->{$key}; #Elt has been removed
no warnings;
$val = $hash->{$key};
delete $hash->{$key};
diff --git a/common/Wizcommon.pm b/common/Wizcommon.pm
index b06838eb..a7c7793d 100644
--- a/common/Wizcommon.pm
+++ b/common/Wizcommon.pm
@@ -30,7 +30,7 @@ sub check_dhcp {
sub new {
my ($class, $_conf) = @_;
- $net = new IFCFG;
+ $net = new MDK::Wizard::IFCFG;
bless {
net => $net,
}, $class;
diff --git a/drakwizard.pl b/drakwizard.pl
index aaaab1f9..153c28a8 100755
--- a/drakwizard.pl
+++ b/drakwizard.pl
@@ -110,7 +110,7 @@ sub wizard {
}
if (ref $d->{boolean_list} && ref ${$d->{boolean_list}}) {
my $i;
- foreach (@{${$d->{boolean_list}}}){
+ foreach (@{${$d->{boolean_list}}}) {
push @$data2, { text => $_, type => 'bool', val => \${$d->{val}}->[$i], disabled => $d->{disabled} };
$i++
}
diff --git a/installsrv_wizard/Installsrv.pm b/installsrv_wizard/Installsrv.pm
index 38d4f15a..9494f9e0 100644
--- a/installsrv_wizard/Installsrv.pm
+++ b/installsrv_wizard/Installsrv.pm
@@ -148,7 +148,7 @@ sub do_it {
}
sub new {
- my ($class, $conf) = @_;
+ my ($class) = @_;
bless {
o => $o,
}, $class;
diff --git a/ldap_wizard/ldap.pm b/ldap_wizard/ldap.pm
index 5a8ddf09..ec92b6b7 100644
--- a/ldap_wizard/ldap.pm
+++ b/ldap_wizard/ldap.pm
@@ -35,7 +35,7 @@ my $o = {
rootdn => 'manager',
rootpass => 'secret',
cn => '',
- sn=> '',
+ sn => '',
uid => '',
uidpass => '',
lshell => '/bin/bash',
@@ -61,7 +61,7 @@ $o->{pages} = {
welcome => {
name => N("LDAP configuration wizard") . "\n\n" . N("Setup a LDAP server."),
no_back => 1,
- pre => sub { $o->{var}{wiz_level} ||= 1; },
+ pre => sub { $o->{var}{wiz_level} ||= 1 },
post => sub { if ($o->{var}{wiz_level} == 2) {
return 'add_user_posix';
}
@@ -191,7 +191,7 @@ sub rootdse_to_dc {
my ($data) = @_;
my @t = split(/\./, $data);
$o->{var}{dom} = $t[0];
- my $dcall = join( ',dc=', split(/\./, $data));
+ my $dcall = join(',dc=', split(/\./, $data));
return $dcall;
}
@@ -206,7 +206,7 @@ sub get_dc {
}
sub do_it_setldap {
- if (!-f $LDAPCONF) { die "no $LDAPCONF found"};
+ if (!-f $LDAPCONF) { die "no $LDAPCONF found" };
cp_af($LDAPCONF, $LDAPCONF . '.save');
if (!-f "$LDAPCONF.example") { cp_af($LDAPCONF, $LDAPCONF . '.example') };
cp_af($LDAPCONF . '.example', $LDAPCONF);
@@ -215,10 +215,10 @@ sub do_it_setldap {
# set suffix
if (any { /^suffix/ } cat_($LDAPCONF)) {
substInFile {
- s/suffix.*/suffix\t\"dc=$dcall\"/;
+ s/suffix.*/suffix\t"dc=$dcall"/;
} $LDAPCONF;
} else {
- append_to_file($LDAPCONF, "suffix\t\"dc=$dcall\"");
+ append_to_file($LDAPCONF, qq(suffix\t"dc=$dcall"));
}
# s/example/$dcall
@@ -229,10 +229,10 @@ sub do_it_setldap {
# set rootdn
if (any { /^rootdn/ } cat_($LDAPCONF)) {
substInFile {
- s/rootdn.*/rootdn\t\"cn=$o->{var}{rootdn},dc=$dcall\"/;
+ s/rootdn.*/rootdn\t"cn=$o->{var}{rootdn},dc=$dcall"/;
} $LDAPCONF;
} else {
- append_to_file($LDAPCONF, "rootdn\t\"$o->{var}{rootdn},dc=$dcall\"");
+ append_to_file($LDAPCONF, qq(rootdn\t"$o->{var}{rootdn},dc=$dcall"));
}
# set rootpass
@@ -241,7 +241,7 @@ sub do_it_setldap {
substInFile {
s/rootpw.*/rootpw $cryptpass/;
} $LDAPCONF;
- }else {
+ } else {
append_to_file($LDAPCONF, "rootpw {CRYPT}$cryptpass");
}
diff --git a/news_wizard/Inn.pm b/news_wizard/Inn.pm
index baa3f248..c2689786 100755
--- a/news_wizard/Inn.pm
+++ b/news_wizard/Inn.pm
@@ -53,7 +53,7 @@ $o->{pages} = {
data => [
{ label => N("News Server Name:"), val => \$o->{var}{news_server} },
],
- post => sub { $o->{var}{news_server} or 'error_in_news_server' },
+ post => sub { $o->{var}{news_server} || 'error_in_news_server' },
next => 'ask_news_freq'
},
ask_news_freq => {
@@ -100,7 +100,7 @@ needed to configure your Internet News Service:") . "\n\n" . N("To accept these
};
sub new {
- my ($class, $conf) = @_;
+ my ($class) = @_;
bless {
o => $o,
}, $class;
@@ -111,7 +111,7 @@ sub check_valid_hours {
}
sub normalize_freq {
- my ($freq) = @_;
+ my ($freq) = @_;
if ($freq =~ /(\d*)/) {
$freq = $1;
@@ -131,7 +131,7 @@ sub get_server {
}
sub normalize_server {
- my ($server) = @_;
+ my ($server) = @_;
$server
}
diff --git a/nfs_wizard/NFS.pm b/nfs_wizard/NFS.pm
index a27f32fa..e40ad943 100755
--- a/nfs_wizard/NFS.pm
+++ b/nfs_wizard/NFS.pm
@@ -106,7 +106,7 @@ $o->{pages} = {
};
sub new {
- my ($class, $conf) = @_;
+ my ($class) = @_;
bless {
o => $o,
}, $class;
@@ -125,7 +125,7 @@ sub network_mask {
}
sub chooser {
- $o->{var}{wiz_nfs_level} == 2 and 'shownet'
+ $o->{var}{wiz_nfs_level} == 2 || 'shownet'
}
sub do_it {
@@ -135,7 +135,7 @@ sub do_it {
chomp($o->{var}{wiz_nfs_dir});
-f $file and cp_af($file, $file.".orig");
if ($o->{var}{wiz_nfs_level} == 2) {
- my $mask = $wiz->{net}->itf_get("NETMASK");
+ #my $mask = $wiz->{net}->itf_get("NETMASK");
$line = "$o->{var}{wiz_nfs_dir} $o->{var}{wiz_netmask}(rw,no_root_squash,sync)\n";
}
else {
diff --git a/nisautofs_wizard/Nisautofs.pm b/nisautofs_wizard/Nisautofs.pm
index da0b438f..614d4222 100644
--- a/nisautofs_wizard/Nisautofs.pm
+++ b/nisautofs_wizard/Nisautofs.pm
@@ -233,7 +233,8 @@ sub needed_service {
sub get_nis_users {
my @unwanted = qw(install maui nobody mpi);
my @users;
- open(PASS, "ypcat passwd|") || die " cant exec ypcat passwd!";
+ local *PASS;
+ open(PASS, "ypcat passwd|") or die " cant exec ypcat passwd!";
while (<PASS>) {
my ($login) = split(':');
if (!member($login, @unwanted)) {
@@ -319,7 +320,7 @@ sub do_it_server {
# update nfs to fit nis
nfs_home_nis();
# restart all needed services
- map { needed_service($_); $_ } qw(ypserv nfs);
+ needed_service($_) foreach qw(ypserv nfs);
undef $w;
}
@@ -336,12 +337,12 @@ sub do_it_client {
update_yp(chomp_($o->{var}{NISDOMAIN}), chomp_($o->{var}{NISSERVER}));
# update conf file
update_network();
- map { needed_service($_); $_ } qw(ypbind autofs);
+ needed_service($_) foreach qw(ypbind autofs);
undef $w;
}
sub new {
- my ($class, $conf) = @_;
+ my ($class) = @_;
bless {
o => $o,
}, $class;
diff --git a/proxy_wizard/Squid.pm b/proxy_wizard/Squid.pm
index f17889ca..009ff192 100755
--- a/proxy_wizard/Squid.pm
+++ b/proxy_wizard/Squid.pm
@@ -91,8 +91,8 @@ $o->{pages} = {
memory => {
name => N("Proxy Cache Size") . "\n\n" . N("Memory Cache is the amount of RAM dedicated to cache memory operations (note that actual memory usage of the whole squid process is bigger).") . "\n\n" . N("Disk Cache is the amount of disk space that can be used for caching on disk.") . "\n\n" . N("For your information, here is /var/spool/squid space on disk:") . "\n\n" . $df,
pre => sub {
- $o->{var}{wiz_squid_mem} ||= int ($mem / 4);
- $o->{var}{wiz_squid_disk} ||= int ($free_disk/2);
+ $o->{var}{wiz_squid_mem} ||= int($mem / 4);
+ $o->{var}{wiz_squid_disk} ||= int($free_disk/2);
},
data => [
{ label => N("Memory cache (MB):"), val => \$o->{var}{wiz_squid_mem} },
@@ -176,7 +176,7 @@ $o->{pages} = {
};
sub new {
- my ($class, $conf) = @_;
+ my ($class) = @_;
bless {
o => $o,
}, $class;
@@ -203,7 +203,7 @@ sub testport {
sub port {
my $ret;
- my @lines = grep(/$o->{var}{wiz_squid_port}\/tcp/, cat_("/etc/services"));
+ my @lines = grep { m!$o->{var}{wiz_squid_port}/tcp! } cat_("/etc/services");
foreach (@lines) {
s/\t/ /g;
$ret .= "\n$_";
@@ -219,49 +219,49 @@ sub do_it {
-f $file and MDK::Common::cp_af($file, $file.".orig");
MDK::Common::cp_af("__WIZ_HOME__/proxy_wizard/scripts/squid.conf.default", $file);
substInFile {
- s|^\s*\#?\s*cache_dir ufs /var/spool/squid 100 16 256.*|cache_dir ufs $o->{var}{wiz_squid_defdir} $o->{var}{wiz_squid_disk} 16 256|;
- s|^\s*\#?\s*acl\s*mynetwork\s*src.*|acl mynetwork src $o->{var}{wiz_squid_mynetw}|;
- s|^\s*\#?\s*(cache_mem\s*)\d+(\s*MB.*)|$1$o->{var}{wiz_squid_mem} MB|;
- s|^\s*\#?\s*(http_port\s*)\d+(.*)|$1$o->{var}{wiz_squid_port}|;
+ s|^\s*#?\s*cache_dir ufs /var/spool/squid 100 16 256.*|cache_dir ufs $o->{var}{wiz_squid_defdir} $o->{var}{wiz_squid_disk} 16 256|;
+ s|^\s*#?\s*acl\s*mynetwork\s*src.*|acl mynetwork src $o->{var}{wiz_squid_mynetw}|;
+ s|^\s*#?\s*(cache_mem\s*)\d+(\s*MB.*)|$1$o->{var}{wiz_squid_mem} MB|;
+ s|^\s*#?\s*(http_port\s*)\d+(.*)|$1$o->{var}{wiz_squid_port}|;
} $file;
standalone::explanations("$file: cache_dir = $o->{var}{wiz_squid_defdir} $o->{var}{wiz_squid_disk}
mynetw = $o->{var}{wiz_squid_mynetw} cache_mem = $o->{var}{wiz_squid_mem} http_port = $o->{var}{wiz_squid_port}
level = $o->{var}{wiz_squid_level}");
if ($o->{var}{wiz_squid_level} == 1) {
substInFile {
- s|^\s*\#?\s*(http_access\s*)deny(\s*all.*)|\#$&\n$1allow$2|;
+ s|^\s*#?\s*(http_access\s*)deny(\s*all.*)|#$&\n$1allow$2|;
} $file;
}
elsif ($o->{var}{wiz_squid_level} == 2) {
substInFile {
- s|^\s*\#?\s*(http_access\s*)allow(\s*all.*)|\#$&\n$1deny$2|;
- s|^\s*\#?\s*(http_access\s*allow\s*)localhost|\#$&\n$1mynetwork|;
+ s|^\s*#?\s*(http_access\s*)allow(\s*all.*)|#$&\n$1deny$2|;
+ s|^\s*#?\s*(http_access\s*allow\s*)localhost|#$&\n$1mynetwork|;
} $file;
}
elsif ($o->{var}{wiz_squid_level} == 3) {
substInFile {
- s|^\s*\#?\s*(http_access\s*)allow(\s*all.*)|\#$&\n$1deny$2|;
- s|^\s*\#?\s*(http_access\s*allow\s*)mynetwork|\#$&\n$1localhost|;
+ s|^\s*#?\s*(http_access\s*)allow(\s*all.*)|#$&\n$1deny$2|;
+ s|^\s*#?\s*(http_access\s*allow\s*)mynetwork|#$&\n$1localhost|;
} $file;
} else { # should not happen
die "wiz_squid_level error";
}
my $t = 0;
foreach (cat_($file)) {
- if (/^\s*cache_peer.*/) {
+ if (/^\s*cache_peer/) {
$t = $_;;
last;
}
}
if ($o->{var}{wiz_squid_menupeer} == 1 && length $t) {
substInFile {
- s|^\s*!\#\s*(cache_peer.*)|\#$&|;
+ s|^\s*!#\s*(cache_peer.*)|#$&|;
} $file;
}
elsif ($o->{var}{wiz_squid_menupeer} == 2 && length $o->{var}{wiz_squid_cachepeer}) {
- if (lenght $t) {
+ if (lenght($t)) {
substInFile {
- s|^\s*\#?\s*(cache_peer.*)|\#$&|;
+ s|^\s*#?\s*(cache_peer.*)|#$&|;
} $file;
}
append_to_file($file, "cache_peer $o->{var}{wiz_squid_cachepeer} parent $o->{var}{wiz_squid_peerport} 3130");
diff --git a/pxe_wizard/Pxe.pm b/pxe_wizard/Pxe.pm
index 38578639..08ee8fce 100644
--- a/pxe_wizard/Pxe.pm
+++ b/pxe_wizard/Pxe.pm
@@ -243,7 +243,7 @@ $o->{pages} = {
name => N("Congratulations"),
data => [ { label => N("The wizard successfully add a PXE boot image.") } ],
post => sub {
- @list_menu =();
+ @list_menu = ();
foreach (cat_($PXEDEFAULT)) {
my ($ent) = /# TAG: (\w+)_BEGIN/;
! $ent or push @list_menu,$ent;
@@ -255,7 +255,7 @@ $o->{pages} = {
name => N("Congratulations"),
data => [ { label => N("The wizard successfully remove a PXE boot image.") } ],
post => sub {
- @list_menu =();
+ @list_menu = ();
foreach (cat_($PXEDEFAULT)) {
my ($ent) = /# TAG: (\w+)_BEGIN/;
! $ent or push @list_menu,$ent;
@@ -352,7 +352,7 @@ sub add_img {
sub remove_in_menu {
my ($NAME) = @_;
my $conf = cat_($PXEDEFAULT) . "#EndOfFile";
- my ($begin, $NAME_bloc, $end) = $conf =~ /(.*?)(# TAG: ${NAME}_BEGIN.*?# TAG: ${NAME}_END)\n(.*)#EndOfFile/s or die "unable to find Menu entry section";
+ my ($begin, $_NAME_bloc, $end) = $conf =~ /(.*?)(# TAG: ${NAME}_BEGIN.*?# TAG: ${NAME}_END)\n(.*)#EndOfFile/s or die "unable to find Menu entry section";
output($PXEDEFAULT, $begin, $end);
}
@@ -446,7 +446,7 @@ sub read_option {
system("mount $IMGPATH/$IMG.img $mount -o loop 2>/dev/null");
my $line = cat_("$mount/syslinux.cfg");
$o->{var}{i} = "$IMGPATH/$IMG.img";
- ($o->{var}{METHOD}, $o->{var}{ETH}, $o->{var}{IP}, $o->{var}{DIR}, $o->{var}{RAM}, $o->{var}{VGA}, $o->{var}{ACPI}, $o->{var}{APIC}) = $line =~ /method:(nfs|http),interface:(eth0|eth1|eth2),network:dhcp,server:(.*?),directory:(.*?) ramdisk_size=(.*?) root=\/dev\/ram3 rw vga=(.*?)acpi=(ht|force|off)\s(apic|noapic)/;
+ ($o->{var}{METHOD}, $o->{var}{ETH}, $o->{var}{IP}, $o->{var}{DIR}, $o->{var}{RAM}, $o->{var}{VGA}, $o->{var}{ACPI}, $o->{var}{APIC}) = $line =~ m!/method:(nfs|http),interface:(eth0|eth1|eth2),network:dhcp,server:(.*?),directory:(.*?) ramdisk_size=(.*?) root=/dev/ram3 rw vga=(.*?)acpi=(ht|force|off)\s(apic|noapic)!;
system("umount $mount");
if (-e $mount) {
rm_rf($mount);
@@ -508,13 +508,13 @@ EOF
enable_tftps();
pxe_conf();
tftp_blksize('N');
- map { system("service $_ restart"); $_ } qw(xinetd pxe);
+ system("service $_ restart") foreach qw(xinetd pxe);
undef $w;
}
sub new {
- my ($class, $conf) = @_;
+ my ($class) = @_;
bless {
o => $o,
}, $class;
diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm
index 68d4144a..566a8994 100755
--- a/samba_wizard/Samba.pm
+++ b/samba_wizard/Samba.pm
@@ -232,7 +232,7 @@ configure Samba.") . "\n\n" . N("To accept these values, and configure your serv
};
sub new {
- my ($class, $conf) = @_;
+ my ($class) = @_;
bless {
o => $o,
}, $class;
@@ -262,7 +262,9 @@ sub read_conf {
my ($file) = @_;
my ($menu, @tab, %conf);
+ local *FH;
open(FH, $file) or die "$! ($file)";
+ local $_;
while (<FH>) {
if (/^(\s*;?\s*)\[(.*)\]/) {
$menu = $2;
@@ -287,6 +289,7 @@ sub write_conf {
my ($self, $file) = @_;
my $menu;
+ local *FH;
open(FH, "> $file") or die "$!";
foreach (@{$self->{tab}}) {
if (/^\s*;?\s*\[(.*)\]/) {
@@ -310,13 +313,13 @@ sub add_printer {
$self->comment_menu($printer, " ");
}
else {
- $self->{conf}->{$printer}{printable}{comment} = " ";
- $self->{conf}->{$printer}{printer}{comment} = " ";
+ $self->{conf}{$printer}{printable}{comment} = " ";
+ $self->{conf}{$printer}{printer}{comment} = " ";
push @{$self->{tab}}, "[$printer]\n";
push @{$self->{tab}}, "printer = $printer\n";
push @{$self->{tab}}, "printable = yes\n";
- $self->{conf}->{$printer}{printer}{value} = $printer;
- $self->{conf}->{$printer}{printable}{value} = "yes";
+ $self->{conf}{$printer}{printer}{value} = $printer;
+ $self->{conf}{$printer}{printable}{value} = "yes";
}
}
@@ -325,7 +328,7 @@ sub list_printers {
return @list if @list;
@list = sort grep { /^(?!#).+/ } map {
- my ($printer) = split(':', $_);
+ split(':', $_)->[0];
} cat_("/etc/printcap");
if (@list) {
@list
@@ -342,26 +345,24 @@ sub check_users {
sub comment_menu {
my ($self, $menu, $str) = @_;
- return if !$menu || !exists $self->{conf}->{$menu};
+ return if !$menu || !exists $self->{conf}{$menu};
$self->{conf}{$menu}{__comment} = $str;
- foreach (keys %{$self->{conf}->{$menu}}) {
- ($_ eq "__comment") and next;
+ foreach (keys %{$self->{conf}{$menu}}) {
+ $_ eq "__comment" and next;
$self->{conf}{$menu}{$_}{comment} = $str;
}
}
sub comment_var {
- my $self = shift;
- my ($menu, $var, $str) = @_;
+ my ($self, $menu, $var, $str) = @_;
- $self->{conf}->{$menu}{$var}{comment} = $str;
+ $self->{conf}{$menu}{$var}{comment} = $str;
}
sub chg_var {
- my $self = shift;
- my ($menu, $var, $str) = @_;
+ my ($self, $menu, $var, $str) = @_;
- $self->{conf}->{$menu}{$var}{value} = $str;
+ $self->{conf}{$menu}{$var}{value} = $str;
}
# all or selected printers
@@ -372,7 +373,7 @@ sub printer_sharing {
$self->comment_menu('printers', " ");
} else {
$self->comment_menu("printers", ";");
- for(my $i; $i < @{$o->{var}{wiz_box_list}}; $i++) {
+ for (my $i = 0; $i < @{$o->{var}{wiz_box_list}}; $i++) {
my $printer = $o->{var}{list_printers}[$i];
if ($o->{var}{wiz_box_list}[$i]) {
$self->add_printer($printer);
@@ -387,7 +388,7 @@ sub get_previous_printers {
my ($list_printers) = @_;
my $previous = [];
foreach my $p (grep { defined $old->{conf}{$_}{printer} } keys %{$old->{conf}}) {
- my $test = grep { /\Q$p/ } @$list_printers;
+ my $test = any { /\Q$p/ } @$list_printers;
push @$previous, $test
}
$previous
@@ -397,7 +398,7 @@ sub get_printers {
if ($o->{var}{wiz_do_printer_sharing}) {
my $string;
$o->{var}{wiz_all_printers} and return "all printers";
- for (my $i; $i < @{$o->{var}{wiz_box_list}}; $i++) {
+ for (my $i = 0; $i < @{$o->{var}{wiz_box_list}}; $i++) {
$string .= "$o->{var}{list_printers}[$i]\n" if $o->{var}{wiz_box_list}[$i]
}
$string;
@@ -416,11 +417,11 @@ sub ask_acces {
}
sub get_write {
- $old->{conf}->{public}{"write list"}{value};
+ $old->{conf}{public}{"write list"}{value};
}
sub get_read {
- $old->{conf}->{public}{"read list"}{value};
+ $old->{conf}{public}{"read list"}{value};
}
sub check_banner {
@@ -428,11 +429,11 @@ sub check_banner {
}
sub get_workgroup {
- $old->{conf}->{global}{workgroup}{value}
+ $old->{conf}{global}{workgroup}{value}
}
sub get_banner {
- $old->{conf}->{global}{"server string"}{value};
+ $old->{conf}{global}{"server string"}{value};
}
sub ask_dir {
@@ -441,16 +442,16 @@ sub ask_dir {
}
sub get_dir {
- $old->{conf}->{public}{path}{value};
+ $old->{conf}{public}{path}{value};
}
sub get_file_sharing {
- return 0 if ($old->{conf}->{public}{__comment} =~ /;|#/);
+ return 0 if $old->{conf}{public}{__comment} =~ /;|#/;
1;
}
sub get_home_sharing {
- return 0 if ($old->{conf}->{homes}{__comment} =~ /;|#/);
+ return 0 if $old->{conf}{homes}{__comment} =~ /;|#/;
1;
}
@@ -459,11 +460,11 @@ sub get_netmask {
}
sub get_allow_host {
- $old->{conf}->{global}{"hosts allow"}{value};
+ $old->{conf}{global}{"hosts allow"}{value};
}
sub get_deny_host {
- $old->{conf}->{global}{"hosts deny"}{value};
+ $old->{conf}{global}{"hosts deny"}{value};
}
# remember one variable cannot be commented and not in the same file.
@@ -476,7 +477,7 @@ sub do_it {
$conf->chg_var("global", "server string", $o->{var}{wiz_banner});
$conf->chg_var("public", "write list", $o->{var}{wiz_write_list}) if $o->{var}{wiz_do_file_sharing};
$conf->chg_var("public", "read list", $o->{var}{wiz_read_list}) if $o->{var}{wiz_do_file_sharing};
- my $ip = $wiz->{net}->itf_get("IPADDR");
+ #my $ip = $wiz->{net}->itf_get("IPADDR");
if ($o->{var}{wiz_do_file_sharing}) {
standalone->explanations("Enabling $o->{var}{wiz_dir} samba file sharing");
$conf->comment_menu("public", " ");
@@ -501,11 +502,11 @@ sub do_it {
if ($o->{var}{wiz_do_printer_sharing}) {
standalone->explanations("Enabling printer sharing");
- $conf->printer_sharing();
+ $conf->printer_sharing;
} else {
standalone->explanations("Disabling printer sharing");
- for(my $i; $i < @{$o->{var}{wiz_box_list}}; $i++) {
- $conf->comment_menu("$o->{var}{list_printers}[$i]", ";");
+ for (my $i = 0; $i < @{$o->{var}{wiz_box_list}}; $i++) {
+ $conf->comment_menu($o->{var}{list_printers}[$i], ";");
}
$conf->comment_menu("printers", ";");
}
diff --git a/time_wizard/Ntp.pm b/time_wizard/Ntp.pm
index 469f9c0a..4c45b2cf 100644
--- a/time_wizard/Ntp.pm
+++ b/time_wizard/Ntp.pm
@@ -53,7 +53,7 @@ my %ntp_servers = (
'ntp.cs.strath.ac.uk' => "Dept. Computer Science, Strathclyde University, Glasgow, Scotland",
'ntp.shim.org' => "Singapore",
'ntp.tmc.edu' => "Baylor College of Medicine, Houston, Tx",
-'ntp1.cmc.ec.gc.ca' =>"Canadian Meteorological Centre, Dorval, Quebec, Canada"
+'ntp1.cmc.ec.gc.ca' => "Canadian Meteorological Centre, Dorval, Quebec, Canada"
);
my %actions = (
@@ -68,7 +68,7 @@ if (-d '/usr/share/zoneinfo') {
foreach my $z (grep { /^[A-Z]/ } readdir $dir) {
if (-d "/usr/share/zoneinfo/$z") {
opendir my $dir2, "/usr/share/zoneinfo/$z";
- push @{$country{$z}}, map { "$_" } grep { /^[A-Z]/ } readdir $dir2;
+ push @{$country{$z}}, map { $_ } grep { /^[A-Z]/ } readdir $dir2;
closedir $dir2
} else {
$country{$z} = 1
@@ -169,7 +169,7 @@ $o->{pages} = {
};
sub new {
- my ($class, $conf) = @_;
+ my ($class) = @_;
bless {
o => $o,
}, $class;
@@ -178,7 +178,7 @@ sub new {
sub get_timezone {
-f "/etc/sysconfig/clock" or return;
my %conf = getVarsFromSh("/etc/sysconfig/clock");
- my ($c,$r) = split "/", $conf{ZONE};
+ my ($c, $r) = split "/", $conf{ZONE};
return ($conf{ZONE}, $c, $r)
}
@@ -196,6 +196,7 @@ sub do_it {
$::testing and return;
my $file = "/etc/sysconfig/clock";
MDK::Common::cp_af($file, $file.".orig");
+ local *NEW;
open(NEW, "> $file") or die "can not open $file: $!";
print NEW "UTC=true\n";
print NEW "ZONE=$o->{var}{wiz_timezone}\n";
diff --git a/web_wizard/Apache.pm b/web_wizard/Apache.pm
index 6cb7187e..0f28559e 100755
--- a/web_wizard/Apache.pm
+++ b/web_wizard/Apache.pm
@@ -48,6 +48,7 @@ my $o = {
init => sub {
if (-f $file) {
open my $FH, $file or die "$! ($file)";
+ local $_;
while (<$FH>) {
if (/^\s*#?\s*DocumentRoot\s+(.*)/) {
close($FH);