summaryrefslogtreecommitdiffstats
path: root/rc-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'rc-model.lua')
-rw-r--r--rc-model.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/rc-model.lua b/rc-model.lua
index d799cca..3df75a2 100644
--- a/rc-model.lua
+++ b/rc-model.lua
@@ -1,4 +1,4 @@
-module (..., package.seeall)
+local mymodule = {}
posix = require("posix")
modelfunctions = require("modelfunctions")
@@ -16,7 +16,7 @@ table.sort(runlevels)
local config
-status = function()
+mymodule.status = function()
if not config then
config = processinfo.read_initrunlevels()
for i,c in pairs(config) do
@@ -30,7 +30,7 @@ status = function()
return cfe({ type="structure", value=config, label="Init Runlevels" })
end
-read_runlevels = function(self, clientdata)
+mymodule.read_runlevels = function(self, clientdata)
local servicename = clientdata.servicename
local value = {}
value.servicename = cfe({ value=servicename or "", label="Service Name", seq=1 })
@@ -49,7 +49,7 @@ read_runlevels = function(self, clientdata)
return cfe({ type="group", value=value, label="Service Runlevels"})
end
-update_runlevels = function(self, service)
+mymodule.update_runlevels = function(self, service)
local success = modelfunctions.validatemulti(service.value.runlevels)
service.value.servicename.errtxt = "Invalid service"
for name in posix.files("/etc/init.d") do
@@ -85,11 +85,12 @@ update_runlevels = function(self, service)
return service
end
-function get_startstop(self, clientdata)
+function mymodule.get_startstop(self, clientdata)
return modelfunctions.get_startstop(clientdata.servicename)
end
-function startstop_service(self, startstop)
+function mymodule.startstop_service(self, startstop)
return modelfunctions.startstop_service(startstop, clientdata.action)
end
+return mymodule