]> git.pld-linux.org Git - packages/nut.git/blob - nut.spec
- release 5
[packages/nut.git] / nut.spec
1 # TODO:
2 #       - upsdrvctl (used by ups.init) doesn't recognize status and reload commands
3 #       - test that hal-stuff
4 #
5 # Conditional build:
6 %bcond_without  usb                     # build without usb drivers
7 %bcond_without  hal                     # build without hal support
8 %bcond_without  snmp                    # build without snmp driver
9 %bcond_without  cgi                     # build without cgi support
10 %bcond_without  neon                    # build with neon based XML/HTTP driver
11 #
12 Summary:        Network UPS Tools
13 Summary(pl.UTF-8):      Sieciowe narzędzie do UPS-ów
14 Name:           nut
15 Version:        2.2.2
16 Release:        5
17 License:        GPL
18 Group:          Applications/System
19 Source0:        http://eu1.networkupstools.org/source/2.2/%{name}-%{version}.tar.gz
20 # Source0-md5:  677a84a83e9be7bc93610413ee696375
21 Source1:        %{name}.init
22 Source2:        %{name}.sysconfig
23 Source3:        %{name}-upsmon.init
24 Source4:        %{name}.sysconfig.upsmon
25 Patch0:         %{name}-client.patch
26 Patch1:         %{name}-config.patch
27 Patch2:         %{name}-smartdp-load.patch
28 Patch3:         %{name}-upssched-cmd-sysconf.patch
29 Patch4:         %{name}-as-needed.patch
30 Patch5:         %{name}-hal-paths.patch
31 Patch6:         %{name}-matrix.patch
32 URL:            http://www.networkupstools.org/
33 BuildRequires:  autoconf
34 BuildRequires:  automake
35 %{?with_hal:BuildRequires:      dbus-glib-devel}
36 %{?with_cgi:BuildRequires:      gd-devel >= 2.0.15}
37 %{?with_hal:BuildRequires:      hal-devel >= 0.5.8}
38 BuildRequires:  libtool
39 %{?with_usb:BuildRequires:      libusb-devel}
40 %{?with_neon:BuildRequires:     neon-devel}
41 %{?with_snmp:BuildRequires:     net-snmp-devel}
42 BuildRequires:  openssl-devel >= 0.9.7d
43 BuildRequires:  rpmbuild(macros) >= 1.268
44 Requires(post,preun):   /sbin/chkconfig
45 Requires:       %{name}-common = %{version}-%{release}
46 Requires:       rc-scripts
47 Obsoletes:      smartupstools
48 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49
50 %define         _sysconfdir     /etc/ups
51 %define         _udevrulesdir   /etc/udev/rules.d
52
53 %description
54 These programs are part of a developing project to monitor the
55 assortment of UPSes that are found out there in the field. Many models
56 have serial serial ports of some kind that allow some form of state
57 checking. This capability has been harnessed where possible to allow
58 for safe shutdowns, live status tracking on web pages, and more.
59
60 %description -l pl.UTF-8
61 Te programy są częścią projektu do monitorowania wielu UPS-ów w jakimś
62 otoczeniu. Wiele modeli ma porty szeregowe i pozwala na jakąś formę
63 sprawdzania stanu. Ta funkcjonalność pozwala na bezpieczne
64 zatrzymywanie systemów, sprawdzanie stanu zasilania przez WWW i inne.
65
66 %description -l ru.UTF-8
67 Эти программы - часть проекта по мониторингу различных UPS. У многих
68 моделей есть сериальные порты, позволяющие проверять состояние этих
69 UPS. Эта возможность была использована, где это возможно, для
70 выполнения безопасных остановов компьютеров, отслеживания статуса
71 через веб и т.п.
72
73 %description -l uk.UTF-8
74 Ці програми є частиною проекту по моніторингу різноманітних UPS.
75 Багато моделей мають серіальні порти, що дозволять перевіряти стан цих
76 UPS. Ця можливість була використана, де це можливо, для виконання
77 безпечних зупинок комп'ютерів, відслідковування статусу через веб,
78 тощо.
79
80 %package common
81 Summary:        Package with common files for nut daemon and its clients
82 Summary(pl.UTF-8):      Pakiet z plikami wspólnymi dla demona nut i jego klientów
83 Group:          Applications/System
84 Requires(postun):       /usr/sbin/groupdel
85 Requires(postun):       /usr/sbin/userdel
86 Requires(pre):  /bin/id
87 Requires(pre):  /usr/bin/getgid
88 Requires(pre):  /usr/sbin/groupadd
89 Requires(pre):  /usr/sbin/groupmod
90 Requires(pre):  /usr/sbin/useradd
91 Provides:       group(ups)
92 Provides:       user(ups)
93
94 %description common
95 Package with common files for nut daemon and its clients.
96
97 %description common -l pl.UTF-8
98 Pakiet z plikami wspólnymi dla demona nut i jego klientów.
99
100 %package client
101 Summary:        Multi-vendor UPS Monitoring Project Client Utilities
102 Summary(pl.UTF-8):      Narzędzia klienckie do monitorowania UPS-ów
103 Summary(ru.UTF-8):      Network UPS Tools - клиентские утилиты мониторинга
104 Summary(uk.UTF-8):      Network UPS Tools - клієнтські утиліти моніторингу
105 Group:          Applications/System
106 Requires(post,preun):   /sbin/chkconfig
107 Requires:       %{name}-common = %{version}-%{release}
108 Requires:       rc-scripts
109
110 %description client
111 This package includes the client utilities that are required to
112 monitor a UPS that the client host is plugged into but monitored via
113 serial cable by another host on the network....
114
115 %description client -l pl.UTF-8
116 Ten pakiet zawiera narzędzia kliencie potrzebne do monitorowania UPS-a
117 do którego podłączony jest komputer kliencki, kiedy kabel szeregowy
118 UPS-a jest podłączony do innego komputera w sieci.
119
120 %description client -l ru.UTF-8
121 Этот пакет включает клиентские утилиты, необходимые для мониторинга
122 UPS, к которому клиентский хост имеет доступ, но UPS физически
123 подключен к другому компьютеру в сети.
124
125 %description client -l uk.UTF-8
126 Цей пакет включає клієнтські утиліти, потрібні для моніторингу UPS, до
127 якого клієнтський хост має доступ, але UPS фізично підключений до
128 іншого комп'ютеру в мережі.
129
130 %package cgi
131 Summary:        Multi-vendor UPS Monitoring Project Server - CGI utils
132 Summary(pl.UTF-8):      Narzędzia CGI do monitorowania UPS-ów
133 Summary(ru.UTF-8):      Network UPS Tools - CGI утилиты
134 Summary(uk.UTF-8):      Network UPS Tools - CGI утиліти
135 Group:          Applications/System
136 Requires:       %{name}-common = %{version}-%{release}
137
138 %description cgi
139 These programs are part of a developing project to monitor the
140 assortment of UPSes that are found out there in the field. Many models
141 have serial serial ports of some kind that allow some form of state
142 checking. This capability has been harnessed where possible to allow
143 for safe shutdowns, live status tracking on web pages, and more. This
144 package contains CGI utils.
145
146 %description cgi -l pl.UTF-8
147 Te programy są częścią projektu do monitorowania wielu UPS-ów w jakimś
148 otoczeniu. Wiele modeli ma porty szeregowe i pozwala na jakąś formę
149 sprawdzania stanu. Ta funkcjonalność pozwala na bezpieczne
150 zatrzymywanie systemów, sprawdzanie stanu zasilania przez WWW i inne.
151 Ten pakiet zawiera narzędzia CGI.
152
153 %description cgi -l ru.UTF-8
154 Этот пакет включает CGI программы для доступа к информации о статусе
155 UPS через веб-интерфейс.
156
157 %description cgi -l uk.UTF-8
158 Цей пакет включає CGI програми для доступу до інформації про статус
159 UPS через веб-інтерфейс.
160
161 %package devel
162 Summary:        Files for NUT clients development
163 Summary(pl.UTF-8):      Pliki do tworzenia klientów NUT-a
164 Group:          Development/Libraries
165 Requires:       openssl-devel >= 0.9.7c
166 Requires:       %{name}-common = %{version}-%{release}
167
168 %description devel
169 Object file and header for developing NUT clients.
170
171 %description devel -l pl.UTF-8
172 Plik wynikowy oraz nagłówek służące do tworzenia klientów NUT-a.
173
174 %package hal
175 Summary:        NUT integration with FreeDesktop HAL
176 Summary(pl.UTF-8):      Pliki do integracji NUT-a z HAL-em
177 Group:          Development/Libraries
178 Requires:       %{name} = %{version}-%{release}
179
180 %description hal
181 NUT integration with FreeDesktop HAL.
182
183 %description hal -l pl.UTF-8
184 Pliki do integracji NUT-a z HAL-em.
185
186 %prep
187 %setup -q
188 %patch0 -p1
189 %patch1 -p1
190 %patch2 -p1
191 %patch3 -p1
192 %patch4 -p1
193 %patch5 -p1
194 %patch6 -p1
195
196 %build
197 cp -f /usr/share/automake/config.sub .
198 %{__libtoolize}
199 %{__aclocal} -I m4
200 %{__automake}
201 %{__autoconf}
202 %configure \
203         --datadir=%{_datadir}/%{name} \
204         --with-htmlpath=%{_datadir}/%{name}/html \
205         --with-serial \
206         --with%{!?with_usb:out}-usb \
207         --with%{!?with_snmp:out}-snmp \
208         --with%{!?with_hal:out}-hal \
209         --with%{!?with_cgi:out}-cgi \
210         --with-dev \
211         --with%{!?with_neon:out}-neonxml \
212         --with-linux-hiddev=%{_includedir}/linux/hiddev.h \
213         --with-ssl \
214         --with-ipv6 \
215         %{?with_usb:--with-udev-dir=/etc/udev} \
216         %{?with_hal:--with-hal-callouts-path=%{_libdir}/hal} \
217         %{?with_hal:--with-hal-fdi-path=%{_datadir}/hal/fdi/information/20thirdparty} \
218         --with-statepath=%{_var}/lib/ups \
219         --with-drvpath=/lib/nut \
220         --with-cgipath=/home/services/httpd/cgi-bin \
221         --with-user=ups \
222         --with-group=ups
223
224 %{__make}
225
226 %install
227 rm -rf $RPM_BUILD_ROOT
228 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},/var/lib/ups,/lib/nut,/sbin}
229
230 %{__make} install \
231         DESTDIR=$RPM_BUILD_ROOT
232
233 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/ups
234 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/ups
235 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/upsmon
236 install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/upsmon
237
238 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.sample; do
239         mv -f $i ${i%.sample}
240 done
241
242 %if %{with usb}
243 mv -f $RPM_BUILD_ROOT%{_udevrulesdir}/52{_,-}nut-usbups.rules
244 %else
245 rm -f $RPM_BUILD_ROOT%{_udevrulesdir}/52_nut-usbups.rules
246 %endif
247
248 cat > $RPM_BUILD_ROOT/sbin/poweroff-ups << EOF
249 #!/bin/sh
250 /etc/rc.d/init.d/ups powerdown
251 EOF
252
253 %clean
254 rm -rf $RPM_BUILD_ROOT
255
256 %post
257 /sbin/chkconfig --add ups
258 %service ups restart "NUT ups daemon"
259
260 %preun
261 if [ "$1" = "0" ]; then
262         %service ups stop
263         /sbin/chkconfig --del ups
264 fi
265
266 %pre common
267 # move to trigger?
268 if [ -n "`/usr/bin/getgid ups`" ] && [ "`/usr/bin/getgid ups`" = 121 ]; then
269         /usr/sbin/groupmod -g 76 ups
270         chgrp ups %{_sysconfdir}/{upsd.conf,ups.conf,upsd.users}
271         /usr/sbin/usermod -g 76 ups
272 fi
273 %groupadd -g 76 ups
274 %useradd -u 70 -d /usr/share/empty -s /bin/false -c "UPS Manager User" -g ups ups
275
276 %post common -p /sbin/ldconfig
277
278 %postun common
279 /sbin/ldconfig
280 if [ "$1" = "0" ]; then
281         %userremove ups
282         %groupremove ups
283 fi
284
285 %post client
286 /sbin/chkconfig --add upsmon
287 %service upsmon restart "NUT upsmon daemon"
288
289 %preun client
290 if [ "$1" = "0" ]; then
291         %service upsmon stop
292         /sbin/chkconfig --del upsmon
293 fi
294
295 %files
296 %defattr(644,root,root,755)
297 %attr(755,root,root) %{_bindir}/upscmd
298 %attr(755,root,root) %{_bindir}/upslog
299 %attr(755,root,root) %{_bindir}/upsrw
300 %attr(755,root,root) %{_sbindir}/upsd
301 %attr(755,root,root) /sbin/poweroff-ups
302 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ups
303 %attr(754,root,root) /etc/rc.d/init.d/ups
304 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsd.conf
305 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ups.conf
306 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsd.users
307 %{_mandir}/man5/ups.conf.5*
308 %{_mandir}/man5/upsd.conf.5*
309 %{_mandir}/man5/upsd.users.5*
310 %{_mandir}/man8/upscmd.8*
311 %{_mandir}/man8/upscode2.8*
312 %{_mandir}/man8/upsd.8*
313 %{_mandir}/man8/upsdrvctl.8*
314 %{_mandir}/man8/upslog.8*
315 %{_mandir}/man8/upsrw.8*
316 %dir %attr(770,root,ups) /var/lib/ups
317 %dir /lib/nut
318 %attr(755,root,root) /lib/nut/al175
319 %attr(755,root,root) /lib/nut/apcsmart
320 %attr(755,root,root) /lib/nut/bcmxcp
321 %{?with_usb:%attr(755,root,root) /lib/nut/bcmxcp_usb}
322 %attr(755,root,root) /lib/nut/belkin
323 %attr(755,root,root) /lib/nut/belkinunv
324 %attr(755,root,root) /lib/nut/bestfcom
325 %attr(755,root,root) /lib/nut/bestuferrups
326 %attr(755,root,root) /lib/nut/bestups
327 %attr(755,root,root) /lib/nut/cpsups
328 %attr(755,root,root) /lib/nut/cyberpower
329 %attr(755,root,root) /lib/nut/dummy-ups
330 %{?with_usb:%attr(755,root,root) /lib/nut/energizerups}
331 %attr(755,root,root) /lib/nut/etapro
332 %attr(755,root,root) /lib/nut/everups
333 %attr(755,root,root) /lib/nut/gamatronic
334 %attr(755,root,root) /lib/nut/genericups
335 %attr(755,root,root) /lib/nut/isbmex
336 %attr(755,root,root) /lib/nut/liebert
337 %attr(755,root,root) /lib/nut/masterguard
338 %attr(755,root,root) /lib/nut/megatec
339 %{?with_usb:%attr(755,root,root) /lib/nut/megatec_usb}
340 %attr(755,root,root) /lib/nut/metasys
341 %attr(755,root,root) /lib/nut/mge-shut
342 %attr(755,root,root) /lib/nut/mge-utalk
343 %{?with_neon:%attr(755,root,root) /lib/nut/netxml-ups}
344 %attr(755,root,root) /lib/nut/newmge-shut
345 %attr(755,root,root) /lib/nut/nitram
346 %attr(755,root,root) /lib/nut/oneac
347 %attr(755,root,root) /lib/nut/optiups
348 %attr(755,root,root) /lib/nut/powercom
349 %attr(755,root,root) /lib/nut/powerpanel
350 %attr(755,root,root) /lib/nut/rhino
351 %attr(755,root,root) /lib/nut/safenet
352 %attr(755,root,root) /lib/nut/skel
353 %{?with_snmp:%attr(755,root,root) /lib/nut/snmp-ups}
354 %attr(755,root,root) /lib/nut/solis
355 %attr(755,root,root) /lib/nut/tripplite
356 %attr(755,root,root) /lib/nut/tripplitesu
357 %{?with_usb:%attr(755,root,root) /lib/nut/tripplite_usb}
358 %attr(755,root,root) /lib/nut/upscode2
359 %attr(755,root,root) /lib/nut/upsdrvctl
360 %{?with_usb:%attr(755,root,root) /lib/nut/usbhid-ups}
361 %attr(755,root,root) /lib/nut/victronups
362 %{_datadir}/nut
363 %{_mandir}/man8/al175.8*
364 %{_mandir}/man8/apcsmart.8*
365 %{_mandir}/man8/bcmxcp.8*
366 %{?with_usb:%{_mandir}/man8/bcmxcp_usb.8*}
367 %{_mandir}/man8/belkin.8*
368 %{_mandir}/man8/belkinunv.8*
369 %{_mandir}/man8/bestfcom.8*
370 %{_mandir}/man8/bestuferrups.8*
371 %{_mandir}/man8/bestups.8*
372 %{_mandir}/man8/cpsups.8*
373 %{_mandir}/man8/cyberpower.8*
374 %{_mandir}/man8/dummy-ups.8*
375 %{?with_usb:%{_mandir}/man8/energizerups.8*}
376 %{_mandir}/man8/etapro.8*
377 %{_mandir}/man8/everups.8*
378 %{_mandir}/man8/gamatronic.8*
379 %{_mandir}/man8/genericups.8*
380 %{_mandir}/man8/isbmex.8*
381 %{_mandir}/man8/liebert.8*
382 %{_mandir}/man8/masterguard.8*
383 %{_mandir}/man8/megatec.8*
384 %{?with_usb:%{_mandir}/man8/megatec_usb.8*}
385 %{_mandir}/man8/metasys.8*
386 %{_mandir}/man8/mge-shut.8*
387 %{_mandir}/man8/mge-utalk.8*
388 %{?with_neon:%{_mandir}/man8/netxml-ups.8*}
389 %{_mandir}/man8/nitram.8*
390 %{_mandir}/man8/nutupsdrv.8*
391 %{_mandir}/man8/oneac.8*
392 %{_mandir}/man8/optiups.8*
393 %{_mandir}/man8/powercom.8*
394 %{_mandir}/man8/powerpanel.8*
395 %{_mandir}/man8/rhino.8*
396 %{_mandir}/man8/safenet.8*
397 %{?with_snmp:%{_mandir}/man8/snmp-ups.8*}
398 %{_mandir}/man8/solis.8*
399 %{_mandir}/man8/tripplite.8*
400 %{_mandir}/man8/tripplitesu.8*
401 %{?with_usb:%{_mandir}/man8/tripplite_usb.8*}
402 %{?with_usb:%{_mandir}/man8/usbhid-ups.8*}
403 %{_mandir}/man8/victronups.8*
404 %{?with_usb:%config(noreplace) %verify(not md5 mtime size) %{_udevrulesdir}/52-nut-usbups.rules}
405
406 %files common
407 %defattr(644,root,root,755)
408 %doc AUTHORS MAINTAINERS NEWS README UPGRADING ChangeLog docs
409 %dir %{_sysconfdir}
410 %ghost %{_libdir}/libupsclient.so.1
411 %attr(755,root,root) %{_libdir}/libupsclient.so.*.*.*
412
413 %files client
414 %defattr(644,root,root,755)
415 %attr(755,root,root) %{_bindir}/upsc
416 %attr(755,root,root) %{_sbindir}/upsmon
417 %attr(755,root,root) %{_sbindir}/upssched
418 %attr(754,root,root) /etc/rc.d/init.d/upsmon
419 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsmon.conf
420 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upssched.conf
421 %attr(750,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upssched-cmd
422 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/upsmon
423 %{_mandir}/man5/upsmon.conf.5*
424 %{_mandir}/man5/upssched.conf.5*
425 %{_mandir}/man8/upsc.8*
426 %{_mandir}/man8/upsmon.8*
427 %{_mandir}/man8/upssched.8*
428
429 %if %{with cgi}
430 %files cgi
431 %defattr(644,root,root,755)
432 %{_datadir}/%{name}/html
433 %attr(755,root,root) /home/services/httpd/cgi-bin/*.cgi
434 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/hosts.conf
435 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsset.conf
436 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.html
437 %{_mandir}/man5/hosts.conf.5*
438 %{_mandir}/man5/upsset.conf.5*
439 %{_mandir}/man5/upsstats.html.5*
440 %{_mandir}/man8/upsimage.cgi.8*
441 %{_mandir}/man8/upsset.cgi.8*
442 %{_mandir}/man8/upsstats.cgi.8*
443 %endif
444
445 %if %{with hal}
446 %files hal
447 %defattr(644,root,root,755)
448 %attr(755,root,root) %{_libdir}/hal/hald-addon-bcmxcp_usb
449 %attr(755,root,root) %{_libdir}/hal/hald-addon-megatec_usb
450 %attr(755,root,root) %{_libdir}/hal/hald-addon-tripplite_usb
451 %attr(755,root,root) %{_libdir}/hal/hald-addon-usbhid-ups
452 %{_datadir}/hal/fdi/information/20thirdparty/20-ups-nut-device.fdi
453 %endif
454
455 %files devel
456 %defattr(644,root,root,755)
457 %attr(755,root,root) %{_libdir}/libupsclient.la
458 %attr(755,root,root) %{_libdir}/libupsclient.so
459 %{_pkgconfigdir}/*
460 %{_includedir}/*.h
461 %{_mandir}/man3/*.3*
This page took 0.084466 seconds and 3 git commands to generate.