equal
deleted
inserted
replaced
8 |
8 |
9 $ENV{LC_ALL} = "C"; |
9 $ENV{LC_ALL} = "C"; |
10 |
10 |
11 sub id() { |
11 sub id() { |
12 |
12 |
13 # hope it's eth* or wlan* |
13 $_ = `ip link`; |
14 local $_ = (sort grep { /^(eth|wlan)/ } `ifconfig -a`)[0]; |
14 s/\n\s+/ /g; |
15 /^(?<dev>\S+)\s.*HWaddr\s+(?<mac>[\da-f:]+)\s*$/i |
15 s/^\d+:\s*//mg; |
|
16 |
|
17 (sort grep /^(eth|wlan)/, split /\n/, $_)[0] |
|
18 =~ /link\/ether\s+(?<mac>\S+)/ |
16 and return $+{mac}; |
19 and return $+{mac}; |
|
20 |
17 die "ERR: Can't get system identification (MAC address)\n"; |
21 die "ERR: Can't get system identification (MAC address)\n"; |
18 } |
22 } |
19 |
23 |
20 sub hostname(\%) { |
24 sub hostname(\%) { |
21 my $devs = shift; |
25 my $devs = shift; |