summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-08-12 06:45:02 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-08-12 06:45:02 +0000
commite697d714c022e05ad06b023a47ee7d6101f2ea54 (patch)
treeb8acf9e6fad5c923bb04e16b5967e4acb0238209
parent9e65445176fd172c83e8cea87017c9f1269fcc97 (diff)
downloaddrakpxelinux-e697d714c022e05ad06b023a47ee7d6101f2ea54.tar
drakpxelinux-e697d714c022e05ad06b023a47ee7d6101f2ea54.tar.gz
drakpxelinux-e697d714c022e05ad06b023a47ee7d6101f2ea54.tar.bz2
drakpxelinux-e697d714c022e05ad06b023a47ee7d6101f2ea54.tar.xz
drakpxelinux-e697d714c022e05ad06b023a47ee7d6101f2ea54.zip
perl_checker fixes
-rw-r--r--drakpxelinux.pl82
1 files changed, 45 insertions, 37 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl
index 5a541e5..a339352 100644
--- a/drakpxelinux.pl
+++ b/drakpxelinux.pl
@@ -103,7 +103,7 @@ sub set_help_tip {
}
if (!-f $conf) {
- err_dialog(N("Error!"), N("missing %s\n\nPlease install pxe package.",$conf)) and !$::testing && die;
+ err_dialog(N("Error!"), N("missing %s\n\nPlease install pxe package.",$conf)) and die if !$::testing;
} else {
save_config($conf);
}
@@ -131,7 +131,7 @@ use constant NUM_COLUMNS => 13;
# get all values from default PXE file
sub get_items() {
- my $info; my $label; my $kernel; my $initrd;
+ my ($label, $kernel);
foreach (cat_($conf)) {
if (any { /^label/ } cat_($conf)) {
if (/^label/) { ($label) = /^label\s(.*)/ }
@@ -210,7 +210,7 @@ sub set_new_default {
} $conf;
}
-sub get_default_pxe {
+sub get_default_pxe() {
my ($defaultpxe) = cat_($conf) =~ /DEFAULT\s+(\S+)/;
return $defaultpxe;
}
@@ -227,10 +227,10 @@ sub get_default_timeout() {
}
# write conf in default file
-sub write_conf_pxe {
- my $default = get_default_pxe;
- my $prompt = get_default_prompt;
- my $time = get_default_timeout;
+sub write_conf_pxe() {
+ my $default = get_default_pxe();
+ my $_prompt = get_default_prompt();
+ my $_time = get_default_timeout();
output($conf, <<EOF);
# DO NOT EDIT auto_generated by drakpxelinux.pl
PROMPT 10
@@ -267,9 +267,9 @@ label $a->{label}
}
}
-sub create_model {
+sub create_model() {
get_items();
- my $model = Gtk2::ListStore->new(("Glib::String") x13);
+ my $model = Gtk2::ListStore->new(("Glib::String") x 13);
foreach my $a (@listpxe) {
my $iter = $model->append;
$model->set($iter,
@@ -293,7 +293,7 @@ sub create_model {
# wizard to add an entry in PXE menu
sub wizard_add_entry {
- my ($widget, $treeview) = @_;
+ my ($_widget, $treeview) = @_;
my $model = $treeview->get_model;
local $::isEmbedded = 0;
@@ -396,7 +396,7 @@ sub wizard_add_entry {
# remove an entry in PXE menu
sub remove_item {
- my ($widget, $treeview) = @_;
+ my ($_widget, $treeview) = @_;
$::isWizard = 0;
my $model = $treeview->get_model;
my $selection = $treeview->get_selection;
@@ -419,12 +419,12 @@ sub remove_item {
}
$model->remove($iter);
splice @listpxe, $i, 1;
- write_conf_pxe;
+ write_conf_pxe();
}
}
sub test_similar_label {
- my ($newlabel, $oldlabel) = @_;
+ my ($newlabel, $_oldlabel) = @_;
# if ($newlabel eq $oldlabel) {
# err_dialog(N("hmm.."), N("You should provide a new label name.")) and return 0;
# } els
@@ -435,7 +435,7 @@ sub test_similar_label {
# dialog box to edit a PXE entry
sub edit_box_item {
- my ($widget, $treeview) = @_;
+ my ($_widget, $treeview) = @_;
$::isWizard = 0;
my $model = $treeview->get_model;
my $selection = $treeview->get_selection;
@@ -625,7 +625,7 @@ sub edit_box_item {
COLUMN_OPTION, $listpxe[$i]{option},
);
$dialog->destroy;
- write_conf_pxe;
+ write_conf_pxe();
add_in_help($listpxe[$i]{label}, $listpxe[$i]{info});
},
},
@@ -701,7 +701,7 @@ sub cell_edited {
}
} elsif ($column == COLUMN_AUTOMATIC) {
my $i = ($path->get_indices)[0];
- if (!member($new_text, @list_method) || ($listpxe[$i]{kernel} =~ /memdisk/)) {
+ if (!member($new_text, @list_method) || $listpxe[$i]{kernel} =~ /memdisk/) {
return;
} else {
$listpxe[$i]{automatic} = $new_text;
@@ -709,42 +709,49 @@ sub cell_edited {
}
} elsif ($column == COLUMN_INTERFACE) {
my $i = ($path->get_indices)[0];
- if (member($new_text, @list_eth) || ($listpxe[$i]{kernel} != /memdisk/)) {
+ # FIXME: regexp on $_ which has random value here (do you means $var !~ // instead):
+ if (member($new_text, @list_eth) || $listpxe[$i]{kernel} != /memdisk/) {
$listpxe[$i]{interface} = $new_text;
$model->set($iter, $column, $listpxe[$i]{interface});
}
} elsif ($column == COLUMN_NETWORK) {
my $i = ($path->get_indices)[0];
+ # FIXME: regexp on $_ which has random value here (do you means $var !~ // instead):
if ($listpxe[$i]{kernel} != /memdisk/) {
$listpxe[$i]{network} = $new_text;
$model->set($iter, $column, $listpxe[$i]{network});
}
} elsif ($column == COLUMN_SERVER) {
my $i = ($path->get_indices)[0];
+ # FIXME: regexp on $_ which has random value here (do you means $var !~ // instead):
if ($listpxe[$i]{kernel} != /memdisk/) {
$listpxe[$i]{server} = $new_text;
$model->set($iter, $column, $listpxe[$i]{server});
}
} elsif ($column == COLUMN_DIRECTORY) {
my $i = ($path->get_indices)[0];
- if (-d $new_text || ($listpxe[$i]{kernel} != /memdisk/)) {
+ # FIXME: regexp on $_ which has random value here (do you means $var !~ // instead):
+ if (-d $new_text || $listpxe[$i]{kernel} != /memdisk/) {
$listpxe[$i]{directory} = $new_text;
$model->set($iter, $column, $listpxe[$i]{directory});
}
} elsif ($column == COLUMN_RAMDISK) {
my $i = ($path->get_indices)[0];
- if (member($new_text, @list_ram) || ($listpxe[$i]{kernel} != /memdisk/)) {
+ # FIXME: regexp on $_ which has random value here (do you means $var !~ // instead):
+ if (member($new_text, @list_ram) || $listpxe[$i]{kernel} != /memdisk/) {
$listpxe[$i]{ramdisk} = $new_text;
$model->set($iter, $column, $listpxe[$i]{ramdisk});
}
} elsif ($column == COLUMN_VGA) {
my $i = ($path->get_indices)[0];
- if (member($new_text, @list_vga) || ($listpxe[$i]{kernel} != /memdisk/)) {
+ # FIXME: regexp on $_ which has random value here (do you means $var !~ // instead):
+ if (member($new_text, @list_vga) || $listpxe[$i]{kernel} != /memdisk/) {
$listpxe[$i]{vga} = $new_text;
$model->set($iter, $column, $listpxe[$i]{vga});
}
} elsif ($column == COLUMN_DISPLAY) {
my $i = ($path->get_indices)[0];
+ # FIXME: regexp on $_ which has random value here (do you means $var !~ // instead):
if ($listpxe[$i]{kernel} != /memdisk/) {
$listpxe[$i]{display} = $new_text;
$model->set($iter, $column, $listpxe[$i]{display});
@@ -754,10 +761,11 @@ sub cell_edited {
$listpxe[$i]{option} = $new_text;
$model->set($iter, $column, $listpxe[$i]{option});
}
- write_conf_pxe;
+ write_conf_pxe();
}
-sub show_help { info_dialog("help",
+sub show_help() {
+ info_dialog("help",
gtkpack_(gtkset_border_width(Gtk2::VBox->new, 3),
0, $help,
0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("online PXE documentation")), 'helponline'),
@@ -769,7 +777,7 @@ sub show_help { info_dialog("help",
}
# adjust pxe confi with good value
-sub pxe_conf {
+sub pxe_conf() {
if (!-f "$pxeconf.orig") { cp_af($pxeconf, "$pxeconf.orig") }
substInFile {
s/default_address.*/default_address=$IPSERVER/;
@@ -778,7 +786,7 @@ sub pxe_conf {
} $pxeconf;
}
-sub check_pxe_conf {
+sub check_pxe_conf() {
if (! any { /default_address=$IPSERVER/ } cat_($pxeconf)) {
# pxe.conf doesnt matche system, relaunch wizard_pxe_server
err_dialog(N("Error !"), N("Your %s doesnt match your actual IP address configuration. Relaunching the PXE wizard server to readjust it.", $pxeconf)) and launch_pxe_server();
@@ -786,7 +794,7 @@ sub check_pxe_conf {
}
# launch wizard to setup a PXE server
-sub wizard_pxe_server {
+sub wizard_pxe_server() {
local $::isEmbedded = 0;
my $in = 'interactive'->vnew('su');
undef $::WizardTable;
@@ -848,7 +856,7 @@ sub save_config {
}
# set default PXE message
-sub default_pxe_messages {
+sub default_pxe_messages() {
save_config($PXEMESSAGE);
output($PXEMESSAGE, <<EOF);
@@ -869,7 +877,7 @@ sub default_pxe_messages {
EOF
}
-sub default_pxe_menu {
+sub default_pxe_menu() {
save_config($PXEHELP);
output($PXEHELP, <<EOF);
Available images are:
@@ -890,11 +898,11 @@ sub tftp_blksize {
}
# enable tftp server in xinetd conf
-sub enable_tftps {
+sub enable_tftps() {
substInFile { s/disable.*/disable = no/ } "$XINETDDIR/tftp";
}
-sub memlinux_prep {
+sub memlinux_prep() {
if (!-f "$X86/memdisk") {
cp_af($MEMDISK, $X86);
}
@@ -909,7 +917,7 @@ sub check_started {
}
# main procedure to setup PXE server
-sub do_it_pxe {
+sub do_it_pxe() {
return if $::testing;
my $in = 'interactive'->vnew('su', 'PXE server');
my $w = $in->wait_message(N("PXE server"), N("Configuring PXE server on your system..."));
@@ -960,7 +968,7 @@ if (! -f "$X86/drakwizard_pxe") {
}
check_pxe_conf();
-sub launch_pxe_server {
+sub launch_pxe_server() {
eval { wizard_pxe_server() };
my $err = $@;
$::WizardWindow->destroy if defined $::WizardWindow;
@@ -988,14 +996,14 @@ add_columns($treeview);
# labels that list pxe menu entry
my $labelscombo = Gtk2::OptionMenu->new;
#my @labelslist = list_label_pxe;
-my $defaultlabel = get_default_pxe;
+my $defaultlabel = get_default_pxe();
$labelscombo->entry->set_text($defaultlabel);
$labelscombo->entry->signal_connect("changed", sub { my $new_default = $labelscombo->entry->get_text;
set_new_default($new_default);
}
);
-my @o = list_label_pxe;
+my @o = list_label_pxe();
$labelscombo->set_popdown_strings("", sort(@o));
$labelscombo->entry->set_text($defaultlabel);
set_help_tip($labelscombo, 'labels');
@@ -1022,16 +1030,16 @@ $W->add(gtkpack_(Gtk2::VBox->new(0,0),
}
}),
0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Remove PXE entry")), 'removepxe'), clicked => sub {
- remove_item($model, $treeview); }
+ remove_item($model, $treeview) }
),
0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Edit PXE entry")), 'editb'), clicked => sub {
- edit_box_item($model, $treeview); }
+ edit_box_item($model, $treeview) }
),
0, Gtk2::Label->new(N("boot:")),
0, $labelscombo,
- 0, Gtk2::VSeparator->new(),
+ 0, Gtk2::VSeparator->new,
0, gtksignal_connect(new Gtk2::Button(N("Help")),
- clicked => sub { show_help }
+ clicked => sub { show_help() }
),
),
if_($::isEmbedded, 0, $okcancel),