Browse Source

nut: New package for Network UPS Tools

An older version of nut is in oldpackages. This commit is based on that
package and bumps the version to the latest release along with unifying
the server and client packages. More build options are provided for any
custom configuration but the defaults provide a working client and
server install which only needs a UPS driver. Drivers still build as
individual packages to minimise bloat. SSL support has also been added.

Signed-off-by: Martin Rowe <cyanidium@users.noreply.github.com>
Marty R 10 years ago
parent
commit
d8258c35d5

+ 107
- 0
net/nut/Config.in View File

@@ -0,0 +1,107 @@
1
+	config NUT_SERVER
2
+		depends on PACKAGE_nut
3
+		bool "Include server components (upsd)"
4
+		help
5
+			upsd is responsible for serving the data from the drivers to the
6
+			clients. It connects to each driver and maintains a local cache of the
7
+			current state. Queries from the clients are served from this cache, so
8
+			delays are minimal. This program is essential, and must be running at
9
+			all times to actually make any use out of the drivers and clients.
10
+		default y
11
+		
12
+	config NUT_CLIENTS_UPSC
13
+		depends on PACKAGE_nut
14
+		bool "Include command line client (upsc)"
15
+		help
16
+			upsc is provided as a quick way to poll the status of a UPS server. It
17
+			can be used inside shell scripts and other programs that need UPS data
18
+			but don't want to include the full interface.
19
+		default y
20
+		
21
+	config NUT_CLIENTS_UPSLOG
22
+		depends on PACKAGE_nut
23
+		bool "Include logging client (upslog)"
24
+		help
25
+			upslog is a daemon that will poll a UPS at periodic intervals, fetch the
26
+			variables that interest you, format them, and write them to a file.
27
+		default n
28
+		
29
+	config NUT_CLIENTS_UPSCMD
30
+		depends on PACKAGE_nut
31
+		bool "Include UPS controller (upscmd)"
32
+		help
33
+			upscmd allows you to invoke "instant commands" in your UPS hardware. Not
34
+			all hardware supports this, so check the list with -l to see if anything
35
+			will work on your equipment. On hardware that supports it, you can use
36
+			this program to start and stop battery tests, invoke a front panel test
37
+			(beep!), turn the load on or off, and more.
38
+		default n
39
+		
40
+	config NUT_CLIENTS_UPSRW
41
+		depends on PACKAGE_nut
42
+		bool "Include UPS variable editor (upsrw)"
43
+		help
44
+			upsrw allows you to view and change the read/write variables inside your
45
+			UPS. It sends commands via the upsd to your driver, which configures the
46
+			hardware for you. The list of variables that allow you to change their
47
+			values is based on the capabilities of your UPS equipment. Not all
48
+			models support this feature. Typically, cheaper hardware does not
49
+			support any of them.
50
+		default n
51
+		
52
+	config NUT_CLIENTS_UPSMON
53
+		depends on PACKAGE_nut
54
+		bool "Include monitor and shutdown controller (upsmon)"
55
+		help
56
+			upsmon is the client process that is responsible for the most important
57
+			part of UPS monitoring--shutting down the system when the power goes
58
+			out. It can call out to other helper programs for notification purposes
59
+			during power events. upsmon can monitor multiple systems using a single
60
+			process. Every UPS that is defined in the upsmon.conf configuration file
61
+			is assigned a power value and a type (slave or master).
62
+		default y
63
+		
64
+	config NUT_CLIENTS_UPSSCHED
65
+		depends on NUT_CLIENTS_UPSMON
66
+		bool "Include helper for triggering events from upsmon (upssched)"
67
+		help
68
+			upssched was created to allow users to execute programs at times relative
69
+			to events being monitored by upsmon. The original purpose was to allow
70
+			for a shutdown to occur after some fixed period on battery, but there are
71
+			other uses that are possible.
72
+			You can alternatively write your own script and save some space.
73
+		default n
74
+	
75
+	config NUT_SSL
76
+		depends on PACKAGE_nut
77
+		bool "Build with support for OpenSSL"
78
+		help
79
+			SSL allows sessions between upsd and clients to be encrypted and can
80
+			also be used to authenticate servers. This means that stealing port
81
+			3493 from upsd will no longer net you interesting passwords. SSL is
82
+			available via OpenSSL on OpenWRT (NSS doesn't seem to work). If you
83
+			are happy with using passwords to authenticate clients, you can save
84
+			some space and build NUT without SSL support.
85
+		default n
86
+	
87
+	config NUT_DRIVER_SERIAL
88
+		depends on PACKAGE_nut
89
+		bool "Build with support for serial drivers"
90
+		help
91
+			If you have a UPS connected via serial, select this.
92
+		default n
93
+	
94
+	config NUT_DRIVER_USB
95
+		depends on PACKAGE_nut
96
+		bool "Build with support for USB drivers"
97
+		help
98
+			If you have a UPS connected via USB, select this.
99
+		default y
100
+	
101
+	config NUT_DRIVER_SNMP
102
+		depends on PACKAGE_nut
103
+		bool "Build with support for SNMP drivers"
104
+		help
105
+			If you have a UPS you can connect to via SNMP, select this.
106
+		default n
107
+		

+ 279
- 0
net/nut/Makefile View File

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

+ 21
- 0
net/nut/files/nut-monitor.init View File

@@ -0,0 +1,21 @@
1
+#!/bin/sh /etc/rc.common
2
+
3
+START=60
4
+USE_PROCD=1
5
+
6
+restart() {
7
+	stop_service
8
+	start_service
9
+}
10
+
11
+start_service() {
12
+	upsmon -p
13
+}
14
+
15
+stop_service() {
16
+	upsmon -c stop
17
+}
18
+
19
+reload_service() {
20
+	upsmon -c reload
21
+}

+ 23
- 0
net/nut/files/nut-server.init View File

@@ -0,0 +1,23 @@
1
+#!/bin/sh /etc/rc.common
2
+
3
+START=50
4
+USE_PROCD=1
5
+
6
+restart() {
7
+	stop_service
8
+	start_service
9
+}
10
+
11
+start_service() {
12
+	upsdrvctl start
13
+	upsd
14
+}
15
+
16
+stop_service() {
17
+	upsd -c stop
18
+	upsdrvctl stop
19
+}
20
+
21
+reload_service() {
22
+	upsd -c reload
23
+}

+ 22
- 0
net/nut/patches/001-fix-missing-libmath-flags.patch View File

@@ -0,0 +1,22 @@
1
+--- a/drivers/Makefile.am
2
++++ b/drivers/Makefile.am
3
+@@ -171,7 +171,7 @@ tripplite_usb_SOURCES = tripplite_usb.c
4
+ tripplite_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
5
+ 
6
+ bcmxcp_usb_SOURCES = bcmxcp_usb.c bcmxcp.c usb-common.c
7
+-bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS)
8
++bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
9
+ 
10
+ blazer_usb_SOURCES = blazer.c blazer_usb.c libusb.c usb-common.c
11
+ blazer_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
12
+--- a/drivers/Makefile.in
13
++++ b/drivers/Makefile.in
14
+@@ -785,7 +785,7 @@ usbhid_ups_LDADD = $(LDADD_DRIVERS) $(LI
15
+ tripplite_usb_SOURCES = tripplite_usb.c libusb.c usb-common.c
16
+ tripplite_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
17
+ bcmxcp_usb_SOURCES = bcmxcp_usb.c bcmxcp.c usb-common.c
18
+-bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS)
19
++bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
20
+ blazer_usb_SOURCES = blazer.c blazer_usb.c libusb.c usb-common.c
21
+ blazer_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
22
+ nutdrv_atcl_usb_SOURCES = nutdrv_atcl_usb.c usb-common.c

