summaryrefslogtreecommitdiffstats
path: root/drakpxelinux.pl
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-06-21 08:59:24 +0000
committerOlivier Blin <oblin@mandriva.org>2005-06-21 08:59:24 +0000
commit5563d3f93cb048162ee954c184e2e60bfa6aed88 (patch)
treef835fd549af8fa1db0ea42f9c987137dd19ef08f /drakpxelinux.pl
parent5e9ff9c513f03772c5bf10f27ecffc111f573fb0 (diff)
downloaddrakpxelinux-5563d3f93cb048162ee954c184e2e60bfa6aed88.tar
drakpxelinux-5563d3f93cb048162ee954c184e2e60bfa6aed88.tar.gz
drakpxelinux-5563d3f93cb048162ee954c184e2e60bfa6aed88.tar.bz2
drakpxelinux-5563d3f93cb048162ee954c184e2e60bfa6aed88.tar.xz
drakpxelinux-5563d3f93cb048162ee954c184e2e60bfa6aed88.zip
- give config file path as argument in network::pxe::{read,write}_pxelinux_conf
- add write_conf in drakpxelinux to ease profile handling
Diffstat (limited to 'drakpxelinux.pl')
-rw-r--r--drakpxelinux.pl36
1 files changed, 22 insertions, 14 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl
index 144fc21..e7178c4 100644
--- a/drakpxelinux.pl
+++ b/drakpxelinux.pl
@@ -135,7 +135,13 @@ use constant COLUMN_DISPLAY => 11;
use constant COLUMN_OPTION => 12;
use constant NUM_COLUMNS => 13;
-my $pxelinux_conf = network::pxe::read_pxelinux_conf();
+
+my ($config_file, $help_file) = ($network::pxe::pxelinux_config_file, $network::pxe::pxelinux_help_file);
+my $pxelinux_conf = network::pxe::read_pxelinux_conf($config_file, $help_file);
+
+sub write_conf() {
+ network::pxe::write_pxelinux_conf($pxelinux_conf, $config_file);
+}
sub set_pxelinux_entry_at_iter {
my ($model, $iter, $entry) = @_;
@@ -232,7 +238,7 @@ sub wizard_add_entry {
};
push @{$pxelinux_conf->{entries}}, $entry;
set_pxelinux_entry_at_iter($model, $model->append, $entry);
- network::pxe::write_pxelinux_conf($pxelinux_conf);
+ write_conf();
undef $w;
return;
},
@@ -279,7 +285,7 @@ sub remove_item {
}
$model->remove($iter);
splice @{$pxelinux_conf->{entries}}, $i, 1;
- network::pxe::write_pxelinux_conf($pxelinux_conf);
+ write_conf();
}
}
@@ -507,7 +513,7 @@ sub edit_box_item {
# update value in cells
set_pxelinux_entry_at_iter($model, $iter, $entry);
$dialog->destroy;
- network::pxe::write_pxelinux_conf($pxelinux_conf);
+ write_conf();
network::pxe::add_in_help($entry->{label}, $entry->{info});
},
},
@@ -596,7 +602,7 @@ sub cell_edited {
$entry->{option} = $new_text;
$model->set($iter, $column, $entry->{option});
}
- network::pxe::write_pxelinux_conf($pxelinux_conf);
+ write_conf();
}
sub show_help() { info_dialog("help",
@@ -721,15 +727,17 @@ EOF
mkdir_p($network::pxe::pxelinux_images);
memlinux_prep();
+ my $default_conf = network::pxe::read_pxelinux_conf($network::pxe::pxelinux_config_file, $network::pxe::pxelinux_help_file);
+
#- restore default pxe settings
- put_in_hash($pxelinux_conf, {
- 'prompt' => 1,
- 'default' => 'local',
- 'display' => 'messages',
- 'timeout' => '50',
- 'f1' => 'help.txt',
- });
- network::pxe::write_pxelinux_conf($pxelinux_conf);
+ put_in_hash($default_conf, {
+ 'prompt' => 1,
+ 'default' => 'local',
+ 'display' => 'messages',
+ 'timeout' => '50',
+ 'f1' => 'help.txt',
+ });
+ network::pxe::write_pxelinux_conf($default_conf, $network::pxe::pxelinux_config_file);
save_config($network::pxe::pxelinux_help_file);
network::pxe::write_default_pxe_help();
@@ -809,7 +817,7 @@ set_help_tip($labelscombo, 'labels');
my $okcancel = create_okcancel({
cancel_clicked => sub { ugtk2->exit },
- ok_clicked => sub { network::pxe::write_pxelinux_conf($pxelinux_conf) },
+ ok_clicked => \&write_conf,
},
);