diff options
Diffstat (limited to 'drakpxelinux.pl')
-rw-r--r-- | drakpxelinux.pl | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl index aab66c6..d9953f8 100644 --- a/drakpxelinux.pl +++ b/drakpxelinux.pl @@ -945,17 +945,14 @@ sub find_system_entry_for_mac_address { sub get_name_from_mac { my ($mac) = @_; foreach (cat_($conf_mac_profiles_name)) { - my $name = $1 if m/$mac\|\w+\|\w+\|(\w+)/; - $name and return $name; + return $1 if m/$mac\|\w+\|\w+\|(\w+)/; } } sub get_profile2_from_mac { my ($mac) = @_; foreach (cat_($conf_mac_profiles_name)) { - my $profile = $1 if m/$mac\|\w+\|(\w+)\|\w+/; - print $profile; - $profile and return $profile; + return $1 if m/$mac\|\w+\|(\w+)\|\w+/; } } @@ -963,32 +960,18 @@ sub update_systems_data { my ($systems) = @_; foreach $a (@{$systems->{data}}) { my $mac = $a->[0]; - my $name = get_name_from_mac($mac); - my $profile = get_profile2_from_mac($mac); my $entry = [ $mac ]; - - foreach (cat_($conf_mac_profiles_name)) { - my $name if m/$mac\|\w+\|\w+\|(\w+)/; - my $profile if m/$mac\|\w+\|(\w+)\|\w+/; - print " $mac name $name\n"; - print " $mac profile $profile\n"; - } - system_entry_set_name($entry, $name); - system_entry_set_profile2($entry, $profile); + 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); } } sub add_configured_mac_addresses() { - my ($name, $profile2); + my ($name); while (my ($mac_address, $conf) = each %{$profiles_conf->{per_mac}}) { my $entry = [ $mac_address ]; system_entry_set_profile($entry, $conf->{profile}); -# $name = get_name_from_mac($mac_address); -# $profile2 = get_profile2_from_mac($mac_address); -# system_entry_set_name($entry, $conf->{name}); -# system_entry_set_profile2($entry, $conf->{profile2}); push @{$systems->{data}}, $entry; -# write_profile_conf($systems); gtktext_append($log_text, "Detected new system: $mac_address\n"); } update_systems_data($systems); @@ -1197,6 +1180,7 @@ 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, $labelscombo, @@ -1216,7 +1200,6 @@ gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [ network::pxe::set_profile_for_mac_address($profile, $to_install, $entry->[0]); system_entry_set_profile($entry, $profile); update_systems_data($systems); - write_profile_conf($systems); } }), gtksignal_connect(gtknew('Button', text => N("Set Profile 2")), clicked => sub { @@ -1226,7 +1209,6 @@ gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [ my $entry = $systems->{data}[$_]; system_entry_set_profile2($entry, $profile); update_systems_data($systems); - write_profile_conf($systems); } }), $profiles_combo = gtknew('ComboBox'), |