summaryrefslogtreecommitdiffstats
path: root/fetchcrl-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2009-03-17 20:39:56 +0000
committerTed Trask <ttrask01@yahoo.com>2009-03-17 20:39:56 +0000
commit74632a4008ec27db2244f3ddeadabba58cc25f4c (patch)
tree222b96ca71b89574357405fbf2b59baf262e688e /fetchcrl-model.lua
parent7c83dbe3df24b03a7e66640de2e9fc6ab0c762fd (diff)
downloadacf-fetch-crl-74632a4008ec27db2244f3ddeadabba58cc25f4c.tar.bz2
acf-fetch-crl-74632a4008ec27db2244f3ddeadabba58cc25f4c.tar.xz
Changed the way startstop works in core to add a list of allowed actions. Modified all ACFs that don't use the standard functions to work with new library method.
git-svn-id: svn://svn.alpinelinux.org/acf/fetch-crl/trunk@1730 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'fetchcrl-model.lua')
-rw-r--r--fetchcrl-model.lua36
1 files changed, 20 insertions, 16 deletions
diff --git a/fetchcrl-model.lua b/fetchcrl-model.lua
index 29617e4..a47543c 100644
--- a/fetchcrl-model.lua
+++ b/fetchcrl-model.lua
@@ -34,25 +34,29 @@ get_status = function()
end
function startstop_service(action)
- local cmdresult = cfe({ label="Start/Stop result" })
+ local result = {}
+ result.actions = cfe({ type="list", value={"download", "delete"}, label="Start/Stop actions" })
+ if action then
+ result.result = cfe({ label="Start/Stop result" })
- if (string.lower(action) == "download") then
- local file = io.popen(path .. "fetch-crl 2>&1")
- if file ~= nil then
- cmdresult.value = file:read( "*a" )
- file:close()
+ if (string.lower(action) == "download") then
+ local file = io.popen(path .. "fetch-crl 2>&1")
+ if file ~= nil then
+ result.result.value = file:read( "*a" )
+ file:close()
+ end
+ elseif (string.lower(action) == "delete") then
+ local config = format.parse_ini_file(fs.read_file(configfile) or "", "")
+ local dir = config.CRLDIR or outputdirectory
+ for file in fs.find(".*\.r0", dir) do
+ os.remove(file)
+ end
+ result.result.value = "Deleted CRL Files"
+ else
+ result.result.errtxt = "Unknown command!"
end
- elseif (string.lower(action) == "delete") then
- local config = format.parse_ini_file(fs.read_file(configfile) or "", "")
- local dir = config.CRLDIR or outputdirectory
- for file in fs.find(".*\.r0", dir) do
- os.remove(file)
- end
- cmdresult.value = "Deleted CRL Files"
- else
- cmdresult.errtxt = "Unknown command!"
end
- return cmdresult
+ return cfe({ type="group", value=result, label="Start/Stop result" })
end
get_configfile = function()