소스 검색

nut: add dev headers, nut-web-cgi and nut-avahi-service, bugfix

Headers are required by collectd as mentioned in #1801. This is the nut portion based on dwmw2@d636841cd1
Happy to merge with 15.05 as per #1803.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
[martin.p.rowe@gmail.com: condensed InstallDev lines]

Added package nut-web-cgi based on demorfi@7e340f4794. Closes #1614.
Pending signoff by @demorfi
[martin.p.rowe@gmail.com: simplified implementation, no changes to Config.in]

Added package nut-avahi-service similar to other implementations in #618
Bugfix to remove redundant NUT_DRIVER_SERIAL config
Bugfix to make UPSLOG config actually install (requires PKG_RELEASE bump)
Some code tidy-ups
Signed-off-by: Martin Rowe <martin.p.rowe@gmail.com>
Marty R 9 년 전
부모
커밋
064d84ab90
3개의 변경된 파일106개의 추가작업 그리고 20개의 파일을 삭제
  1. 0
    7
      net/nut/Config.in
  2. 72
    13
      net/nut/Makefile
  3. 34
    0
      net/nut/files/nut.service

+ 0
- 7
net/nut/Config.in 파일 보기

@@ -84,13 +84,6 @@
84 84
 			some space and build NUT without SSL support.
85 85
 		default n
86 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 87
 	config NUT_DRIVER_USB
95 88
 		depends on PACKAGE_nut
96 89
 		bool "Build with support for USB drivers"

+ 72
- 13
net/nut/Makefile 파일 보기

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=nut
11 11
 PKG_VERSION:=2.7.3
12
-PKG_RELEASE:=1
12
+PKG_RELEASE:=2
13 13
 
14 14
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 15
 PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/
@@ -28,11 +28,10 @@ PKG_CONFIG_DEPENDS:= \
28 28
 	CONFIG_NUT_CLIENTS_UPSMON \
29 29
 	CONFIG_NUT_CLIENTS_UPSRW \
30 30
 	CONFIG_NUT_CLIENTS_UPSSCHED \
31
-	CONFIG_NUT_DRIVER_SERIAL \
32 31
 	CONFIG_NUT_DRIVER_SNMP \
33 32
 	CONFIG_NUT_DRIVER_USB \
34 33
 	CONFIG_NUT_SERVER \
35
-	CONFIG_NUT_SSL \
34
+	CONFIG_NUT_SSL
36 35
 
37 36
 include $(INCLUDE_DIR)/package.mk
38 37
 
@@ -78,7 +77,6 @@ endef
78 77
 define Package/nut/install
79 78
 	$(INSTALL_DIR) $(1)/etc/nut
80 79
 	$(INSTALL_DIR) $(1)/usr/bin
81
-	$(INSTALL_DIR) $(1)/usr/bin
82 80
 	$(INSTALL_DIR) $(1)/usr/lib
83 81
 	$(INSTALL_DIR) $(1)/usr/sbin
84 82
 	$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/nut.conf.sample $(1)/etc/nut/nut.conf
@@ -102,7 +100,7 @@ define Package/nut/install
102 100
 	$(if $(CONFIG_NUT_SERVER),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsd.users.sample $(1)/etc/nut/upsd.users)
103 101
 	$(if $(CONFIG_NUT_CLIENTS_UPSC),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upsc $(1)/usr/bin/)
104 102
 	$(if $(CONFIG_NUT_CLIENTS_UPSCMD),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upscmd $(1)/usr/bin/)
105
-	$(if $(CONFIG_NUT_CLIENTS_LOG),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upslog $(1)/usr/bin/)
103
+	$(if $(CONFIG_NUT_CLIENTS_UPSLOG),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upslog $(1)/usr/bin/)
106 104
 	$(if $(CONFIG_NUT_CLIENTS_UPSRW),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upsrw $(1)/usr/bin/)
107 105
 	$(if $(CONFIG_NUT_CLIENTS_UPSMON),$(CP) ./files/nut-monitor.init $(1)/etc/init.d/)
108 106
 	$(if $(CONFIG_NUT_CLIENTS_UPSMON),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upsmon $(1)/usr/sbin/)
@@ -112,13 +110,62 @@ define Package/nut/install
112 110
 	$(if $(CONFIG_NUT_CLIENTS_UPSSCHED),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upssched.conf.sample $(1)/etc/nut/upssched.conf)
113 111
 endef
114 112
 
