Added package nut-web-cgi 1614/head
authordemorfi <demorfi@gmail.com>
Sat, 25 Jul 2015 06:14:14 +0000 (12:14 +0600)
committerdemorfi <demorfi@gmail.com>
Sat, 25 Jul 2015 06:14:14 +0000 (12:14 +0600)
net/nut/Config.in
net/nut/Makefile

index b37dbca01d54a6aca4e542623628363ac7ba025d..18024ef297a9993ad51507eb64c63625c8190840 100644 (file)
@@ -8,7 +8,7 @@
                        delays are minimal. This program is essential, and must be running at
                        all times to actually make any use out of the drivers and clients.
                default y
-               
+
        config NUT_CLIENTS_UPSC
                depends on PACKAGE_nut
                bool "Include command line client (upsc)"
@@ -17,7 +17,7 @@
                        can be used inside shell scripts and other programs that need UPS data
                        but don't want to include the full interface.
                default y
-               
+
        config NUT_CLIENTS_UPSLOG
                depends on PACKAGE_nut
                bool "Include logging client (upslog)"
@@ -25,7 +25,7 @@
                        upslog is a daemon that will poll a UPS at periodic intervals, fetch the
                        variables that interest you, format them, and write them to a file.
                default n
-               
+
        config NUT_CLIENTS_UPSCMD
                depends on PACKAGE_nut
                bool "Include UPS controller (upscmd)"
@@ -36,7 +36,7 @@
                        this program to start and stop battery tests, invoke a front panel test
                        (beep!), turn the load on or off, and more.
                default n
-               
+
        config NUT_CLIENTS_UPSRW
                depends on PACKAGE_nut
                bool "Include UPS variable editor (upsrw)"
@@ -48,7 +48,7 @@
                        models support this feature. Typically, cheaper hardware does not
                        support any of them.
                default n
-               
+
        config NUT_CLIENTS_UPSMON
                depends on PACKAGE_nut
                bool "Include monitor and shutdown controller (upsmon)"
@@ -60,7 +60,7 @@
                        process. Every UPS that is defined in the upsmon.conf configuration file
                        is assigned a power value and a type (slave or master).
                default y
-               
+
        config NUT_CLIENTS_UPSSCHED
                depends on NUT_CLIENTS_UPSMON
                bool "Include helper for triggering events from upsmon (upssched)"
                        other uses that are possible.
                        You can alternatively write your own script and save some space.
                default n
-       
+
+       config NUT_CLIENTS_CGI
+               depends on PACKAGE_nut
+               bool "Include web cgi interface"
+               help
+                       The CGI programs are clients that run through your web server.
+                       They allow you to see UPS status and perform certain administrative
+                       commands from any web browser. Javascript and cookies are not required.
+               default n
+
        config NUT_SSL
                depends on PACKAGE_nut
                bool "Build with support for OpenSSL"
                        are happy with using passwords to authenticate clients, you can save
                        some space and build NUT without SSL support.
                default n
-       
+
        config NUT_DRIVER_SERIAL
                depends on PACKAGE_nut
                bool "Build with support for serial drivers"
                help
                        If you have a UPS connected via serial, select this.
                default n
-       
+
        config NUT_DRIVER_USB
                depends on PACKAGE_nut
                bool "Build with support for USB drivers"
                help
                        If you have a UPS connected via USB, select this.
                default y
-       
+
        config NUT_DRIVER_SNMP
                depends on PACKAGE_nut
                bool "Build with support for SNMP drivers"
                help
                        If you have a UPS you can connect to via SNMP, select this.
                default n
-               
index 32a3e1343b74fca3b7953e4032a8ae9334ad38fb..291d7488eb0a3b3066ec6f9771fa42c4e3a0eae0 100644 (file)
@@ -28,6 +28,7 @@ PKG_CONFIG_DEPENDS:= \
        CONFIG_NUT_CLIENTS_UPSMON \
        CONFIG_NUT_CLIENTS_UPSRW \
        CONFIG_NUT_CLIENTS_UPSSCHED \
+       CONFIG_NUT_CLIENTS_CGI \
        CONFIG_NUT_DRIVER_SERIAL \
        CONFIG_NUT_DRIVER_SNMP \
        CONFIG_NUT_DRIVER_USB \
@@ -57,7 +58,8 @@ define Package/nut
        DEPENDS:= \
                +NUT_DRIVER_SNMP:libnetsnmp \
                +NUT_DRIVER_USB:libusb-compat \
-               +NUT_SSL:libopenssl
+               +NUT_SSL:libopenssl \
+               +NUT_CLIENTS_CGI:libgd
        MENU:=1
 endef
 
@@ -111,6 +113,35 @@ define Package/nut/install
        $(if $(CONFIG_NUT_CLIENTS_UPSSCHED),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upssched.conf.sample $(1)/etc/nut/upssched.conf)
 endef
 
+define Package/nut-web-cgi
+       $(call Package/nut/Default)
+       TITLE:=Web CGI interface
+endef
+
+define Package/nut-web-cgi/description
+The CGI programs are clients that run through your web server.
+They allow you to see UPS status and perform certain administrative
+commands from any web browser. Javascript and cookies are not required.
+endef
+
+define Package/nut-web-cgi/conffiles
+       /etc/nut/hosts.conf
+       /etc/nut/upsset.conf
+       /etc/nut/upsstats.html
+       /etc/nut/upsstats-single.html
+endef
+
+define Package/nut-web-cgi/install
+       $(INSTALL_DIR) $(1)/etc/nut
+       $(INSTALL_DIR) $(1)/usr/share/www/cgi-bin
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/hosts.conf.sample $(1)/etc/nut/hosts.conf
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsset.conf.sample $(1)/etc/nut/upsset.conf
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsstats.html.sample $(1)/etc/nut/upsstats.html
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsstats-single.html.sample $(1)/etc/nut/upsstats-single.html
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/www/nut $(1)/usr/share/www/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/www/cgi-bin/nut $(1)/usr/share/www/cgi-bin/
+endef
+
 # Dealing with all of the drivers is very repetitive, but the previous
 # maintainer had a neat solution which just needed some tweaking.
 define DriverPackage
@@ -126,7 +157,7 @@ define DriverPackage
        # new version of nut we will need to provide descriptions for any new
        # drivers.
         define Package/nut-driver-$(2)/description
-               
+
         endef
         define Package/nut-driver-$(2)/install
                $(INSTALL_DIR) $$(1)/lib/nut
@@ -284,9 +315,13 @@ CONFIGURE_ARGS += \
        --sysconfdir=/etc/nut \
        --with-drvpath=/lib/nut \
        --with-statepath=/var/run \
-       --datadir=/usr/share/nut
+       --datadir=/usr/share/nut \
+       --$(if $(CONFIG_NUT_CLIENTS_CGI),with,without)-cgi \
+       --with-htmlpath=/usr/share/www/nut \
+       --with-cgipath=/usr/share/www/cgi-bin/nut
 
 $(eval $(call BuildPackage,nut))
+$(eval $(call BuildPackage,nut-web-cgi))
 $(foreach d,$(filter-out $(SERIAL_DRIVERLIST_IGNORE),$(SERIAL_DRIVERLIST)),$(eval $(call BuildPackage,nut-driver-$(d))))
 $(foreach d,$(SNMP_DRIVERLIST),$(eval $(call BuildPackage,nut-driver-$(d))))
 $(foreach d,$(USB_LIBUSB_DRIVERLIST),$(eval $(call BuildPackage,nut-driver-$(d))))