local sys = require "luci.sys"
local inits = { }
+local handled = false
for _, name in ipairs(sys.init.names()) do
local index = sys.init.index(name)
e.write = function(self, section)
if inits[section].enabled then
+ handled = true
inits[section].enabled = false
return sys.init.disable(inits[section].name)
else
+ handled = true
inits[section].enabled = true
return sys.init.enable(inits[section].name)
end
start = s:option(Button, "start", translate("Start"))
start.inputstyle = "apply"
start.write = function(self, section)
+ handled = true
sys.call("/etc/init.d/%s %s >/dev/null" %{ inits[section].name, self.option })
end
end
function f.handle(self, state, data)
- if state == FORM_VALID then
+ if not handled and state == FORM_VALID then
if data.rcs then
fs.writefile("/etc/rc.local", data.rcs:gsub("\r\n", "\n"))
else