From 555fd1d7632bd06116a72aaa764e73073dcd3721 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 25 Feb 2009 18:21:27 +0000 Subject: Added pingu ACF. git-svn-id: svn://svn.alpinelinux.org/acf/pingu/trunk@1706 ab2d0c66-481e-0410-8bed-d214d4d58bed --- Makefile | 44 ++++++++++++++++++++++++++++++++++++++++++++ README | 1 + config.mk | 10 ++++++++++ pingu-controller.lua | 18 ++++++++++++++++++ pingu-expert-html.lsp | 1 + pingu-model.lua | 35 +++++++++++++++++++++++++++++++++++ pingu-startstop-html.lsp | 1 + pingu-status-html.lsp | 1 + pingu.menu | 3 +++ pingu.roles | 3 +++ 10 files changed, 117 insertions(+) create mode 100644 Makefile create mode 100644 README create mode 100644 config.mk create mode 100644 pingu-controller.lua create mode 120000 pingu-expert-html.lsp create mode 100644 pingu-model.lua create mode 120000 pingu-startstop-html.lsp create mode 120000 pingu-status-html.lsp create mode 100644 pingu.menu create mode 100644 pingu.roles diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..458b71a --- /dev/null +++ b/Makefile @@ -0,0 +1,44 @@ +APP_NAME=pingu +PACKAGE=acf-$(APP_NAME) +VERSION=0.1.0 + +APP_DIST=\ + pingu* \ + + +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 -a $(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 diff --git a/README b/README new file mode 100644 index 0000000..db75114 --- /dev/null +++ b/README @@ -0,0 +1 @@ +ACF for pingu diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..45f4d21 --- /dev/null +++ b/config.mk @@ -0,0 +1,10 @@ +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 diff --git a/pingu-controller.lua b/pingu-controller.lua new file mode 100644 index 0000000..d4c7437 --- /dev/null +++ b/pingu-controller.lua @@ -0,0 +1,18 @@ +module(..., package.seeall) + +-- Load libraries +require("controllerfunctions") + +default_action = "status" + +function status(self) + return self.model.getstatus() +end + +function startstop(self) + return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.model.getstatus, self.clientdata) +end + +function expert(self) + return controllerfunctions.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit Pingu Config", "Configuration Set") +end diff --git a/pingu-expert-html.lsp b/pingu-expert-html.lsp new file mode 120000 index 0000000..207f324 --- /dev/null +++ b/pingu-expert-html.lsp @@ -0,0 +1 @@ +../expert-html.lsp \ No newline at end of file diff --git a/pingu-model.lua b/pingu-model.lua new file mode 100644 index 0000000..75f26e2 --- /dev/null +++ b/pingu-model.lua @@ -0,0 +1,35 @@ +module(..., package.seeall) + +-- Load libraries +require("modelfunctions") +require("fs") +require("format") + +-- Set variables +local configfile = "/etc/pingu.conf" +local processname = "pingu" +local packagename = "pingu" + +local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin " + +-- ################################################################################ +-- LOCAL FUNCTIONS + +-- ################################################################################ +-- PUBLIC FUNCTIONS + +function startstop_service(action) + return modelfunctions.startstop_service(processname, action) +end + +function getstatus() + return modelfunctions.getstatus(processname, packagename, "Pingu Status") +end + +function get_filedetails() + return modelfunctions.getfiledetails(configfile) +end + +function update_filedetails(filedetails) + return modelfunctions.setfiledetails(filedetails, {configfile}) +end diff --git a/pingu-startstop-html.lsp b/pingu-startstop-html.lsp new file mode 120000 index 0000000..0ea2627 --- /dev/null +++ b/pingu-startstop-html.lsp @@ -0,0 +1 @@ +../startstop-html.lsp \ No newline at end of file diff --git a/pingu-status-html.lsp b/pingu-status-html.lsp new file mode 120000 index 0000000..b2f8480 --- /dev/null +++ b/pingu-status-html.lsp @@ -0,0 +1 @@ +../status-html.lsp \ No newline at end of file diff --git a/pingu.menu b/pingu.menu new file mode 100644 index 0000000..7ea08f2 --- /dev/null +++ b/pingu.menu @@ -0,0 +1,3 @@ +#CAT GROUP/DESC TAB ACTION +Networking 95Pingu Status status +Networking 95Pingu Expert expert diff --git a/pingu.roles b/pingu.roles new file mode 100644 index 0000000..cd613b9 --- /dev/null +++ b/pingu.roles @@ -0,0 +1,3 @@ +USER=pingu:status,pingu:startstop +EXPERT=pingu:expert +ADMIN=pingu:status,pingu:startstop,pingu:expert -- cgit v1.2.3