+ 28
- 0
net/nut/patches/010-ignore_automake_k_bug.patch View File

@@ -0,0 +1,28 @@
1
+--- a/Makefile.in
2
++++ b/Makefile.in
3
+@@ -431,12 +431,6 @@ distclean-libtool:
4
+ # (2) otherwise, pass the desired values on the `make' command line.
5
+ $(RECURSIVE_TARGETS):
6
+ 	@fail= failcom='exit 1'; \
7
+-	for f in x $$MAKEFLAGS; do \
8
+-	  case $$f in \
9
+-	    *=* | --[!k]*);; \
10
+-	    *k*) failcom='fail=yes';; \
11
+-	  esac; \
12
+-	done; \
13
+ 	dot_seen=no; \
14
+ 	target=`echo $@ | sed s/-recursive//`; \
15
+ 	list='$(SUBDIRS)'; for subdir in $$list; do \
16
+@@ -456,12 +450,6 @@ $(RECURSIVE_TARGETS):
17
+ 
18
+ $(RECURSIVE_CLEAN_TARGETS):
19
+ 	@fail= failcom='exit 1'; \
20
+-	for f in x $$MAKEFLAGS; do \
21
+-	  case $$f in \
22
+-	    *=* | --[!k]*);; \
23
+-	    *k*) failcom='fail=yes';; \
24
+-	  esac; \
25
+-	done; \
26
+ 	dot_seen=no; \
27
+ 	case "$@" in \
28
+ 	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \