summaryrefslogtreecommitdiffstats
path: root/squid-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-08-12 14:06:46 +0000
committerTed Trask <ttrask01@yahoo.com>2008-08-12 14:06:46 +0000
commit9c32f7047c8d3b3f19f451149b291ee74ef64062 (patch)
tree47d2fc85994bf4b920b09ad456c52c3937b197b7 /squid-model.lua
parentc9683570fd9a648a80713b4fef357f2cb7d5021b (diff)
downloadacf-squid-9c32f7047c8d3b3f19f451149b291ee74ef64062.tar.bz2
acf-squid-9c32f7047c8d3b3f19f451149b291ee74ef64062.tar.xz
Modified squid to use new status, startstop, and expert (replaced advanced) actions.
git-svn-id: svn://svn.alpinelinux.org/acf/squid/trunk@1379 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'squid-model.lua')
-rw-r--r--squid-model.lua81
1 files changed, 10 insertions, 71 deletions
diff --git a/squid-model.lua b/squid-model.lua
index 8e20e34..101a279 100644
--- a/squid-model.lua
+++ b/squid-model.lua
@@ -3,10 +3,8 @@
module (..., package.seeall)
-- Load libraries
+require("modelfunctions")
require("format")
-require("processinfo")
-require("procps")
-require("daemoncontrol")
-- Set variables
local squidconf = "/etc/squid/squid.conf"
@@ -56,39 +54,12 @@ tokenizer.next = function( token )
end
---
-get_status = function()
- local t = procps.pidof(processname)
- local stats
- if (t) and (#t > 0) then
- stats = "Enabled"
- else
- stats = "Disabled"
- end
- local retval = cfe({ name="status",
- label="Program status",
- value=stats,
- })
- return retval
-end
-
-get_squid_version = function()
- local value, errtxt = processinfo.package_version(packagename)
- local retval = cfe({ name = "version",
- label="Program version",
- value=value,
- errtxt=errtxt,
- })
- return retval
+getstatus = function()
+ return modelfunctions.getstatus(processname, packagename, "Squid status")
end
-get_autostart = function()
- local autostart_sequense, autostart_errtxt = processinfo.process_botsequence(processname)
- local retval = cfe({ name="autostart",
- label="Autostart sequence",
- value=autostart_sequense,
- errtxt=autostart_errtxt,
- })
- return retval
+startstop_service = function(action)
+ return modelfunctions.startstop_service(processname, action)
end
get_winbind_version = function()
@@ -122,14 +93,6 @@ get_status_winbindd = function()
return retval
end
-service_control = function( cmd )
- local action = {value=cmd}
- local cmdresult,cmdmessage,cmderror,cmdaction = daemoncontrol.daemoncontrol(processname, cmd)
- action.descr=cmdmessage
- action.errtxt=cmderror
- return cmdresult,action
-end
-
service_control_winbindd = function( control )
local retval = ""
@@ -172,22 +135,8 @@ get_winbindd_config = function()
return config
end
-get_adv_config = function()
-
- local retval = ""
-
- local ptr = io.open( squidconf, "r" )
- if ptr ~= nil then
- local retcfg = ptr:read( "*a" )
- ptr:close()
- if retcfg == nil then
- retval = "\n\n Error: Failed to read " .. squidconf .. "!\n\n"
- else
- retval = retcfg
- end
- end
-
- return retval
+get_configfile = function()
+ return modelfunctions.getfiledetails(squidconf)
end
get_digest_userlist = function()
@@ -255,19 +204,9 @@ get_file_contents = function( name )
return retval
end
-update_adv_config = function( config )
-
- local retval = "Successfully updated " .. squidconf .. "!"
-
- local ptr = io.open( squidconf, "wb+" )
- if ptr ~= nil then
- ptr:write( format.dostounix( config ) )
- ptr:close()
- else
- retval = "update_config(): Error, failed to open " .. squidconf .. "!\n"
- end
-
- return retval
+update_configfile = function( filedetails )
+ filedetails.value.filename.value = squidconf
+ return modelfunctions.setfiledetails(filedetails)
end
update_digest_userlist = function( config )