summaryrefslogtreecommitdiffstats
path: root/drakpxelinux.pl
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-08-30 08:28:39 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-08-30 08:28:39 +0000
commitf9aa790b199eda9e20015a65c83c488603f4d74a (patch)
treef1c80cc83061818e7f717d1360c0b9a2acbbb36d /drakpxelinux.pl
parent095e4eca6a027fb11b6fefaf602d63d1b5dc7aab (diff)
downloaddrakpxelinux-f9aa790b199eda9e20015a65c83c488603f4d74a.tar
drakpxelinux-f9aa790b199eda9e20015a65c83c488603f4d74a.tar.gz
drakpxelinux-f9aa790b199eda9e20015a65c83c488603f4d74a.tar.bz2
drakpxelinux-f9aa790b199eda9e20015a65c83c488603f4d74a.tar.xz
drakpxelinux-f9aa790b199eda9e20015a65c83c488603f4d74a.zip
various fix to work on good pxelinux_conf
Diffstat (limited to 'drakpxelinux.pl')
-rw-r--r--drakpxelinux.pl56
1 files changed, 34 insertions, 22 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl
index f023404..a42f733 100644
--- a/drakpxelinux.pl
+++ b/drakpxelinux.pl
@@ -342,7 +342,7 @@ sub test_similar_label {
# dialog box to edit a PXE entry
sub edit_box_item {
- my ($_widget, $treeview) = @_;
+ my ($_widget, $treeview, $pxelinux_conf) = @_;
$::isWizard = 0;
my $model = $treeview->get_model;
my $selection = $treeview->get_selection;
@@ -849,18 +849,24 @@ sub create_profiles_list() {
$profiles->set_headers_visible(1);
$profiles->get_selection->set_mode('browse');
$profiles->get_selection->signal_connect(changed => sub {
- my ($models, $iter) = $_[0]->get_selected or return;
- ($config_file, $help_file) = network::pxe::get_pxelinux_profile_path($models->get($iter, 0), 'boot');
- profile_selected($models->get($iter, 0));
+ my $pxelinux_conf = get_pxelinux_conf_from_profile();
+ update_treeview($pxelinux_conf);
});
return $profiles;
}
my $profiles = create_profiles_list;
my $systems = create_systems_list;
-
my $log_text = gtknew('TextView');
+sub get_pxelinux_conf_from_profile() {
+ my $model_profiles = $profiles->get_model;
+ my $iter = $profiles->get_selection->get_selected;
+ ($config_file, $help_file) = network::pxe::get_pxelinux_profile_path($model_profiles->get($iter, 0), 'boot');
+ my $pxelinux_conf = profile_selected($model_profiles->get($iter, 0));
+ return $pxelinux_conf;
+}
+
sub system_entry_set_profile { my ($entry, $profile) = @_; $entry->[2] = $profile || N("None") }
sub system_entry_set_installed { my ($entry, $state) = @_; $entry->[1] = $state }
@@ -931,7 +937,6 @@ our $treeview = Gtk2::TreeView->new_with_model($model);
sub profile_selected {
my ($profile) = @_;
- $model->clear;
if ($profile eq 'default') {
($config_file, $help_file) = ($network::pxe::pxelinux_config_file, $network::pxe::pxelinux_help_file);
} else {
@@ -941,12 +946,16 @@ sub profile_selected {
print "----- $config_file $help_file\n";
undef $pxelinux_conf;
}
- print Dumper($pxelinux_conf);
my $pxelinux_conf = network::pxe::read_pxelinux_conf($config_file, $help_file);
- set_pxelinux_entry_at_iter($model, $model->append, $_) foreach (@{$pxelinux_conf->{entries}});
return $pxelinux_conf;
}
+sub update_treeview {
+ my ($pxelinux_conf) = @_;
+ $model->clear;
+ set_pxelinux_entry_at_iter($model, $model->append, $_) foreach (@{$pxelinux_conf->{entries}});
+}
+
# check if first launch
if (!-f ($network::pxe::pxelinux_client_root . "/drakwizard_pxe")) {
@@ -997,9 +1006,9 @@ $treeview->signal_connect(button_press_event => sub {
my $selection = $treeview->get_selection;
my $iter = $selection->get_selected;
if ($iter) {
- my $path = $model->get_path($iter);
- my $i = ($path->get_indices)[0];
- edit_box_item($model, $treeview) if $event->type eq '2button-press';
+ # get pxelinux_conf file
+ my $pxelinux_conf = get_pxelinux_conf_from_profile();
+ edit_box_item($model, $treeview, $pxelinux_conf) if $event->type eq '2button-press';
}
});
@@ -1044,18 +1053,21 @@ gtkpack($w->{window},
0, gtknew('VBox', spacing => 1, children => [
0, gtknew('HButtonBox', layout => 'start', children => [
0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Add PXE entry")), 'addpxe'), clicked => sub {
- eval { wizard_add_entry($model, $treeview) };
- my $err = $@;
- $::WizardWindow->destroy if defined $::WizardWindow;
- undef $::WizardWindow;
- if ($err && $err !~ /wizcancel/) {
- err_dialog(N("Error"), N("The PXE entry wizard has unexpectedly failed:") . "\n\n" . $err);
- }
- }),
- 0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Remove")), 'removepxe'), clicked => sub { remove_item($model, $treeview) }),
+ my $pxelinux_conf = get_pxelinux_conf_from_profile();
+ eval { wizard_add_entry($model, $treeview, $pxelinux_conf) };
+ my $err = $@;
+ $::WizardWindow->destroy if defined $::WizardWindow;
+ undef $::WizardWindow;
+ if ($err && $err !~ /wizcancel/) {
+ err_dialog(N("Error"), N("The PXE entry wizard has unexpectedly failed:") . "\n\n" . $err);
+ }
+ }),
+ 0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Remove")), 'removepxe'), clicked => sub {
+ my $pxelinux_conf = get_pxelinux_conf_from_profile();
+ remove_item($model, $treeview, $pxelinux_conf) }),
0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Edit")), 'editb'), clicked => sub {
- edit_box_item($model, $treeview) }),
-
+ my $pxelinux_conf = get_pxelinux_conf_from_profile();
+ edit_box_item($model, $treeview, $pxelinux_conf) }),
#gtknew('Label', text => N("Default boot:")),
#1, $labelscombo,
]