summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-09-05 11:15:43 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-09-05 11:15:43 +0000
commit27196676a0cb1adc27d12464334233b2383af5d9 (patch)
tree7347a6d9ee2d247ff2fd8bb7a1715b2d0f7933a3
parente262c306707e7ddf931d47e08cdd9f31e9be3923 (diff)
downloaddrakpxelinux-27196676a0cb1adc27d12464334233b2383af5d9.tar
drakpxelinux-27196676a0cb1adc27d12464334233b2383af5d9.tar.gz
drakpxelinux-27196676a0cb1adc27d12464334233b2383af5d9.tar.bz2
drakpxelinux-27196676a0cb1adc27d12464334233b2383af5d9.tar.xz
drakpxelinux-27196676a0cb1adc27d12464334233b2383af5d9.zip
major bug fix: write_conf, fix local pb, fix duplicate default config
(need to update network::pxe to bypass some horrible fix)
-rw-r--r--drakpxelinux.pl47
1 files changed, 30 insertions, 17 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl
index 99a1837..ea81c55 100644
--- a/drakpxelinux.pl
+++ b/drakpxelinux.pl
@@ -42,7 +42,7 @@ use mygtk2 qw(gtknew);
use Gtk2::SimpleList;
use Gtk2::Helper;
use run_program;
-#use Data::Dumper;
+use Data::Dumper;
our $model = create_model();
our $treeview = Gtk2::TreeView->new_with_model($model);
@@ -175,10 +175,17 @@ foreach (@ARGV) {
}
}
-my ($config_file, $help_file);# = $profile && $type ?
+my ($config_file, $help_file); # = $profile && $type ?
# network::pxe::get_pxelinux_profile_path($profile, $type) :
# ($network::pxe::pxelinux_config_file, $network::pxe::pxelinux_help_file);
-my $pxelinux_conf; # = network::pxe::read_pxelinux_conf($config_file, $help_file);
+my $pxelinux_conf;# = network::pxe::read_pxelinux_conf($config_file, $help_file);
+
+sub link_default_path() {
+ # need to quick fix pb of duplicate default (network::pxe need various adjustement).
+ if (!-f "$network::pxe::pxelinux_client_root/pxelinux.cfg/profiles/boot/default") {
+ system("ln -sf $network::pxe::pxelinux_config_file $network::pxe::pxelinux_client_root/pxelinux.cfg/profiles/boot/default");
+ }
+}
sub update_pxelinux_conf_from_treeview {
@@ -213,10 +220,12 @@ sub update_pxelinux_conf_from_treeview {
sub write_conf {
- print "write conf PXE\n";
my ($pxelinux_conf, $treeview) = @_;
update_pxelinux_conf_from_treeview($pxelinux_conf, $treeview);
- network::pxe::write_pxelinux_conf($pxelinux_conf, $config_file);
+ if (basename($config_file) ne "local") {
+ #print "write conf PXE\n";
+ network::pxe::write_pxelinux_conf($pxelinux_conf, $config_file);
+ }
}
sub set_pxelinux_entry_at_iter {
@@ -274,9 +283,9 @@ sub wizard_add_entry {
use wizards;
my $WPXENAME = "Mandriva";
my $WINFO = "install Mandriva";
- my $WALLRDZ = "/mnt/10.1/isolinux/alt0/all.rdz";
+ my $WALLRDZ = "/mnt/nfs/isolinux/alt0/all.rdz";
# my $WALLRDZ = "/tmp/all.rdz";
- my $WVMLINUZ = "/mnt/10.1/isolinux/alt0/vmlinuz";
+ my $WVMLINUZ = "/mnt/nfs/isolinux/alt0/vmlinuz";
# my $WVMLINUZ = "/tmp/vmlinuz";
my $w = wizards->new;
my $wiz = {
@@ -933,7 +942,7 @@ sub create_profiles_list() {
$profiles->get_selection->set_mode('browse');
$profiles->get_selection->signal_connect(changed => sub {
my $pxelinux_conf = get_pxelinux_conf_from_profile();
- refresh_menu($pxelinux_conf, $treeview);
+ #refresh_menu($pxelinux_conf, $treeview);
update_treeview($pxelinux_conf);
});
return $profiles;
@@ -946,8 +955,10 @@ my $log_text = gtknew('TextView');
sub get_selected_profile() {
my $model_profiles = $profiles->get_model;
my $iter = $profiles->get_selection->get_selected;
- $iter and my $profile = $model_profiles->get($iter, 0);
- return $profile;
+ if ($iter) {
+ my $profile = $model_profiles->get($iter, 0);
+ return $profile;
+ }
}
sub get_pxelinux_conf_from_profile() {
@@ -1036,8 +1047,6 @@ my ($profiles_combo, $install_button, $menu_combo);
sub refresh_profiles() {
my @profiles = network::pxe::list_profiles($profiles_conf);
mygtk2::gtkset($profiles_combo, list => [ '', @profiles ]);
- # add default PXE menu
- push @profiles, "default";
@{$profiles->{data}} = @profiles;
}
@@ -1053,6 +1062,7 @@ sub refresh_menu {
} else { $c++ }
}
$menu_combo->signal_connect(changed => sub {
+ #my $pxelinux_conf = get_selected_profile;
$pxelinux_conf->{default} = $menu_combo->get_active_text;
$pxelinux_conf and write_conf($pxelinux_conf, $treeview);
});
@@ -1098,14 +1108,14 @@ sub write_profile_conf {
sub profile_selected {
my ($profile) = @_;
- if ($profile eq 'default') {
- ($config_file, $help_file) = ($network::pxe::pxelinux_config_file, $network::pxe::pxelinux_help_file);
- } else {
+# if ($profile eq 'default') {
+# ($config_file, $help_file) = ($network::pxe::pxelinux_config_file, $network::pxe::pxelinux_help_file);
+# } else {
# force type = boot
my $type = "boot";
($config_file, $help_file) = network::pxe::get_pxelinux_profile_path($profile, $type);
- undef $pxelinux_conf;
- }
+# undef $pxelinux_conf;
+# }
my $pxelinux_conf = network::pxe::read_pxelinux_conf($config_file, $help_file);
return $pxelinux_conf;
}
@@ -1213,6 +1223,8 @@ gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [
0, gtknew('HButtonBox', layout => 'start', children => [
0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Add a PXE entry")), 'addpxe'), clicked => sub {
my $pxelinux_conf = get_pxelinux_conf_from_profile();
+ my $profile = get_selected_profile;
+ if ($profile eq "local") { $in->ask_warn(N("Info"), N("Local profile is special, and doesn't need a new entry.")) and return };
$pxelinux_conf and eval { wizard_add_entry($model, $treeview, $pxelinux_conf);
write_conf($pxelinux_conf, $treeview);
};
@@ -1276,6 +1288,7 @@ gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [
);
add_local_profil_entry();
+link_default_path();
add_configured_mac_addresses();
get_mac_addresses_from_dhcp_log();
update_systems_data_from_file();