summaryrefslogtreecommitdiffstats
path: root/rc-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'rc-model.lua')
-rw-r--r--rc-model.lua27
1 files changed, 10 insertions, 17 deletions
diff --git a/rc-model.lua b/rc-model.lua
index 215d02d..1046a96 100644
--- a/rc-model.lua
+++ b/rc-model.lua
@@ -2,7 +2,7 @@ module (..., package.seeall)
require("processinfo")
require("modelfunctions")
-require("fs")
+fs = require("acf.fs")
require("posix")
local configpath = "/etc/runlevels/"
@@ -30,7 +30,8 @@ status = function()
return cfe({ type="structure", value=config, label="Init Runlevels" })
end
-read_runlevels = function(servicename)
+read_runlevels = function(clientdata)
+ local servicename = clientdata.servicename
local value = {}
value.servicename = cfe({ value=servicename or "", label="Service Name" })
value.runlevels = cfe({ type="multi", value={}, label="Service Runlevels", option=runlevels })
@@ -83,19 +84,11 @@ update_runlevels = function(service)
return service
end
-handle_startstop = function(servicename, action)
- local result = ""
- local errtxt
- local actions,errtxt = processinfo.daemon_actions(servicename)
- if actions then
- errtxt = nil
- local reverseactions = {}
- for i,act in ipairs(actions) do reverseactions[string.lower(act)] = i end
- if reverseactions[string.lower(action)] then
- result, errtxt = processinfo.daemoncontrol(servicename, action)
- else
- errtxt = "Unknown command!"
- end
- end
- return cfe({ label="Start/Stop result", value=result, errtxt=errtxt })
+function get_startstop(clientdata)
+ return modelfunctions.get_startstop(clientdata.servicename)
end
+
+function startstop_service(startstop)
+ return modelfunctions.startstop_service(startstop, clientdata.action)
+end
+