summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2012-12-06 14:08:24 +0000
committerTed Trask <ttrask01@yahoo.com>2012-12-06 14:08:24 +0000
commit0cf31f98acd6d84c17fe47569a1022f28d09a7a9 (patch)
treec00f09e1dcfb27e865ba9fead132193b85e479c9
parent50f946418c3fbd5fd32f5218b177920a065a53ac (diff)
downloadacf-alpine-baselayout-0cf31f98acd6d84c17fe47569a1022f28d09a7a9.tar.bz2
acf-alpine-baselayout-0cf31f98acd6d84c17fe47569a1022f28d09a7a9.tar.xz
Interfaces: Added support for unknown options in a separate cfe
The previous implementation would display them as separate options with errors, and silently drop when writing
-rw-r--r--interfaces-definitions.lua1
-rw-r--r--interfaces-model.lua17
2 files changed, 11 insertions, 7 deletions
diff --git a/interfaces-definitions.lua b/interfaces-definitions.lua
index 9b6704a..eaa979f 100644
--- a/interfaces-definitions.lua
+++ b/interfaces-definitions.lua
@@ -10,6 +10,7 @@ module (..., package.seeall)
up = {type="longtext", label="'up' actions", seq=101},
down = {type="longtext", label="'down' actions", seq=102},
['post-down'] = {type="longtext", label="'post-down' actions", seq=103},
+ other = {type="longtext", label="Other options (unsupported)", seq=104},
}
family_methods = {
inet = {"loopback", "static", "manual", "dhcp", "bootp", "ppp", "wvdial"},
diff --git a/interfaces-model.lua b/interfaces-model.lua
index 1e86b8c..c955937 100644
--- a/interfaces-model.lua
+++ b/interfaces-model.lua
@@ -78,7 +78,7 @@ local expandentry = function (self, prefix)
local strings = {}
for line in string.gmatch(self, "(.-)\n") do
if #line > 0 then
- strings[#strings+1] = prefix .. " " .. line
+ strings[#strings+1] = prefix .. line
end
end
return table.concat(strings, "\n")
@@ -122,10 +122,10 @@ local unpack_interfaces = function ()
comment = ""
end
if not (interface[param]) then
- interface[param] = cfe({label=param, errtxt = "Unknown parameter"})
+ interface.other.value = appendentry(interface.other.value, param.." "..val)
+ else
+ interface[param].value = appendentry(interface[param].value, val)
end
- interface[param].value =
- appendentry(interface[param].value, val)
end
end
end
@@ -146,14 +146,14 @@ local commit_interfaces = function()
local required = {}
for name,value in pairs(iface.required) do
-- Check for the ones handled by other means
- if name~="comment" and name~="name" and name~="family" and name~="method" and name~="auto" then
+ if name~="comment" and name~="name" and name~="family" and name~="method" and name~="auto" and name~="other" then
required[name] = true
end
end
for n,int in ipairs(array) do
local me = int.value
if me.comment.value ~= "" then
- strings[#strings+1] = expandentry(me.comment.value, "#")
+ strings[#strings+1] = expandentry(me.comment.value, "# ")
end
if me.auto.value then
strings[#strings+1] = "auto " .. me.name.value
@@ -163,9 +163,12 @@ local commit_interfaces = function()
local optional = get_options(me.family.value, me.method.value)
for name,entry in pairs(me) do
if (required[name] or optional[name]) and entry.value ~= "" then
- strings[#strings+1] = expandentry(entry.value, "\t"..name)
+ strings[#strings+1] = expandentry(entry.value, "\t"..name.." ")
end
end
+ if me.other.value ~= "" then
+ strings[#strings+1] = expandentry(me.other.value, "\t")
+ end
strings[#strings+1] = ""
end