summaryrefslogtreecommitdiffstats
path: root/drakpxelinux.pl
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-09-01 14:39:38 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-09-01 14:39:38 +0000
commit958eabb1bc4355df3fa27df1dfe11c56bccfb6ca (patch)
tree954c4de3e81f753c5434897a71b81ef5386e6915 /drakpxelinux.pl
parent1de8bfe760a1781285d1cea790c0789f1dc7e53c (diff)
downloaddrakpxelinux-958eabb1bc4355df3fa27df1dfe11c56bccfb6ca.tar
drakpxelinux-958eabb1bc4355df3fa27df1dfe11c56bccfb6ca.tar.gz
drakpxelinux-958eabb1bc4355df3fa27df1dfe11c56bccfb6ca.tar.bz2
drakpxelinux-958eabb1bc4355df3fa27df1dfe11c56bccfb6ca.tar.xz
drakpxelinux-958eabb1bc4355df3fa27df1dfe11c56bccfb6ca.zip
try to fix system tab (default value)
Diffstat (limited to 'drakpxelinux.pl')
-rw-r--r--drakpxelinux.pl45
1 files changed, 26 insertions, 19 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl
index 64b3819..0f43445 100644
--- a/drakpxelinux.pl
+++ b/drakpxelinux.pl
@@ -253,6 +253,7 @@ sub add_local_entry {
if (test_similar_label("local", $pxelinux_conf)) {
my $entry = {
label => "local",
+ kernel => "LOCALBOOT 0",
};
push @{$pxelinux_conf->{entries}}, $entry;
set_pxelinux_entry_at_iter($model, $model->append, $entry);
@@ -863,7 +864,7 @@ sub create_systems_list() {
N("Profil 2") => 'text',
N("Computer Name") => 'text',
);
- foreach ($systems->get_columns) { $_->set_resizable(1); }
+ foreach ($systems->get_columns) { $_->set_resizable(1) }
$systems->set_headers_clickable(1);
$systems->get_selection->set_mode('multiple');
# $systems->get_model->set_sort_column_id(0, 'ascending');
@@ -874,6 +875,7 @@ sub create_systems_list() {
#- don't let the user modify the "Installed" state
$systems->get_column(1)->get_cell_renderers->set_property('mode', 'inert');
$systems->set_column_editable(3, 1);
+# $systems->get_cell_renderers->set_property->signal_connect('clicked', sub { print "here" });
$systems->set_rules_hint(1);
return $systems;
}
@@ -891,7 +893,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);
+ refresh_menu($pxelinux_conf, $treeview);
update_treeview($pxelinux_conf);
});
return $profiles;
@@ -941,24 +943,29 @@ sub find_system_entry_for_mac_address {
sub get_name_from_mac {
my ($mac) = @_;
foreach (cat_($conf_mac_profiles_name)) {
- return $1 if m/$mac\|\w+\|\w+\|(\w+)/;
+ return $3 if m/$mac\|(\w+|)\|(\w+|)\|(.*|)/;
}
}
sub get_profile2_from_mac {
my ($mac) = @_;
foreach (cat_($conf_mac_profiles_name)) {
- return $1 if m/$mac\|\w+\|(\w+)\|\w+/;
+ return $2 if m/$mac\|(\w+|)\|(\w+|)\|(.*|)/;
}
}
sub update_systems_data {
- my ($systems) = @_;
+# my ($systems) = @_;
+ my ($mac , $name, $entry);
+ print Dumper($systems);
foreach $a (@{$systems->{data}}) {
- my $mac = $a->[0];
- my $entry = [ $mac ];
- get_name_from_mac($mac) and $a->[3] = get_name_from_mac($mac);
- get_profile2_from_mac($mac) and $a->[2] = get_profile2_from_mac($mac);
+ $mac = $a->[0];
+ $entry = [ $mac ];
+ my $profile2 = get_profile2_from_mac($mac);
+ my $name = get_name_from_mac($mac);
+ print "$mac , $profile2 , $name\n";
+ $profile2 and $a->[2] = $profile2;
+ $name and $a->[3] = $name;
}
}
@@ -970,7 +977,6 @@ sub add_configured_mac_addresses() {
push @{$systems->{data}}, $entry;
gtktext_append($log_text, "Detected new system: $mac_address\n");
}
- update_systems_data($systems);
}
sub get_mac_addresses_from_dhcp_log() {
@@ -998,13 +1004,13 @@ sub refresh_profiles() {
}
sub refresh_menu {
- my ($pxelinux_conf) = @_;
+ my ($pxelinux_conf, $treeview) = @_;
my @menu = network::pxe::list_pxelinux_labels($pxelinux_conf);
mygtk2::gtkset($menu_combo, list => [ '', @menu ]);
my $defaultlabel = $pxelinux_conf->{default};
- $menu_combo->set_text($defaultlabel);
$menu_combo->signal_connect(changed => sub {
- $pxelinux_conf->{default} = $menu_combo->get_text;
+ $pxelinux_conf->{default} = $menu_combo->get_active_text;
+ write_conf($pxelinux_conf, $treeview);
});
}
@@ -1028,8 +1034,7 @@ sub add_profile() {
}
sub write_profile_conf {
- print "write_conf\n";
- my ($systems) = @_;
+# my ($systems) = @_;
my ($mac, $profile, $profile2, $name);
output($conf_mac_profiles_name, "# auto generated by drakpxelinux\n");
foreach $a (@{$systems->{data}}) {
@@ -1058,7 +1063,7 @@ sub profile_selected {
sub update_treeview {
my ($pxelinux_conf) = @_;
$model->clear;
- set_pxelinux_entry_at_iter($model, $model->append, $_) foreach (@{$pxelinux_conf->{entries}});
+ set_pxelinux_entry_at_iter($model, $model->append, $_) foreach @{$pxelinux_conf->{entries}};
}
@@ -1174,7 +1179,6 @@ gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [
0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Apply to profile")), 'apply'), clicked => sub {
my $pxelinux_conf = get_pxelinux_conf_from_profile();
write_conf($pxelinux_conf, $treeview);
- write_profile_conf();
}),
0, gtknew('Label', text => N("Default boot:")),
0, $menu_combo = gtknew('ComboBox'),
@@ -1193,8 +1197,9 @@ gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [
my $entry = $systems->{data}[$_];
network::pxe::set_profile_for_mac_address($profile, $to_install, $entry->[0]);
system_entry_set_profile($entry, $profile);
- update_systems_data($systems);
}
+ update_systems_data();
+ write_profile_conf();
}),
gtksignal_connect(gtknew('Button', text => N("Set Profile 2")), clicked => sub {
my $profile = $profiles_combo->get_active_text;
@@ -1202,8 +1207,9 @@ gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [
foreach ($systems->get_selected_indices) {
my $entry = $systems->{data}[$_];
system_entry_set_profile2($entry, $profile);
- update_systems_data($systems);
}
+ update_systems_data();
+ write_profile_conf();
}),
$profiles_combo = gtknew('ComboBox'),
]),
@@ -1218,6 +1224,7 @@ gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [
);
add_configured_mac_addresses();
+update_systems_data();
get_mac_addresses_from_dhcp_log();
Glib::Timeout->add(60000, \&get_mac_addresses_from_dhcp_log);
refresh_profiles();