From 02b02783bfc8743bd703908f06945129625f0c8a Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Fri, 2 Sep 2005 10:14:46 +0000 Subject: fix pb of duplicate entry in systems tab (need to update systems avec get all mac addr) --- drakpxelinux.pl | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'drakpxelinux.pl') diff --git a/drakpxelinux.pl b/drakpxelinux.pl index 1700a69..0aedd3f 100644 --- a/drakpxelinux.pl +++ b/drakpxelinux.pl @@ -976,27 +976,16 @@ sub add_configured_mac_addresses() { } } -sub first_get_all_mac { - my %addresses; - foreach (cat_("/var/log/daemons/info")) { - /dhcpd:\s+DHCP(?:DISCOVER|REQUEST).*\s+from\s+($mac_regexp)\b/ and $addresses{$1} = 1; - } - foreach (keys %addresses) { - my $entry = [ $_ ]; - push @{$systems->{data}}, $entry; - } -} - sub get_mac_addresses_from_dhcp_log() { my %addresses; foreach (cat_("/var/log/daemons/info")) { /dhcpd:\s+DHCP(?:DISCOVER|REQUEST).*\s+from\s+($mac_regexp)\b/ and $addresses{$1} = 1; } foreach (difference2([ keys %addresses ], [ map { $_->[0] } @{$systems->{data}} ])) { - my $entry = [ $_ ]; - system_entry_set_profile($entry, ''); - push @{$systems->{data}}, $entry; - gtktext_append($log_text, "Detected new system: $_\n"); + my $entry = [ $_ ]; + system_entry_set_profile($entry, ''); + push @{$systems->{data}}, $entry; + gtktext_append($log_text, "Detected new system: $_\n"); } 1; #- run callback on next timeout } @@ -1224,9 +1213,8 @@ gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [ ); add_configured_mac_addresses(); -first_get_all_mac(); -update_systems_data_from_file(); get_mac_addresses_from_dhcp_log(); +update_systems_data_from_file(); Glib::Timeout->add(60000, \&get_mac_addresses_from_dhcp_log); refresh_profiles(); $w->show; -- cgit v1.2.1