diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-03-28 11:44:58 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-03-28 11:44:58 +0000 |
commit | 70b28419e50d7947ab1220517e5c3495aca73a93 (patch) | |
tree | da6e5122d68befca005f27b4dff04af7911bf870 /interfaces-model.lua | |
parent | c2af45dbef7d1cd8036bb6f94e03649bd2e9b786 (diff) | |
download | acf-alpine-baselayout-70b28419e50d7947ab1220517e5c3495aca73a93.tar.bz2 acf-alpine-baselayout-70b28419e50d7947ab1220517e5c3495aca73a93.tar.xz |
Cleaned up 'read' tab so it only allows read (no edit actions).
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@856 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'interfaces-model.lua')
-rw-r--r-- | interfaces-model.lua | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/interfaces-model.lua b/interfaces-model.lua index b0d3b05..efc5ed9 100644 --- a/interfaces-model.lua +++ b/interfaces-model.lua @@ -15,13 +15,26 @@ local iface = { tags = { "name", "comment", "method", "address", "netmask", "gateway", "hostname", "provider", "pre-up", "up", "down", "post-down" }, methods = { "dhcp", "static", "ppp", "loopback", "manual" }, + label = { ['name']="Interface names" , + ['comment']="Comments", + ['method']="Method", + ['address']="Address", + ['netmask']="Netmask", + ['gateway']="Gateway", + ['hostname']="Hostname", + ['provider']="Provider", + ['pre-up']="'pre-up' actions", + ['up']="'up' actions", + ['down']="'down' actions", + ['post-down']="'post-down' actions", + }, -- lowlevel functions will insert file and array here } -- Lowlevel functions - they do things directly to iface. +local filename = "/etc/network/interfaces" iface.read_file = function () - local filename = "/etc/network/interfaces" iface.file = cfe { name=filename, filename=filename } local file = io.open(filename) local rc = false @@ -49,14 +62,14 @@ iface.write_file = function () function iface.iface_type ( ) local f = {} for k,v in pairs(iface.tags) do - f[v] = cfe { name = v } + f[v] = cfe { name = v, label = (iface.label[v] or "") } end for k,v in pairs ({"comment", "pre-up", "up", "down", "post-down"}) do f[v].type ="longtext" end - + f.method.type = "select" f.method.option = iface.methods return (f) @@ -141,6 +154,7 @@ function iface.unpack_interfaces () local param, val = string.match(line, "(%S+)%s*(.*)$") if (param) then + if not (array[count][param]) then array[count][param] = {} end array[count][param].value = iface.append (array[count][param].value, val) end @@ -281,4 +295,12 @@ end delete_iface_by_name = iface.delete - +get_status = function () + local status = {} + status.interfacesfile = cfe({ + name="interfacesfile", + label="Interfaces file", + value=filename, + }) + return status +end |