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