mirror of https://github.com/lcpz/lain.git
net: specify ip path; #102
This commit is contained in:
parent
2697333bdc
commit
7e6f1336f2
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
local debug = require("debug")
|
local debug = require("debug")
|
||||||
|
|
||||||
|
local assert = assert
|
||||||
local capi = { timer = (type(timer) == 'table' and timer or require ("gears.timer")) }
|
local capi = { timer = (type(timer) == 'table' and timer or require ("gears.timer")) }
|
||||||
local io = { open = io.open,
|
local io = { open = io.open,
|
||||||
lines = io.lines,
|
lines = io.lines,
|
||||||
|
|
|
@ -24,7 +24,7 @@ local function worker(args)
|
||||||
local net = { last_t = 0, last_r = 0, devices = {} }
|
local net = { last_t = 0, last_r = 0, devices = {} }
|
||||||
|
|
||||||
function net.get_first_device()
|
function net.get_first_device()
|
||||||
local ws = helpers.read_pipe("ip link show | cut -d' ' -f2,9")
|
local ws = helpers.read_pipe("/usr/sbin/ip link show | cut -d' ' -f2,9")
|
||||||
ws = ws:match("%w+: UP") or ws:match("ppp%w+: UNKNOWN")
|
ws = ws:match("%w+: UP") or ws:match("ppp%w+: UNKNOWN")
|
||||||
if ws then return { ws:match("(%w+):") }
|
if ws then return { ws:match("(%w+):") }
|
||||||
else return {} end
|
else return {} end
|
||||||
|
|
Loading…
Reference in New Issue