113
+define Package/nut-web-cgi
114
+	$(call Package/nut/Default)
115
+	TITLE+= Web CGI interface
116
+	DEPENDS+=+libgd
117
+endef
118
+
119
+define Package/nut-web-cgi/description
120
+The CGI programs are clients that run through your web server.
121
+They allow you to see UPS status and perform certain administrative
122
+commands from any web browser. Javascript and cookies are not required.
123
+endef
124
+
125
+define Package/nut-web-cgi/conffiles
126
+	/etc/nut/hosts.conf
127
+	/etc/nut/upsset.conf
128
+	/etc/nut/upsstats.html
129
+	/etc/nut/upsstats-single.html
130
+endef
131
+
132
+define Package/nut-web-cgi/install
133
+	$(INSTALL_DIR) $(1)/etc/nut
134
+	$(INSTALL_DIR) $(1)/usr/share/www/cgi-bin
135
+	$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/hosts.conf.sample $(1)/etc/nut/hosts.conf
136
+	$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsset.conf.sample $(1)/etc/nut/upsset.conf
137
+	$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsstats.html.sample $(1)/etc/nut/upsstats.html
138
+	$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsstats-single.html.sample $(1)/etc/nut/upsstats-single.html
139
+	$(CP) $(PKG_INSTALL_DIR)/usr/share/www/nut $(1)/usr/share/www/
140
+	$(CP) $(PKG_INSTALL_DIR)/usr/share/www/cgi-bin/nut $(1)/usr/share/www/cgi-bin/
141
+endef
142
+
143
+define Package/nut-avahi-service
144
+	$(call Package/nut/Default)
145
+	TITLE+= (Avahi service)
146
+	DEPENDS+=+avahi-daemon
147
+endef
148
+
149
+define Package/nut-avahi-service/description
150
+This package contains the service definition for announcing the
151
+attached UPS via mDNS/DNS-SD.
152
+endef
153
+
154
+define Package/nut-avahi-service/conffiles
155
+	/etc/avahi/services/nut.service
156
+endef
157
+
158
+define Package/nut-avahi-service/install
159
+	$(INSTALL_DIR) $(1)/etc/avahi/services
160
+	$(INSTALL_CONF) ./files/nut.service $(1)/etc/avahi/services/
161
+endef
162
+
115 163
 # Dealing with all of the drivers is very repetitive, but the previous
116 164
 # maintainer had a neat solution which just needed some tweaking.
117 165
 define DriverPackage
118 166
         define Package/nut-driver-$(2)
119 167
 		$(call Package/nut/Default)
120 168
 		TITLE:=$(2) (NUT $(1) driver)
121
-		$(if $(filter $(1),serial),DEPENDS+= @NUT_DRIVER_SERIAL)
122 169
 		$(if $(filter $(1),snmp),DEPENDS+= @NUT_DRIVER_SNMP)
123 170
 		$(if $(filter $(1),usb),DEPENDS+= @NUT_DRIVER_USB)
124 171
         endef
@@ -270,24 +317,36 @@ $(eval $(call DriverDescription,usb,nutdrv_qx,\
270 317
 	Driver for Q* protocol serial and USB based UPS equipment))
271 318
 
272 319
 CONFIGURE_ARGS += \
273
-	--$(if $(CONFIG_NUT_DRIVER_SERIAL),with,without)-serial \
320
+	--sysconfdir=/etc/nut \
321
+	--datadir=/usr/share/nut \
322
+	--with-dev \
274 323
 	--$(if $(CONFIG_NUT_DRIVER_USB),with,without)-usb \
324
+	--without-avahi \
275 325
 	--$(if $(CONFIG_NUT_DRIVER_SNMP),with,without)-snmp \
276 326
 	--without-neon \
277 327
 	--without-powerman \
278 328
 	--without-ipmi \
279 329
 	--without-freeipmi \
280 330
 	--$(if $(CONFIG_NUT_SSL),with,without)-ssl $(if $(CONFIG_NUT_SSL),--with-openssl) \
281
-	--without-avahi \
282 331
 	--without-libltdl \
283
-	--with-user=root \
284
-	--with-group=root \
285
-	--sysconfdir=/etc/nut \
286
-	--with-drvpath=/lib/nut \
332
+	--$(if $(CONFIG_PACKAGE_nut-web-cgi),with,without)-cgi \
287 333
 	--with-statepath=/var/run \
288
-	--datadir=/usr/share/nut
334
+	--with-drvpath=/lib/nut \
335
+	--with-cgipath=/usr/share/www/cgi-bin/nut \
336
+	--with-htmlpath=/usr/share/www/nut \
337
+	--with-user=root \
338
+	--with-group=root
339
+
340
+define Build/InstallDev
341
+	$(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig
342
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib/
343
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
344
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig/
345
+endef
289 346
 
290 347
 $(eval $(call BuildPackage,nut))
348
+$(eval $(call BuildPackage,nut-web-cgi))
349
+$(eval $(call BuildPackage,nut-avahi-service))
291 350
 $(foreach d,$(filter-out $(SERIAL_DRIVERLIST_IGNORE),$(SERIAL_DRIVERLIST)),$(eval $(call BuildPackage,nut-driver-$(d))))
292 351
 $(foreach d,$(SNMP_DRIVERLIST),$(eval $(call BuildPackage,nut-driver-$(d))))
293 352
 $(foreach d,$(USB_LIBUSB_DRIVERLIST),$(eval $(call BuildPackage,nut-driver-$(d))))

+ 34
- 0
net/nut/files/nut.service 파일 보기

@@ -0,0 +1,34 @@
1
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
2
+<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
3
+
4
+<!--
5
+  This file is part of NUT - Network UPS Tools
6
+
7
+  NUT is free software; you can redistribute it and/or modify it
8
+  under the terms of the GNU Lesser General Public License as
9
+  published by the Free Software Foundation; either version 2 of the
10
+  License, or (at your option) any later version.
11
+
12
+  NUT is distributed in the hope that it will be useful, but
13
+  WITHOUT ANY WARRANTY; without even the implied warranty of
14
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+  General Public License for more details.
16
+
17
+  You should have received a copy of the GNU Lesser General Public
18
+  License along with NUT; if not, write to the Free Software
19
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20
+  02111-1307 USA.
21
+-->
22
+
23
+<!-- See avahi.service(5) for more information about this configuration file -->
24
+
25
+<service-group>
26
+
27
+  <name replace-wildcards="yes">%h</name>
28
+
29
+  <service>
30
+    <type>_nut._tcp</type>
31
+    <port>3493</port>
32
+  </service>
33
+
34
+</service-group>