equal
deleted
inserted
replaced
|
1 package SI::system; |
|
2 |
|
3 use strict; |
|
4 use warnings; |
|
5 use if $ENV{DEBUG} ~~ qw(system) => "Smart::Comments"; |
|
6 |
|
7 $ENV{LC_ALL} = "C"; |
|
8 |
|
9 sub id($) { |
|
10 my ($file) = @_; |
|
11 open(my $f, ">$file") or die "Can't open $file: $!\n"; |
|
12 # hope it's eth* |
|
13 local $_ = (sort grep { /^(eth|wlan)/ } `ifconfig -a`)[0]; |
|
14 return if not $_; |
|
15 return if not /^(?<dev>\S+)\s.*HWaddr\s+(?<mac>[\da-f:]+)\s*$/i; |
|
16 print $f "ethernet $+{dev} $+{mac}\n"; |
|
17 } |
|
18 |
|
19 1; |
|
20 # vim:sts=4 sw=4 aw ai si: |