diff --git a/net/nut/Config.in b/net/nut/Config.in index b37dbca01..b48102f34 100644 --- a/net/nut/Config.in +++ b/net/nut/Config.in @@ -84,13 +84,6 @@ 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" diff --git a/net/nut/Makefile b/net/nut/Makefile index 176ab5150..41ab4cc44 100644 --- a/net/nut/Makefile +++ b/net/nut/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nut PKG_VERSION:=2.7.3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/ @@ -28,11 +28,10 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_NUT_CLIENTS_UPSMON \ CONFIG_NUT_CLIENTS_UPSRW \ CONFIG_NUT_CLIENTS_UPSSCHED \ - CONFIG_NUT_DRIVER_SERIAL \ CONFIG_NUT_DRIVER_SNMP \ CONFIG_NUT_DRIVER_USB \ CONFIG_NUT_SERVER \ - CONFIG_NUT_SSL \ + CONFIG_NUT_SSL include $(INCLUDE_DIR)/package.mk @@ -78,7 +77,6 @@ endef define Package/nut/install $(INSTALL_DIR) $(1)/etc/nut $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_DIR) $(1)/usr/lib $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/nut.conf.sample $(1)/etc/nut/nut.conf @@ -102,7 +100,7 @@ define Package/nut/install $(if $(CONFIG_NUT_SERVER),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsd.users.sample $(1)/etc/nut/upsd.users) $(if $(CONFIG_NUT_CLIENTS_UPSC),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upsc $(1)/usr/bin/) $(if $(CONFIG_NUT_CLIENTS_UPSCMD),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upscmd $(1)/usr/bin/) - $(if $(CONFIG_NUT_CLIENTS_LOG),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upslog $(1)/usr/bin/) + $(if $(CONFIG_NUT_CLIENTS_UPSLOG),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upslog $(1)/usr/bin/) $(if $(CONFIG_NUT_CLIENTS_UPSRW),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upsrw $(1)/usr/bin/) $(if $(CONFIG_NUT_CLIENTS_UPSMON),$(CP) ./files/nut-monitor.init $(1)/etc/init.d/) $(if $(CONFIG_NUT_CLIENTS_UPSMON),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upsmon $(1)/usr/sbin/) @@ -112,13 +110,62 @@ 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 + DEPENDS+=+libgd +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 + +define Package/nut-avahi-service + $(call Package/nut/Default) + TITLE+= (Avahi service) + DEPENDS+=+avahi-daemon +endef + +define Package/nut-avahi-service/description +This package contains the service definition for announcing the +attached UPS via mDNS/DNS-SD. +endef + +define Package/nut-avahi-service/conffiles + /etc/avahi/services/nut.service +endef + +define Package/nut-avahi-service/install + $(INSTALL_DIR) $(1)/etc/avahi/services + $(INSTALL_CONF) ./files/nut.service $(1)/etc/avahi/services/ +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 define Package/nut-driver-$(2) $(call Package/nut/Default) TITLE:=$(2) (NUT $(1) driver) - $(if $(filter $(1),serial),DEPENDS+= @NUT_DRIVER_SERIAL) $(if $(filter $(1),snmp),DEPENDS+= @NUT_DRIVER_SNMP) $(if $(filter $(1),usb),DEPENDS+= @NUT_DRIVER_USB) endef @@ -270,24 +317,36 @@ $(eval $(call DriverDescription,usb,nutdrv_qx,\ Driver for Q* protocol serial and USB based UPS equipment)) CONFIGURE_ARGS += \ - --$(if $(CONFIG_NUT_DRIVER_SERIAL),with,without)-serial \ + --sysconfdir=/etc/nut \ + --datadir=/usr/share/nut \ + --with-dev \ --$(if $(CONFIG_NUT_DRIVER_USB),with,without)-usb \ + --without-avahi \ --$(if $(CONFIG_NUT_DRIVER_SNMP),with,without)-snmp \ --without-neon \ --without-powerman \ --without-ipmi \ --without-freeipmi \ --$(if $(CONFIG_NUT_SSL),with,without)-ssl $(if $(CONFIG_NUT_SSL),--with-openssl) \ - --without-avahi \ --without-libltdl \ - --with-user=root \ - --with-group=root \ - --sysconfdir=/etc/nut \ - --with-drvpath=/lib/nut \ + --$(if $(CONFIG_PACKAGE_nut-web-cgi),with,without)-cgi \ --with-statepath=/var/run \ - --datadir=/usr/share/nut + --with-drvpath=/lib/nut \ + --with-cgipath=/usr/share/www/cgi-bin/nut \ + --with-htmlpath=/usr/share/www/nut \ + --with-user=root \ + --with-group=root + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig/ +endef $(eval $(call BuildPackage,nut)) +$(eval $(call BuildPackage,nut-web-cgi)) +$(eval $(call BuildPackage,nut-avahi-service)) $(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)))) diff --git a/net/nut/files/nut.service b/net/nut/files/nut.service new file mode 100644 index 000000000..5ad6b3191 --- /dev/null +++ b/net/nut/files/nut.service @@ -0,0 +1,34 @@ + + + + + + + + + + %h + + + _nut._tcp + 3493 + + +