---[[
-LuCI - Lua Configuration Interface
+-- Copyright 2008 Steven Barth <steven@midlink.org>
+-- Copyright 2010-2012 Jo-Philipp Wich <jow@openwrt.org>
+-- Copyright 2010 Manuel Munz <freifunk at somakoma dot de>
+-- Licensed to the public under the Apache License 2.0.
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2010-2012 Jo-Philipp Wich <xm@subsignal.org>
-Copyright 2010 Manuel Munz <freifunk at somakoma dot de>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-]]--
-
-require "luci.fs"
-require "luci.sys"
-require "luci.util"
+local fs = require "nixio.fs"
+local sys = require "luci.sys"
local inits = { }
-for _, name in ipairs(luci.sys.init.names()) do
- local index = luci.sys.init.index(name)
- local enabled = luci.sys.init.enabled(name)
+for _, name in ipairs(sys.init.names()) do
+ local index = sys.init.index(name)
+ local enabled = sys.init.enabled(name)
if index < 255 then
inits["%02i.%s" % { index, name }] = {
e.write = function(self, section)
if inits[section].enabled then
inits[section].enabled = false
- return luci.sys.init.disable(inits[section].name)
+ return sys.init.disable(inits[section].name)
else
inits[section].enabled = true
- return luci.sys.init.enable(inits[section].name)
+ return sys.init.enable(inits[section].name)
end
end
start = s:option(Button, "start", translate("Start"))
start.inputstyle = "apply"
start.write = function(self, section)
- luci.sys.call("/etc/init.d/%s %s >/dev/null" %{ inits[section].name, self.option })
+ sys.call("/etc/init.d/%s %s >/dev/null" %{ inits[section].name, self.option })
end
restart = s:option(Button, "restart", translate("Restart"))
t.rows = 20
function t.cfgvalue()
- return luci.fs.readfile("/etc/rc.local") or ""
+ return fs.readfile("/etc/rc.local") or ""
end
function f.handle(self, state, data)
if state == FORM_VALID then
if data.rcs then
- luci.fs.writefile("/etc/rc.local", data.rcs:gsub("\r\n", "\n"))
+ fs.writefile("/etc/rc.local", data.rcs:gsub("\r\n", "\n"))
end
end
return true