l.inputstyle = "apply"
c = f:option(TextValue, "_custom")
- c.rmempty = false
+ c.forcewrite = true
+ c.rmempty = true
c.cols = 70
c.rows = 30
return nixio.fs.readfile("/etc/sysupgrade.conf")
end
- c.write = function(self, section, value)
- value = value:gsub("\r\n?", "\n")
- return nixio.fs.writefile("/etc/sysupgrade.conf", value)
+ m.handle = function(self, state, data)
+ if state == FORM_VALID then
+ if data._custom then
+ nixio.fs.writefile("/etc/sysupgrade.conf", data._custom:gsub("\r\n", "\n"))
+ else
+ nixio.fs.writefile("/etc/sysupgrade.conf", "")
+ end
+ end
+ return true
end
else
m.submit = false
translate("This is the content of /etc/rc.local. Insert your own commands here (in front of 'exit 0') to execute them at the end of the boot process."))
t = f:field(TextValue, "rcs")
+t.forcewrite = true
t.rmempty = true
t.rows = 20
if state == FORM_VALID then
if data.rcs then
fs.writefile("/etc/rc.local", data.rcs:gsub("\r\n", "\n"))
+ else
+ fs.writefile("/etc/rc.local", "")
end
end
return true