SI/system.pm
changeset 15 4e3753b998a9
parent 8 2a66bb6a6a6e
child 16 fd87c1e3b451
--- a/SI/system.pm	Mon Jan 18 22:55:10 2010 +0100
+++ b/SI/system.pm	Tue Jan 19 14:49:43 2010 +0100
@@ -6,14 +6,12 @@
 
 $ENV{LC_ALL} = "C";
 
-sub id($) {
-    my ($file) = @_;
-    open(my $f, ">$file") or die "Can't open $file: $!\n";
-    # hope it's eth*
+sub id() {
+    # hope it's eth* or wlan*
     local $_ = (sort grep { /^(eth|wlan)/ } `ifconfig -a`)[0];
-    return if not $_;
-    return if not /^(?<dev>\S+)\s.*HWaddr\s+(?<mac>[\da-f:]+)\s*$/i;
-    print $f "ethernet $+{dev} $+{mac}\n";
+    /^(?<dev>\S+)\s.*HWaddr\s+(?<mac>[\da-f:]+)\s*$/i
+    	and return $+{mac};
+    die "ERR: Can't get system identification (MAC address)\n";
 }
 
 1;