Update my email addresses in the license headers
[project/luci.git] / modules / luci-mod-admin-full / luasrc / model / cbi / admin_system / startup.lua
index fc35f77..9e19ac5 100644 (file)
@@ -1,28 +1,16 @@
---[[
-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 }] = {
@@ -62,10 +50,10 @@ end
 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
 
@@ -73,7 +61,7 @@ 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"))
@@ -94,13 +82,13 @@ t.rmempty = true
 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