You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

279 lines
12 KiB

  1. #
  2. # Copyright (C) 2006-2014 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=nut
  9. PKG_VERSION:=2.7.2
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/
  13. PKG_MD5SUM:=c3568b42e058cfc385b46d25140dced4
  14. PKG_MAINTAINER:=Martin Rowe <martin.p.rowe@gmail.com>
  15. PKG_LICENSE:=GPL-2.0
  16. PKG_LICENSE_FILES:=LICENSE-GPL2
  17. PKG_BUILD_DIR:=$(BUILD_DIR)/nut-$(PKG_VERSION)
  18. PKG_INSTALL:=1
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/nut/Default
  21. SECTION:=net
  22. CATEGORY:=Network
  23. URL:=http://www.networkupstools.org/
  24. DEPENDS:=nut
  25. endef
  26. define Package/nut/description
  27. Network UPS Tools (NUT) is a client/server monitoring system that
  28. allows computers to share uninterruptible power supply (UPS) and
  29. power distribution unit (PDU) hardware. Clients access the hardware
  30. through the server, and are notified whenever the power status
  31. changes.
  32. endef
  33. define Package/nut
  34. $(call Package/nut/Default)
  35. TITLE:=Network UPS Tools
  36. DEPENDS:= \
  37. +NUT_DRIVER_SNMP:libnetsnmp \
  38. +NUT_DRIVER_USB:libusb-compat \
  39. +NUT_SSL:libopenssl
  40. MENU:=1
  41. endef
  42. define Package/nut/config
  43. source "$(SOURCE)/Config.in"
  44. endef
  45. define Package/nut/conffiles
  46. /etc/nut/nut.conf
  47. $(if $(CONFIG_NUT_CLIENTS_UPSMON),/etc/nut/upsmon.conf)
  48. $(if $(CONFIG_NUT_CLIENTS_UPSSCHED),/etc/nut/upssched.conf)
  49. $(if $(CONFIG_NUT_SERVER),/etc/nut/ups.conf)
  50. $(if $(CONFIG_NUT_SERVER),/etc/nut/upsd.conf)
  51. $(if $(CONFIG_NUT_SERVER),/etc/nut/upsd.users)
  52. endef
  53. define Package/nut/install
  54. $(INSTALL_DIR) $(1)/etc/nut
  55. $(INSTALL_DIR) $(1)/usr/bin
  56. $(INSTALL_DIR) $(1)/usr/bin
  57. $(INSTALL_DIR) $(1)/usr/lib
  58. $(INSTALL_DIR) $(1)/usr/sbin
  59. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/nut.conf.sample $(1)/etc/nut/nut.conf
  60. $(if $(or $(CONFIG_NUT_CLIENTS_UPSC),\
  61. $(CONFIG_NUT_CLIENTS_UPSCMD),\
  62. $(CONFIG_NUT_CLIENTS_LOG),\
  63. $(CONFIG_NUT_CLIENTS_UPSRW),\
  64. $(CONFIG_NUT_CLIENTS_UPSMON),\
  65. $(CONFIG_NUT_CLIENTS_UPSSCHED)),$(CP) $(PKG_INSTALL_DIR)/usr/lib/libupsclient.so* $(1)/usr/lib/)
  66. $(if $(or $(CONFIG_NUT_SERVER),\
  67. $(CONFIG_NUT_CLIENTS_UPSMON)),$(INSTALL_DIR) $(1)/etc/init.d)
  68. $(if $(CONFIG_NUT_SERVER),$(INSTALL_DIR) $(1)/lib/nut)
  69. $(if $(CONFIG_NUT_SERVER),$(INSTALL_DIR) $(1)/usr/share/nut)
  70. $(if $(CONFIG_NUT_SERVER),$(CP) ./files/nut-server.init $(1)/etc/init.d/)
  71. $(if $(CONFIG_NUT_SERVER),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upsd $(1)/usr/sbin)
  72. $(if $(CONFIG_NUT_SERVER),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upsdrvctl $(1)/usr/sbin)
  73. $(if $(CONFIG_NUT_SERVER),$(CP) $(PKG_INSTALL_DIR)/usr/share/nut/cmdvartab $(1)/usr/share/nut/)
  74. $(if $(CONFIG_NUT_SERVER),$(CP) $(PKG_INSTALL_DIR)/usr/share/nut/driver.list $(1)/usr/share/nut/)
  75. $(if $(CONFIG_NUT_SERVER),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/ups.conf.sample $(1)/etc/nut/ups.conf)
  76. $(if $(CONFIG_NUT_SERVER),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsd.conf.sample $(1)/etc/nut/upsd.conf)
  77. $(if $(CONFIG_NUT_SERVER),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsd.users.sample $(1)/etc/nut/upsd.users)
  78. $(if $(CONFIG_NUT_CLIENTS_UPSC),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upsc $(1)/usr/bin/)
  79. $(if $(CONFIG_NUT_CLIENTS_UPSCMD),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upscmd $(1)/usr/bin/)
  80. $(if $(CONFIG_NUT_CLIENTS_LOG),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upslog $(1)/usr/bin/)
  81. $(if $(CONFIG_NUT_CLIENTS_UPSRW),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upsrw $(1)/usr/bin/)
  82. $(if $(CONFIG_NUT_CLIENTS_UPSMON),$(CP) ./files/nut-monitor.init $(1)/etc/init.d/)
  83. $(if $(CONFIG_NUT_CLIENTS_UPSMON),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upsmon $(1)/usr/sbin/)
  84. $(if $(CONFIG_NUT_CLIENTS_UPSMON),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsmon.conf.sample $(1)/etc/nut/upsmon.conf)
  85. $(if $(CONFIG_NUT_CLIENTS_UPSSCHED),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upssched-cmd $(1)/usr/bin/)
  86. $(if $(CONFIG_NUT_CLIENTS_UPSSCHED),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upssched $(1)/usr/sbin/)
  87. $(if $(CONFIG_NUT_CLIENTS_UPSSCHED),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upssched.conf.sample $(1)/etc/nut/upssched.conf)
  88. endef
  89. # Dealing with all of the drivers is very repetitive, but the previous
  90. # maintainer had a neat solution which just needed some tweaking.
  91. define DriverPackage
  92. define Package/nut-driver-$(2)
  93. $(call Package/nut/Default)
  94. TITLE:=$(2) (NUT $(1) driver)
  95. $(if $(filter $(1),serial),DEPENDS+= @NUT_DRIVER_SERIAL)
  96. $(if $(filter $(1),snmp),DEPENDS+= @NUT_DRIVER_SNMP)
  97. $(if $(filter $(1),usb),DEPENDS+= @NUT_DRIVER_USB)
  98. endef
  99. # Deliberately empty description in order to trigger a build failure.
  100. # It should be overridden by the list below, and when updating to a
  101. # new version of nut we will need to provide descriptions for any new
  102. # drivers.
  103. define Package/nut-driver-$(2)/description
  104. endef
  105. define Package/nut-driver-$(2)/install
  106. $(INSTALL_DIR) $$(1)/lib/nut
  107. $(CP) $$(PKG_INSTALL_DIR)/lib/nut/$(2) $$(1)/lib/nut/
  108. $(if $(filter $(2),clone),$(CP) $$(PKG_INSTALL_DIR)/lib/nut/$(2)-outlet $$(1)/lib/nut/)
  109. endef
  110. endef
  111. define DriverDescription
  112. define Package/nut-driver-$(2)/description
  113. $(3)
  114. endef
  115. endef
  116. # These lists are lifted *directly* from drivers/Makefile.am in the nut
  117. # source tree. This it to make it simpler to keep in sync when updating
  118. # to a newer version of nut. Do not edit this manually.
  119. #
  120. # DO NOT EDIT (except to update with a fresh cut/paste)!
  121. SERIAL_DRIVERLIST = al175 bcmxcp belkin belkinunv bestfcom \
  122. bestfortress bestuferrups bestups dummy-ups etapro everups \
  123. gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys \
  124. oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino \
  125. safenet skel solis tripplite tripplitesu upscode2 victronups powerpanel \
  126. blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old apcupsd-ups riello_ser \
  127. nutdrv_qx
  128. SNMP_DRIVERLIST = snmp-ups
  129. USB_LIBUSB_DRIVERLIST = usbhid-ups bcmxcp_usb tripplite_usb \
  130. blazer_usb richcomm_usb riello_usb \
  131. nutdrv_atcl_usb \
  132. nutdrv_qx
  133. # END: DO NOT EDIT!
  134. SERIAL_DRIVERLIST_IGNORE:=skel clone-outlet nutdrv_qx
  135. # nutdrv_qx can be either USB or serial. Given most routers have USB
  136. # instead of serial ports, and not wanting two identical packages with
  137. # different names that conflict with each other, only the option for the
  138. # driver with USB bindings is provided. If you really want to save that
  139. # tiny bit of space and build it without USB support, remove nutdrv_qx
  140. # from the previous line.
  141. $(foreach d,$(filter-out $(SERIAL_DRIVERLIST_IGNORE),$(SERIAL_DRIVERLIST)),$(eval $(call DriverPackage,serial,$(d))))
  142. $(foreach d,$(SNMP_DRIVERLIST),$(eval $(call DriverPackage,snmp,$(d))))
  143. $(foreach d,$(USB_LIBUSB_DRIVERLIST),$(eval $(call DriverPackage,usb,$(d))))
  144. $(eval $(call DriverDescription,serial,al175,\
  145. Driver for Eltek UPS models with AL175 alarm module))
  146. $(eval $(call DriverDescription,serial,bcmxcp,\
  147. Driver for UPSes supporting the serial BCM/XCP protocol))
  148. $(eval $(call DriverDescription,serial,belkin,\
  149. Driver for Belkin serial UPS equipment))
  150. $(eval $(call DriverDescription,serial,belkinunv,\
  151. Driver for Belkin "Universal UPS" and compatible))
  152. $(eval $(call DriverDescription,serial,bestfcom,\
  153. Driver for Best Power Fortress/Ferrups))
  154. $(eval $(call DriverDescription,serial,bestfortress,\
  155. Driver for old Best Fortress UPS equipment))
  156. $(eval $(call DriverDescription,serial,bestuferrups,\
  157. Driver for Best Power Micro-Ferrups))
  158. $(eval $(call DriverDescription,serial,bestups,\
  159. Driver for Best Power / SOLA (Phoenixtec protocol) UPS equipment))
  160. $(eval $(call DriverDescription,serial,dummy-ups,\
  161. Driver for multi-purpose UPS emulation))
  162. $(eval $(call DriverDescription,serial,etapro,\
  163. Driver for ETA UPS equipment))
  164. $(eval $(call DriverDescription,serial,everups,\
  165. Driver for Ever UPS models))
  166. $(eval $(call DriverDescription,serial,gamatronic,\
  167. Driver for Gamatronic UPS equipment))
  168. $(eval $(call DriverDescription,serial,genericups,\
  169. Driver for contact-closure UPS equipment))
  170. $(eval $(call DriverDescription,serial,isbmex,\
  171. Driver for ISBMEX UPS equipment))
  172. $(eval $(call DriverDescription,serial,liebert,\
  173. Driver for Liebert contact-closure UPS equipment))
  174. $(eval $(call DriverDescription,serial,liebert-esp2,\
  175. Driver for Liebert UPS, using the ESP-II serial protocol))
  176. $(eval $(call DriverDescription,serial,masterguard,\
  177. Driver for Masterguard UPS equipment))
  178. $(eval $(call DriverDescription,serial,metasys,\
  179. Driver for Meta System UPS equipment))
  180. $(eval $(call DriverDescription,serial,oldmge-shut,\
  181. Driver for SHUT Protocol UPS equipment, deprecated, use mge-shut))
  182. $(eval $(call DriverDescription,serial,mge-utalk,\
  183. Driver for MGE UPS SYSTEMS UTalk protocol equipment))
  184. $(eval $(call DriverDescription,serial,microdowell,\
  185. Driver for Microdowell Enterprise UPS series))
  186. $(eval $(call DriverDescription,serial,mge-shut,\
  187. Driver for SHUT Protocol UPS equipment))
  188. $(eval $(call DriverDescription,serial,oneac,\
  189. Driver for Oneac UPS equipment))
  190. $(eval $(call DriverDescription,serial,optiups,\
  191. Driver for Opti-UPS (Viewsonic) UPS and Zinto D (ONLINE-USV) equipment))
  192. $(eval $(call DriverDescription,serial,powercom,\
  193. Driver for serial Powercom/Trust/Advice UPS equipment))
  194. $(eval $(call DriverDescription,serial,rhino,\
  195. Driver for Brazilian Microsol RHINO UPS equipment))
  196. $(eval $(call DriverDescription,serial,safenet,\
  197. Driver for SafeNet compatible UPS equipment))
  198. $(eval $(call DriverDescription,serial,solis,\
  199. Driver for Brazilian Microsol SOLIS UPS equipment))
  200. $(eval $(call DriverDescription,serial,tripplite,\
  201. Driver for Tripp-Lite SmartPro UPS equipment))
  202. $(eval $(call DriverDescription,serial,tripplitesu,\
  203. Driver for Tripp-Lite SmartOnline (SU) UPS equipment))
  204. $(eval $(call DriverDescription,serial,upscode2,\
  205. Driver for UPScode II compatible UPS equipment))
  206. $(eval $(call DriverDescription,serial,victronups,\
  207. Driver for IMV/Victron UPS unit Match, Match Lite, NetUps))
  208. $(eval $(call DriverDescription,serial,powerpanel,\
  209. Driver for PowerPanel Plus compatible UPS equipment))
  210. $(eval $(call DriverDescription,serial,blazer_ser,\
  211. Driver for Megatec/Q1 protocol serial based UPS equipment))
  212. $(eval $(call DriverDescription,serial,clone,\
  213. UPS driver clone))
  214. $(eval $(call DriverDescription,serial,ivtscd,\
  215. Driver for the IVT Solar Controller Device))
  216. $(eval $(call DriverDescription,serial,apcsmart,\
  217. Driver for American Power Conversion Smart Protocol UPS equipment))
  218. $(eval $(call DriverDescription,serial,apcsmart-old,\
  219. Driver for American Power Conversion Smart Protocol UPS equipment))
  220. $(eval $(call DriverDescription,serial,apcupsd-ups,\
  221. Driver for apcupsd client access))
  222. $(eval $(call DriverDescription,serial,riello_ser,\
  223. Driver for Riello UPS Protocol UPS equipment))
  224. $(eval $(call DriverDescription,snmp,snmp-ups,\
  225. Multi-MIB Driver for SNMP UPS equipment))
  226. $(eval $(call DriverDescription,usb,usbhid-ups,\
  227. Driver for USB/HID UPS equipment))
  228. $(eval $(call DriverDescription,usb,bcmxcp_usb,\
  229. Experimental driver for UPSes supporting the BCM/XCP protocol over USB))
  230. $(eval $(call DriverDescription,usb,tripplite_usb,\
  231. Driver for older Tripp Lite USB UPSes (not PDC HID)))
  232. $(eval $(call DriverDescription,usb,blazer_usb,\
  233. Driver for Megatec/Q1 protocol USB based UPS equipment))
  234. $(eval $(call DriverDescription,usb,richcomm_usb,\
  235. Driver for UPS equipment using Richcomm dry-contact to USB solution))
  236. $(eval $(call DriverDescription,usb,riello_usb,\
  237. Driver for Riello UPS Protocol UPS equipment via USB))
  238. $(eval $(call DriverDescription,usb,nutdrv_atcl_usb,\
  239. Driver for ATCL FOR UPS equipment))
  240. $(eval $(call DriverDescription,usb,nutdrv_qx,\
  241. Driver for Q* protocol serial and USB based UPS equipment))
  242. CONFIGURE_ARGS += \
  243. --$(if $(CONFIG_NUT_DRIVER_SERIAL),with,without)-serial \
  244. --$(if $(CONFIG_NUT_DRIVER_USB),with,without)-usb \
  245. --$(if $(CONFIG_NUT_DRIVER_SNMP),with,without)-snmp \
  246. --without-neon \
  247. --without-powerman \
  248. --without-ipmi \
  249. --without-freeipmi \
  250. --$(if $(CONFIG_NUT_SSL),with,without)-ssl $(if $(CONFIG_NUT_SSL),--with-openssl) \
  251. --without-avahi \
  252. --without-libltdl \
  253. --with-user=root \
  254. --with-group=root \
  255. --sysconfdir=/etc/nut \
  256. --with-drvpath=/lib/nut \
  257. --with-statepath=/var/run \
  258. --datadir=/usr/share/nut
  259. $(eval $(call BuildPackage,nut))
  260. $(foreach d,$(filter-out $(SERIAL_DRIVERLIST_IGNORE),$(SERIAL_DRIVERLIST)),$(eval $(call BuildPackage,nut-driver-$(d))))
  261. $(foreach d,$(SNMP_DRIVERLIST),$(eval $(call BuildPackage,nut-driver-$(d))))
  262. $(foreach d,$(USB_LIBUSB_DRIVERLIST),$(eval $(call BuildPackage,nut-driver-$(d))))