Browse Source

apcupsd: add cgi module

Signed-off-by: Othmar Truniger <github@truniger.ch>
Othmar Truniger 10 years ago
parent
commit
dda1acfefa

+ 32
- 4
net/apcupsd/Makefile View File

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=apcupsd
11 11
 PKG_VERSION:=3.14.13
12
-PKG_RELEASE:=2
12
+PKG_RELEASE:=3
13 13
 
14 14
 PKG_MAINTAINER:=Othmar Truniger <github@truniger.ch>
15 15
 PKG_LICENSE:=GPL-2.0
@@ -19,21 +19,32 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
19 19
 PKG_SOURCE_URL:=@SF/apcupsd
20 20
 PKG_MD5SUM:=c291d9d3923b4d9c0e600b755ad4f489
21 21
 
22
+PKG_BUILD_DEPENDS:=libgd
23
+
22 24
 include $(INCLUDE_DIR)/package.mk
23 25
 
24 26
 define Package/apcupsd
25
-  SECTION:=utils
26
-  CATEGORY:=Utilities
27
-  DEPENDS:=+libpthread +libusb-compat
27
+  SECTION:=net
28
+  CATEGORY:=Network
29
+  DEPENDS:=+libpthread
28 30
   TITLE:=UPS control software
29 31
   URL:=http://www.apcupsd.org/
30 32
 endef
31 33
 
34
+define Package/apcupsd-cgi
35
+  SECTION:=net
36
+  CATEGORY:=Network
37
+  DEPENDS:=+libpthread +libgd
38
+  TITLE:=UPS control software CGI module
39
+  URL:=http://www.apcupsd.org/
40
+endef
41
+
32 42
 define Build/Configure
33 43
 	$(CP) $(SCRIPT_DIR)/config.* $(PKG_BUILD_DIR)/autoconf/
34 44
 	$(call Build/Configure/Default, \
35 45
 		--with-distname=unknown \
36 46
 		--sysconfdir=/etc/apcupsd \
47
+		--enable-cgi \
37 48
 		--enable-usb \
38 49
 		--without-x \
39 50
 	)
@@ -65,6 +76,17 @@ define Package/apcupsd/install
65 76
 	$(INSTALL_BIN)	./files/apcupsd.init $(1)/etc/init.d/apcupsd
66 77
 endef
67 78
 
79
+define Package/apcupsd-cgi/install
80
+	$(INSTALL_DIR) $(1)/www/cgi-bin/apcupsd
81
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/multimon.cgi $(1)/www/cgi-bin/apcupsd
82
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/upsfstats.cgi $(1)/www/cgi-bin/apcupsd
83
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/upsimage.cgi $(1)/www/cgi-bin/apcupsd
84
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/upsstats.cgi $(1)/www/cgi-bin/apcupsd
85
+	$(INSTALL_DIR) $(1)/etc/apcupsd
86
+	$(INSTALL_CONF) ./files/apcupsd.css $(1)/etc/apcupsd/
87
+	$(INSTALL_CONF) ./files/hosts.conf $(1)/etc/apcupsd/
88
+endef
89
+
68 90
 define Package/apcupsd/conffiles
69 91
 /etc/apcupsd/apcupsd.conf
70 92
 /etc/apcupsd/apcupsd_mail.conf
@@ -75,4 +97,10 @@ define Package/apcupsd/conffiles
75 97
 /etc/apcupsd/onbattery
76 98
 endef
77 99
 
100
+define Package/apcupsd-cgi/conffiles
101
+/etc/apcupsd/apcupsd.css
102
+/etc/apcupsd/hosts.conf
103
+endef
104
+
78 105
 $(eval $(call BuildPackage,apcupsd))
106
+$(eval $(call BuildPackage,apcupsd-cgi))

+ 64
- 0
net/apcupsd/files/apcupsd.css View File

@@ -0,0 +1,64 @@
1
+body {
2
+        color: black;
3
+        background: white;
4
+}
5
+
6
+div.Center {
7
+        text-align: center;
8
+}
9
+
10
+img {
11
+        border-style: none;
12
+}
13
+
14
+pre {
15
+        text-align: left;
16
+}
17
+
18
+strong {
19
+        color: red;
20
+}
21
+
22
+table.Outer {
23
+        color: black;
24
+        background: #60a0a0;
25
+        empty-cells: show; border: solid #60a0a0
26
+}
27
+
28
+th.Outer {
29
+        color: black;
30
+        background: #60b0b0
31
+}
32
+
33
+.Title {
34
+        font-size: 18pt;
35
+}
36
+
37
+.SubTitle {
38
+        font-size: 12pt;
39
+}
40
+
41
+.Empty {
42
+        color: black;
43
+        background: aqua;
44
+}
45
+
46
+.Fault {
47
+        color: black;
48
+        background: red;
49
+}
50
+
51
+.Label {
52
+        color: black;
53
+        background: aqua;
54
+}
55
+
56
+.Normal {
57
+        color: black;
58
+        background: lime;
59
+}
60
+
61
+.Warning {
62
+        color: black;
63
+        background: yellow;
64
+}

+ 19
- 0
net/apcupsd/files/hosts.conf View File

@@ -0,0 +1,19 @@
1
+# Network UPS Tools - hosts.conf
2
+#
3
+# This file does double duty - it lists the systems that multimon will
4
+# monitor, and also specifies the systems that upsstats is allowed to
5
+# watch.  It keeps people from feeding random addresses to upsstats,
6
+# among other things.  upsimage also uses this file to know who it
7
+# may speak to. upsfstats too.
8
+#
9
+# Usage: list systems running upsd that you want to monitor
10
+#
11
+# MONITOR <address> "<host description>"
12
+#
13
+# Please note, MONITOR must start in column 1 (no spaces permitted)
14
+#
15
+# Example:
16
+# MONITOR 10.64.1.1 "Finance department"
17
+# MONITOR 10.78.1.1 "Sierra High School data room #1"
18
+#
19
+MONITOR 127.0.0.1 "Local Host"

+ 0
- 13
net/apcupsd/patches/010-fix-include-paths.patch View File

@@ -1,13 +0,0 @@
1
-diff --git a/autoconf/variables.mak.in b/autoconf/variables.mak.in
2
-index b67e467..6022434 100644
3
---- a/autoconf/variables.mak.in
4
-+++ b/autoconf/variables.mak.in
5
-@@ -65,7 +65,7 @@ DRVLIBS = @PTHREAD_LFLAGS@ @DRVLIBS@
6
- X_LIBS = @X_LIBS@
7
- X_EXTRA_LIBS = @X_EXTRA_LIBS@
8
- 
9
--CPPFLAGS = @CPPFLAGS@ -I$(topdir)/include $(EXTRAINCS)
10
-+CPPFLAGS = -I$(topdir)/include @CPPFLAGS@ $(EXTRAINCS)
11
- CFLAGS = $(CPPFLAGS) @CFLAGS@ @PTHREAD_CFLAGS@
12
- CXXFLAGS = $(CPPFLAGS) @CXXFLAGS@ @PTHREAD_CFLAGS@
13
- LDFLAGS = @LDFLAGS@