From 1a930fe2020e3d309f4716c4814d1dd8a92ee03c Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 20 Jan 2009 18:54:40 +0000 Subject: Removed obsolete files from core. git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1686 ab2d0c66-481e-0410-8bed-d214d4d58bed --- ChangeLog | 29 ------------ TODO | 8 ---- app/Makefile | 2 - app/cfgfile-model.lua | 103 ------------------------------------------ app/service-model.lua | 122 -------------------------------------------------- 5 files changed, 264 deletions(-) delete mode 100644 ChangeLog delete mode 100644 TODO delete mode 100644 app/cfgfile-model.lua delete mode 100644 app/service-model.lua diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index 87b06b7..0000000 --- a/ChangeLog +++ /dev/null @@ -1,29 +0,0 @@ -2006-09-25 - 0.1.3 - Renamed to acf (Alpine Configuration Framework), made new config directories - wc table renamed to cf (wc means watercloset, and although this code stinks, - it doesn't stink THAT bad) -2006-09-20 - 0.1.2 - The lua portions are integrated now. Other developers should be able to build - code from c/hostname.lua and m/hostname.lua -2006-09-14 - 0.1.1 - Clearsilver removed, haserll is used - Webconf on LUA! -2006-09-03 - 0.1.0 - Another attempt at simplifying... this one uses clearsilver. -2006-08-22 - 0.0.7 - Moved the preabmle/postamble stuff into an array that's executed, so that each - view doesn't have to do it. (DRY) - - Changed css to do dt/dd instead of label; This makes error messages for fields easier to - tag. - 0.0.5 - Added DESTDIR to the APPROOT root (N.Copa requested) -2006-08-21 - 0.0.3 version - create APPROOT and WEBROOT targets; moved www/app to www/cgi-bin (works with bb httpd) -2006-08-15 - 0.0.1 version released - webconf now has a makefile diff --git a/TODO b/TODO deleted file mode 100644 index 0162583..0000000 --- a/TODO +++ /dev/null @@ -1,8 +0,0 @@ -Todo items - -* Menu controller -* Role Based Access Control -* Clean up the code - is m/c/v as simple as it can be? -* Work on a non-trivial webconf (openssl CA or interfaces file) to see how hard this is going to be -* Work at a slightly faster than glacial pace -* fix Makefiles so ncopa can create packages again diff --git a/app/Makefile b/app/Makefile index 49f3ec0..4616aac 100644 --- a/app/Makefile +++ b/app/Makefile @@ -19,8 +19,6 @@ APP_DIST= \ acf-util/password-status-html.lsp \ acf-util/password.menu \ acf_www-controller.lua\ - cfgfile-model.lua\ - service-model.lua\ menuhints.menu\ template-html.lsp\ template-stream.lsp\ diff --git a/app/cfgfile-model.lua b/app/cfgfile-model.lua deleted file mode 100644 index 281ee2c..0000000 --- a/app/cfgfile-model.lua +++ /dev/null @@ -1,103 +0,0 @@ -module (..., package.seeall) - -require "fs" - - ---TODO this should be somehow figureoutable from acf info -local cfgdir = "/usr/share/acf/app/cfgfile" - ---TODO, in fs actually, find should use coroutines instead of reading ---all in table - -local files = nil - ---TODO might on demand load only part of config that is needed for this app ---but then TODO need to make persistent item ids -local function loadCfg() - if files ~= nil then return end - files = {} - for fname in fs.find(".*%.cfg", cfgdir) do - f = io.open(fname, 'r') - if f then - s = f:read("*a") - f:close() - if s then - c = loadstring("return ({\n" .. s .. "\n})") - if c then - for i,v in ipairs(c()) do - files[#files + 1] = v - end - end - end - end - end -end - -local function getLbuStatus() - local ret = {} - local f = io.popen("/sbin/lbu status -v", "r") - if not f then return ret end - for line in f:lines() do - local status, name = string.match(line, "^(%S+)%s+(.+)$") - if status and name then - ret[string.gsub('/' .. name, "/+", "/")] = status - end - end - f:close() - return ret -end - ---TODO this 'filter' breaks model isolation by requring caller to know ---keys in files[] items. But this way the breakage is at least very obvious, ---unlike passing these values as an argument to this function. -function list(self, filter) - loadCfg() - local ret = {} - local lbuStatus = getLbuStatus() - for k,v in pairs(files) do - if not filter or filter(v) then - ret[#ret+1] = { - id=k, - app=v.app, - section=v.section, - name=v.name, - descr=v.descr, - status=lbuStatus[v.filename] - } - end - end - return ret -end - -function get(self, id) - loadCfg() - local item = files[id] - if not item then return false end - local f = io.open(item.filename, "r") - local n = "" - if f then - n = f:read("*a") - f:close() - end - return true, { - id=cfe{ value=tostring(id) }, - content=cfe{ value=n, type="longtext" }, - name=cfe{ value=item.name } - } -end - - -function set(self, id, data) - loadCfg() - local item = files[id] - if not item then return false, date end - local f = io.open(item.filename, "w") - if f then - f:write(data.content.value) - f:close() - end - -- TODO update processing - return get(self, id) -end - - diff --git a/app/service-model.lua b/app/service-model.lua deleted file mode 100644 index d6fb192..0000000 --- a/app/service-model.lua +++ /dev/null @@ -1,122 +0,0 @@ -module (..., package.seeall) - -require "fs" - - ---TODO this should be somehow figureoutable from acf info, help! -local cfgdir = "/usr/share/acf/app/service" - ---TODO, in fs actually, find should use coroutines instead of reading ---all in table - -local spec = nil - ---TODO might on demand load only part of config that is needed for this app ---but then TODO need to make persistent item ids -local function loadCfg() - if spec ~= nil then return end - spec = {} - for fname in fs.find(".*%.srv", cfgdir) do - f = io.open(fname, 'r') - if f then - s = f:read("*a") - f:close() - if s then - c = loadstring("return ({\n" .. s .. "\n})") - if c then - for i,v in ipairs(c()) do - spec[#spec + 1] = v - end - end - end - end - end -end - - - -local function getAnyPid(pname) - for e in lfs.dir("/proc") do - if e == string.match(e, "^%d*$") then - for line in io.lines("/proc/" .. e .. "/status") do - tag, val = string.match(line, "^([^:]*):%s*(%S*)$"); - if tag == "Name" then - if val == pname then return e end - break - end - end - end - end -end - -local mech = {} - -function mech.initd(service, action) - if not service.initd then return false, "no initd" end - local f = io.popen("/etc/init.d/" .. service.initd .. ' ' .. action, "r") - if not f then return false, "cannot run initd" end - local ret = f:read("*a") - f:close() - return true, ret -end - -function mech.pidfile(svc, action) - if not service.pidfile then return false end - if action ~= "status" then return false end - f = io.open(svc.pidfile) - if not f then return true, false end - pid = tonumber(f:read("*a")) - f:close() - if not pid then return true, false end - f = io.open("/proc/" .. tostring(pid) .. "/status") - if not f then return true, false end - if svc.pidcmdname then - for line in f:lines() do - k, v = string.match(line, '^([^:]*):%s*(.*)$') - if k == "Name" then - return true, (v == svc.pidcmdname) - end - end - end - f:close() - return true, true -end - -local function serviceAction(service, action) - if not service[action] then return false, "no such action " .. action end - return mech[service[action]](service, action) -end - -local function getServiceActions(service) - local ret = {} - if service.start then ret[#ret + 1] = "start" end - if service.stop then ret[#ret + 1] = "stop" end - if service.restart then ret[#ret + 1] = "restart" end - if service.reload then ret[#ret + 1] = "reload" end - return ret -end - -function list(self, app) - loadCfg() - ret = {} - for k,v in pairs(spec) do - if v.app == app then - ret[#ret+1] = { - id=k, - name=v.name, - descr=v.descr or "", - status=serviceAction(v, "status"), - actions=getServiceActions(v) - } - end - end - return ret -end - -function update(self, id, action) - loadCfg() - svc = spec[id] - if not svc then return false, "no service" end - return serviceAction(svc, action) -end - -- cgit v1.2.3