aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOthmar Truniger <github@truniger.ch>2015-02-21 18:11:57 +0100
committerOthmar Truniger <github@truniger.ch>2015-02-21 18:11:57 +0100
commitdda1acfeface9ae28d52dffc6d2e55a87c41e536 (patch)
treeb556081b95a09cb2b188343d25bd261aae9ad7b8
parent10313e98af8f881facc2a3fe83073d314e96ecbd (diff)
apcupsd: add cgi module
Signed-off-by: Othmar Truniger <github@truniger.ch>
-rw-r--r--net/apcupsd/Makefile36
-rw-r--r--net/apcupsd/files/apcupsd.css64
-rw-r--r--net/apcupsd/files/hosts.conf19
-rw-r--r--net/apcupsd/patches/010-fix-include-paths.patch13
4 files changed, 115 insertions, 17 deletions
diff --git a/net/apcupsd/Makefile b/net/apcupsd/Makefile
index 0d6e8c05f..65b318e44 100644
--- a/net/apcupsd/Makefile
+++ b/net/apcupsd/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=apcupsd
PKG_VERSION:=3.14.13
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_MAINTAINER:=Othmar Truniger <github@truniger.ch>
PKG_LICENSE:=GPL-2.0
@@ -19,21 +19,32 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/apcupsd
PKG_MD5SUM:=c291d9d3923b4d9c0e600b755ad4f489
+PKG_BUILD_DEPENDS:=libgd
+
include $(INCLUDE_DIR)/package.mk
define Package/apcupsd
- SECTION:=utils
- CATEGORY:=Utilities
- DEPENDS:=+libpthread +libusb-compat
+ SECTION:=net
+ CATEGORY:=Network
+ DEPENDS:=+libpthread
TITLE:=UPS control software
URL:=http://www.apcupsd.org/
endef
+define Package/apcupsd-cgi
+ SECTION:=net
+ CATEGORY:=Network
+ DEPENDS:=+libpthread +libgd
+ TITLE:=UPS control software CGI module
+ URL:=http://www.apcupsd.org/
+endef
+
define Build/Configure
$(CP) $(SCRIPT_DIR)/config.* $(PKG_BUILD_DIR)/autoconf/
$(call Build/Configure/Default, \
--with-distname=unknown \
--sysconfdir=/etc/apcupsd \
+ --enable-cgi \
--enable-usb \
--without-x \
)
@@ -65,6 +76,17 @@ define Package/apcupsd/install
$(INSTALL_BIN) ./files/apcupsd.init $(1)/etc/init.d/apcupsd
endef
+define Package/apcupsd-cgi/install
+ $(INSTALL_DIR) $(1)/www/cgi-bin/apcupsd
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/multimon.cgi $(1)/www/cgi-bin/apcupsd
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/upsfstats.cgi $(1)/www/cgi-bin/apcupsd
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/upsimage.cgi $(1)/www/cgi-bin/apcupsd
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/upsstats.cgi $(1)/www/cgi-bin/apcupsd
+ $(INSTALL_DIR) $(1)/etc/apcupsd
+ $(INSTALL_CONF) ./files/apcupsd.css $(1)/etc/apcupsd/
+ $(INSTALL_CONF) ./files/hosts.conf $(1)/etc/apcupsd/
+endef
+
define Package/apcupsd/conffiles
/etc/apcupsd/apcupsd.conf
/etc/apcupsd/apcupsd_mail.conf
@@ -75,4 +97,10 @@ define Package/apcupsd/conffiles
/etc/apcupsd/onbattery
endef
+define Package/apcupsd-cgi/conffiles
+/etc/apcupsd/apcupsd.css
+/etc/apcupsd/hosts.conf
+endef
+
$(eval $(call BuildPackage,apcupsd))
+$(eval $(call BuildPackage,apcupsd-cgi))
diff --git a/net/apcupsd/files/apcupsd.css b/net/apcupsd/files/apcupsd.css
new file mode 100644
index 000000000..e98c75e5c
--- /dev/null
+++ b/net/apcupsd/files/apcupsd.css
@@ -0,0 +1,64 @@
+body {
+ color: black;
+ background: white;
+}
+
+div.Center {
+ text-align: center;
+}
+
+img {
+ border-style: none;
+}
+
+pre {
+ text-align: left;
+}
+
+strong {
+ color: red;
+}
+
+table.Outer {
+ color: black;
+ background: #60a0a0;
+ empty-cells: show; border: solid #60a0a0
+}
+
+th.Outer {
+ color: black;
+ background: #60b0b0
+}
+
+.Title {
+ font-size: 18pt;
+}
+
+.SubTitle {
+ font-size: 12pt;
+}
+
+.Empty {
+ color: black;
+ background: aqua;
+}
+
+.Fault {
+ color: black;
+ background: red;
+}
+
+.Label {
+ color: black;
+ background: aqua;
+}
+
+.Normal {
+ color: black;
+ background: lime;
+}
+
+.Warning {
+ color: black;
+ background: yellow;
+}
diff --git a/net/apcupsd/files/hosts.conf b/net/apcupsd/files/hosts.conf
new file mode 100644
index 000000000..854e00819
--- /dev/null
+++ b/net/apcupsd/files/hosts.conf
@@ -0,0 +1,19 @@
+# Network UPS Tools - hosts.conf
+#
+# This file does double duty - it lists the systems that multimon will
+# monitor, and also specifies the systems that upsstats is allowed to
+# watch. It keeps people from feeding random addresses to upsstats,
+# among other things. upsimage also uses this file to know who it
+# may speak to. upsfstats too.
+#
+# Usage: list systems running upsd that you want to monitor
+#
+# MONITOR <address> "<host description>"
+#
+# Please note, MONITOR must start in column 1 (no spaces permitted)
+#
+# Example:
+# MONITOR 10.64.1.1 "Finance department"
+# MONITOR 10.78.1.1 "Sierra High School data room #1"
+#
+MONITOR 127.0.0.1 "Local Host"
diff --git a/net/apcupsd/patches/010-fix-include-paths.patch b/net/apcupsd/patches/010-fix-include-paths.patch
deleted file mode 100644
index 21515441f..000000000
--- a/net/apcupsd/patches/010-fix-include-paths.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/autoconf/variables.mak.in b/autoconf/variables.mak.in
-index b67e467..6022434 100644
---- a/autoconf/variables.mak.in
-+++ b/autoconf/variables.mak.in
-@@ -65,7 +65,7 @@ DRVLIBS = @PTHREAD_LFLAGS@ @DRVLIBS@
- X_LIBS = @X_LIBS@
- X_EXTRA_LIBS = @X_EXTRA_LIBS@
-
--CPPFLAGS = @CPPFLAGS@ -I$(topdir)/include $(EXTRAINCS)
-+CPPFLAGS = -I$(topdir)/include @CPPFLAGS@ $(EXTRAINCS)
- CFLAGS = $(CPPFLAGS) @CFLAGS@ @PTHREAD_CFLAGS@
- CXXFLAGS = $(CPPFLAGS) @CXXFLAGS@ @PTHREAD_CFLAGS@
- LDFLAGS = @LDFLAGS@