diff options
-rw-r--r-- | drakpxelinux.pl | 102 |
1 files changed, 57 insertions, 45 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl index 270b161..d55e11c 100644 --- a/drakpxelinux.pl +++ b/drakpxelinux.pl @@ -18,7 +18,7 @@ # 02111-1307, USA. # Quick configuration of PXE menu parameters -# release 0.5 +# release 0.8 # use with care developement release.... # thx R1 for test and some debug @@ -254,20 +254,20 @@ sub add_item { my ($model, $treeview) = @_; my @a; push @a, { - label => "cooker", - info => "install cooker", - kernel => "/images/cooker", - initrd => "cooker.rdz", - automatic => "http", - interface => "eth0", - network => "dhcp", - server => "10.0.1.33", - directory => "/install/cooker", - ramdisk => "64000", - vga => "788", - display => ":0", - option => "acpi=ht", - }; + label => "cooker", + info => "install cooker", + kernel => "/images/cooker", + initrd => "images/cooker.rdz", + automatic => "http", + interface => "eth0", + network => "dhcp", + server => "10.0.1.33", + directory => "/install/cooker", + ramdisk => "64000", + vga => "788", + display => ":0", + option => "acpi=ht", + }; my $iter = $model->append; $model->set($iter, @@ -285,7 +285,8 @@ sub add_item { COLUMN_DISPLAY, $a[-1]{display}, COLUMN_OPTION, $a[-1]{option}, ); -# edit_box_item($model, $treeview, "-1"); + write_conf_pxe; + # edit_box_item($model, $treeview, "-1"); } sub remove_item { @@ -305,6 +306,13 @@ sub remove_item { } } +sub test_similar_label { + my ($newlabel) = @_; + if (any { /^label $newlabel$/ } cat_($conf)) { + err_dialog(N("Error !"), N("similar entry in PXE, choose another label please")) and return 0; + } else { return 1 }; +} + sub edit_box_item { my ($widget, $treeview, $indice) = @_; $::isWizard = 0; @@ -453,24 +461,26 @@ sub edit_box_item { $listpxe[$i]{option} = $option->get_text; # update value in cells - $model->set($iter, - COLUMN_LABEL, $listpxe[$i]{label}, - COLUMN_INFO, $listpxe[$i]{info}, - COLUMN_KERNEL, $listpxe[$i]{kernel}, - COLUMN_INITRD, $listpxe[$i]{initrd}, - COLUMN_AUTOMATIC, $listpxe[$i]{automatic}, - COLUMN_INTERFACE, $listpxe[$i]{interface}, - COLUMN_NETWORK, $listpxe[$i]{network}, - COLUMN_SERVER, $listpxe[$i]{server}, - COLUMN_DIRECTORY, $listpxe[$i]{directory}, - COLUMN_RAMDISK, $listpxe[$i]{ramdisk}, - COLUMN_VGA, $listpxe[$i]{vga}, - COLUMN_DISPLAY, $listpxe[$i]{display}, - COLUMN_OPTION, $listpxe[$i]{option}, - ); - $dialog->destroy; - write_conf_pxe; - add_in_help($listpxe[$i]{label}, $listpxe[$i]{info}); + if (test_similar_label($listpxe[$i]{label}) eq "1") { + $model->set($iter, + COLUMN_LABEL, $listpxe[$i]{label}, + COLUMN_INFO, $listpxe[$i]{info}, + COLUMN_KERNEL, $listpxe[$i]{kernel}, + COLUMN_INITRD, $listpxe[$i]{initrd}, + COLUMN_AUTOMATIC, $listpxe[$i]{automatic}, + COLUMN_INTERFACE, $listpxe[$i]{interface}, + COLUMN_NETWORK, $listpxe[$i]{network}, + COLUMN_SERVER, $listpxe[$i]{server}, + COLUMN_DIRECTORY, $listpxe[$i]{directory}, + COLUMN_RAMDISK, $listpxe[$i]{ramdisk}, + COLUMN_VGA, $listpxe[$i]{vga}, + COLUMN_DISPLAY, $listpxe[$i]{display}, + COLUMN_OPTION, $listpxe[$i]{option}, + ); + $dialog->destroy; + write_conf_pxe; + add_in_help($listpxe[$i]{label}, $listpxe[$i]{info}); + } }, }, ), @@ -520,9 +530,11 @@ sub cell_edited { my $i = ($path->get_indices)[0]; my $oldname = $listpxe[$i]{label}; my $newname = $new_text; - change_label_in_help($oldname, $newname); - $listpxe[$i]{label} = $new_text; - $model->set($iter, $column, $listpxe[$i]{label}); + if (test_similar_label($newname) eq "1") { + change_label_in_help($oldname, $newname); + $listpxe[$i]{label} = $new_text; + $model->set($iter, $column, $listpxe[$i]{label}); + } } elsif ($column == COLUMN_INFO) { my $i = ($path->get_indices)[0]; $listpxe[$i]{info} = $new_text; @@ -625,12 +637,12 @@ sub wizard_pxe_server { 1}, pages => { welcome => { - name => N("PXE wizard") . "\n\n" . N("Set a PXE server.") . "\n" . N("This wizard will help you configuring the PXE server, and PXE boot image management. PXE (Pre-boot eXecution Envir\onment) is a protocol designed by Intel that allows computers to boot through the network. PXE is stored in the ROM of new generation network cards. When the computer boots up, the BIOS loads the PXE ROM in the \memory and executes it. A menu is displayed, allowing the computer to boot an operating system loaded through the network."), + name => N("PXE wizard") . "\n\n" . N("Set a PXE server.") . "\n" . N("This wizard will help you configuring the PXE server, and PXE boot image management. PXE (Pre-boot eXecution Environment) is a protocol designed by Intel that allows computers to boot through the network. PXE is stored in the ROM of new generation network cards. When the computer boots up, the BIOS loads the PXE ROM in the memory and executes it. A menu is displayed, allowing the computer to boot an operating system loaded through the network."), no_back => 1, next => 'pxeserver', }, pxeserver => { - name => N("Set PXE server") . "\n\n" . N("We need to use a special dhcpd.conf file with PXE parameter. To set up such a DHCP server, launch the DHCP wizard and check the box 'Enable \PXE'. If you don't do that, PXE query will not be answered by this server.") . "\n" . N("Now the wizard will configure all needed default configuration files to allow computers to boot through the network."), + name => N("Set PXE server") . "\n\n" . N("We need to use a special dhcpd.conf file with PXE parameter. To set up such a DHCP server, launch the DHCP wizard and check the box 'Enable PXE'. If you don't do that, PXE query will not be answered by this server.") . "\n" . N("Now the wizard will configure all needed default configuration files to allow computers to boot through the network."), no_back => 1, next => 'summaryserver', }, @@ -795,10 +807,10 @@ $labels->set_popdown_strings(@labels); $labels->entry->set_text("$defaultlabel"); my $banner; -$banner = Gtk2::Banner->new('wiz_default_up', ("DrakPXE default configurati\on file")) unless $::isEmbedded; +$banner = Gtk2::Banner->new('wiz_default_up', ("DrakPXE default configuration file")) unless $::isEmbedded; my $okcancel = create_okcancel({ cancel_clicked => sub { ugtk2->exit }, - ok_clicked => \&write_conf_pxe, + ok_clicked => &write_conf_pxe, }, ); ; @@ -808,7 +820,7 @@ $W->add(gtkpack_(Gtk2::VBox->new(0,0), 0, $banner, 1, create_scrolled_window($treeview), 0, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 3), - 0, Gtk2::Label->new(N("default boot:")), + 0, Gtk2::Label->new(N("boot:")), 0, $labels, 0, gtksignal_connect(new Gtk2::Button(N("PXE server")), clicked => sub { @@ -824,13 +836,13 @@ $W->add(gtkpack_(Gtk2::VBox->new(0,0), 0, gtksignal_connect(new Gtk2::Button(N("Help")), clicked => sub { show_help } ), - 0, gtksignal_connect(Gtk2::Button->new(N("Add a PXE entry")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new(N("Add PXE entry")), clicked => sub { add_item($model, $treeview); } ), - 0, gtksignal_connect(Gtk2::Button->new((N"Remove a PXE entry")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new((N"Remove PXE entry")), clicked => sub { remove_item($model, $treeview); } ), - 0, gtksignal_connect(Gtk2::Button->new(N("Edit a PXE entry")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new(N("Edit PXE entry")), clicked => sub { edit_box_item($model, $treeview); } ), ), |