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