diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | interfaces-model.lua | 16 |
2 files changed, 17 insertions, 1 deletions
@@ -1,6 +1,6 @@ APP_NAME=alpine-baselayout PACKAGE=acf-$(APP_NAME) -VERSION=0.5.6 +VERSION=0.5.7 APP_DIST=\ alpine-baselayout.roles \ diff --git a/interfaces-model.lua b/interfaces-model.lua index ea18e56..66132b3 100644 --- a/interfaces-model.lua +++ b/interfaces-model.lua @@ -407,6 +407,22 @@ write_file = function (newfile) return modelfunctions.setfiledetails(newfile, {filename}) end +get_interfaces = function() + local cmd = path.."ip addr" + local f = io.popen(format.escapespecialcharacters(cmd)) + local ipaddr = f:read("*a") + f:close() + -- now parse the result to find the interfaces + local retval = {} + for line in string.gmatch(ipaddr, "[^\n]*\n?") do + if string.find(line, "^%d+:%s+") then + local interface=string.match(line, "^%d+:%s+([^:@]+)") + retval[#retval+1] = interface + end + end + return cfe({ type="list", value=retval, label="IP Interfaces" }) +end + get_addresses = function() local cmd = path.."ip addr" local f = io.popen(format.escapespecialcharacters(cmd)) |