Commit 3142bc1b authored by Natanael Copa's avatar Natanael Copa

added ipsec-tools

git-svn-id: svn://svn.alpinelinux.org/acf/ipsec-tools/trunk@845 ab2d0c66-481e-0410-8bed-d214d4d58bed
parents
APP_NAME=ipsec-tools
PACKAGE=acf-$(APP_NAME)
VERSION=0.1
APP_DIST=\
ipsec-tools-controller.lua \
ipsec-tools-model.lua \
ipsec-tools-status-html.lsp \
ipsec-tools.menu \
EXTRA_DIST=README Makefile config.mk
DISTFILES=$(APP_DIST) $(EXTRA_DIST)
TAR=tar
P=$(PACKAGE)-$(VERSION)
tarball=$(P).tar.bz2
install_dir=$(DESTDIR)/$(appdir)/$(APP_NAME)
all:
clean:
rm -rf $(tarball) $(P)
dist: $(tarball)
install:
mkdir -p "$(install_dir)"
cp -a $(APP_DIST) "$(install_dir)"
$(tarball): $(DISTFILES)
rm -rf $(P)
mkdir -p $(P)
cp $(DISTFILES) $(P)
$(TAR) -jcf $@ $(P)
rm -rf $(P)
# target that creates a tar package, unpacks is and install from package
dist-install: $(tarball)
$(TAR) -jxf $(tarball)
$(MAKE) -C $(P) install DESTDIR=$(DESTDIR)
rm -rf $(P)
include config.mk
.PHONY: all clean dist install dist-install
ACF for ipsec-tools
prefix=/usr
datadir=${prefix}/share
sysconfdir=${prefix}/etc
localstatedir=${prefix}/var
acfdir=${datadir}/acf
wwwdir=${acfdir}/www
cgibindir=${acfdir}/cgi-bin
appdir=${acfdir}/app
acflibdir=${acfdir}/lib
sessionsdir=${localstatedir}/lib/acf/sessions
module(..., package.seeall)
-- This is the object/text used when we want to add a new record
require("format")
local list_redir = function (self)
self.conf.action = "status"
self.conf.type = "redir"
error (self.conf)
end
mvc = {}
mvc.on_load = function(self, parent)
if (self.worker[self.conf.action] == nil ) or ( self.conf.action == "init" ) then
self.worker[self.conf.action] = list_redir(self)
end
end
-- ################################################################################
-- PUBLIC FUNCTIONS
function status(self)
return { status=self.model.getstatus() }
end
module(..., package.seeall)
require("fs")
require("procps")
require("getopts")
require("format")
require("daemoncontrol")
require("validator")
local configfile = "/etc/racoon/racoon.conf"
local processname = "racoon"
local pkgname = "ipsec-tools"
local baseurl = "/etc/racoon/"
local function get_version()
local cmd_output_result, cmd_output_error
local cmd = "/sbin/apk_version -vs " .. pkgname .." 2>/dev/null"
local f = io.popen( cmd )
local cmdresult = f:read("*l")
if (cmdresult) and (#cmdresult > 0) then
cmd_output_result = string.match(cmdresult,"^%S*") or "Unknown"
else
cmd_output_error = "Program not installed"
end
f:close()
return cmd_output_result,cmd_output_error
end
function process_status_text(procname)
local t = procps.pidof(procname)
if #t > 0 then
return "Enabled"
else
return "Disabled"
end
end
-- ################################################################################
-- PUBLIC FUNCTIONS
function getstatus()
local status = {}
status.version = cfe({ name = "version",
label="Program version",
value=get_version(),
})
status.status = cfe({ name="status",
label="Program status",
value=process_status_text(processname),
})
return status
end
<? local form = ... ?>
<?
--[[ DEBUG INFORMATION
io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
io.write(html.cfe_unpack(form))
io.write("</span>")
--]]
?>
<?
function informationform(myform,tags)
for k,v in pairs(tags) do
if (myform[v]) then
local val = myform[v]
io.write("\t<DT")
if (#val.errtxt > 0) then io.write(" class='error'") end
io.write(">" .. val.label .. "</DT>\n")
io.write("\t\t<DD>" .. val.value .. "\n")
if (val.descr) and (#val.descr > 0) then io.write("\t\t<P CLASS='descr'>" .. string.gsub(val.descr, "\n", "<BR>") .. "</P>\n") end
if (#val.errtxt > 0) then io.write("\t\t<P CLASS='error'>" .. string.gsub(val.errtxt, "\n", "<BR>") .. "</P>\n") end
io.write("\t\t</DD>\n")
end
end
end
?>
<H1>SYSTEM INFO</H1>
<DL>
<?
local myform = form.status
local tags = { "status", "version", }
informationform(myform,tags)
?>
</DL>
<? ---[[ ?>
<H2>PROGRAM SPECIFIC OPTIONS/INFORMATION</H2>
<DL>
<?
--local myform = form.status
--local tags = { "stats", }
--informationform(myform,tags)
?>
<? --]] ?>
<?
--[[ DEBUG INFORMATION
io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
io.write(html.cfe_unpack(form))
io.write("</span>")
--]]
?>
#CAT GROUP/DESC TAB ACTION
Networking 45IPsec Status status
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment