diff -r 0352bb49b838 -r 2a66bb6a6a6e SI/system.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SI/system.pm Sun Jan 17 00:00:02 2010 +0100 @@ -0,0 +1,20 @@ +package SI::system; + +use strict; +use warnings; +use if $ENV{DEBUG} ~~ qw(system) => "Smart::Comments"; + +$ENV{LC_ALL} = "C"; + +sub id($) { + my ($file) = @_; + open(my $f, ">$file") or die "Can't open $file: $!\n"; + # hope it's eth* + local $_ = (sort grep { /^(eth|wlan)/ } `ifconfig -a`)[0]; + return if not $_; + return if not /^(?\S+)\s.*HWaddr\s+(?[\da-f:]+)\s*$/i; + print $f "ethernet $+{dev} $+{mac}\n"; +} + +1; +# vim:sts=4 sw=4 aw ai si: