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.

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