2 # - upsdrvctl (used by ups.init) doesn't recognize status and reload commands
5 %bcond_without usb # build without usb drivers
6 %bcond_without snmp # build without snmp driver
7 %bcond_without cgi # build without cgi support
8 %bcond_without neon # build with neon based XML/HTTP driver
10 Summary: Network UPS Tools
11 Summary(pl.UTF-8): Sieciowe narzędzie do UPS-ów
16 Group: Applications/System
17 Source0: http://www.networkupstools.org/source/2.7/%{name}-%{version}.tar.gz
18 # Source0-md5: 3ba53656933d7471f95140b32a5b8d5c
20 Source2: %{name}.sysconfig
21 Source3: %{name}-upsmon.init
22 Source4: %{name}.sysconfig.upsmon
23 Patch0: %{name}-client.patch
24 Patch1: %{name}-config.patch
25 Patch2: %{name}-smartdp-load.patch
26 Patch3: %{name}-upssched-cmd-sysconf.patch
27 Patch4: %{name}-matrix.patch
28 Patch5: systemd-sysconfig.patch
29 Patch6: bcmxcp-off-by-one.patch
30 Patch7: %{name}-build.patch
31 URL: http://www.networkupstools.org/
32 BuildRequires: autoconf
33 BuildRequires: automake
34 BuildRequires: avahi-devel
35 BuildRequires: freeipmi-devel
36 %{?with_cgi:BuildRequires: gd-devel >= 2.0.15}
37 BuildRequires: libltdl-devel
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.647
46 Requires: systemd-units >= 38
47 Requires(post,preun): /sbin/chkconfig
48 Requires: %{name}-common = %{version}-%{release}
51 Obsoletes: smartupstools
52 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
54 %define _sysconfdir /etc/ups
55 %define _udevrulesdir /etc/udev/rules.d
58 These programs are part of a developing project to monitor the
59 assortment of UPSes that are found out there in the field. Many models
60 have serial serial ports of some kind that allow some form of state
61 checking. This capability has been harnessed where possible to allow
62 for safe shutdowns, live status tracking on web pages, and more.
64 %description -l pl.UTF-8
65 Te programy są częścią projektu do monitorowania wielu UPS-ów w jakimś
66 otoczeniu. Wiele modeli ma porty szeregowe i pozwala na jakąś formę
67 sprawdzania stanu. Ta funkcjonalność pozwala na bezpieczne
68 zatrzymywanie systemów, sprawdzanie stanu zasilania przez WWW i inne.
70 %description -l ru.UTF-8
71 Эти программы - часть проекта по мониторингу различных UPS. У многих
72 моделей есть сериальные порты, позволяющие проверять состояние этих
73 UPS. Эта возможность была использована, где это возможно, для
74 выполнения безопасных остановов компьютеров, отслеживания статуса
77 %description -l uk.UTF-8
78 Ці програми є частиною проекту по моніторингу різноманітних UPS.
79 Багато моделей мають серіальні порти, що дозволять перевіряти стан цих
80 UPS. Ця можливість була використана, де це можливо, для виконання
81 безпечних зупинок комп'ютерів, відслідковування статусу через веб,
85 Summary: Package with common files for nut daemon and its clients
86 Summary(pl.UTF-8): Pakiet z plikami wspólnymi dla demona nut i jego klientów
87 Group: Applications/System
88 Requires(postun): /usr/sbin/groupdel
89 Requires(postun): /usr/sbin/userdel
90 Requires(pre): /bin/id
91 Requires(pre): /usr/bin/getgid
92 Requires(pre): /usr/sbin/groupadd
93 Requires(pre): /usr/sbin/groupmod
94 Requires(pre): /usr/sbin/useradd
99 Package with common files for nut daemon and its clients.
101 %description common -l pl.UTF-8
102 Pakiet z plikami wspólnymi dla demona nut i jego klientów.
105 Summary: Multi-vendor UPS Monitoring Project Client Utilities
106 Summary(pl.UTF-8): Narzędzia klienckie do monitorowania UPS-ów
107 Summary(ru.UTF-8): Network UPS Tools - клиентские утилиты мониторинга
108 Summary(uk.UTF-8): Network UPS Tools - клієнтські утиліти моніторингу
109 Group: Applications/System
110 Requires(post,preun): /sbin/chkconfig
111 Requires: %{name}-common = %{version}-%{release}
113 Requires: systemd-units >= 38
116 This package includes the client utilities that are required to
117 monitor a UPS that the client host is plugged into but monitored via
118 serial cable by another host on the network....
120 %description client -l pl.UTF-8
121 Ten pakiet zawiera narzędzia kliencie potrzebne do monitorowania UPS-a
122 do którego podłączony jest komputer kliencki, kiedy kabel szeregowy
123 UPS-a jest podłączony do innego komputera w sieci.
125 %description client -l ru.UTF-8
126 Этот пакет включает клиентские утилиты, необходимые для мониторинга
127 UPS, к которому клиентский хост имеет доступ, но UPS физически
128 подключен к другому компьютеру в сети.
130 %description client -l uk.UTF-8
131 Цей пакет включає клієнтські утиліти, потрібні для моніторингу UPS, до
132 якого клієнтський хост має доступ, але UPS фізично підключений до
133 іншого комп'ютеру в мережі.
136 Summary: Multi-vendor UPS Monitoring Project Server - CGI utils
137 Summary(pl.UTF-8): Narzędzia CGI do monitorowania UPS-ów
138 Summary(ru.UTF-8): Network UPS Tools - CGI утилиты
139 Summary(uk.UTF-8): Network UPS Tools - CGI утиліти
140 Group: Applications/System
141 Requires: %{name}-common = %{version}-%{release}
144 These programs are part of a developing project to monitor the
145 assortment of UPSes that are found out there in the field. Many models
146 have serial serial ports of some kind that allow some form of state
147 checking. This capability has been harnessed where possible to allow
148 for safe shutdowns, live status tracking on web pages, and more. This
149 package contains CGI utils.
151 %description cgi -l pl.UTF-8
152 Te programy są częścią projektu do monitorowania wielu UPS-ów w jakimś
153 otoczeniu. Wiele modeli ma porty szeregowe i pozwala na jakąś formę
154 sprawdzania stanu. Ta funkcjonalność pozwala na bezpieczne
155 zatrzymywanie systemów, sprawdzanie stanu zasilania przez WWW i inne.
156 Ten pakiet zawiera narzędzia CGI.
158 %description cgi -l ru.UTF-8
159 Этот пакет включает CGI программы для доступа к информации о статусе
160 UPS через веб-интерфейс.
162 %description cgi -l uk.UTF-8
163 Цей пакет включає CGI програми для доступу до інформації про статус
164 UPS через веб-інтерфейс.
167 Summary: Files for NUT clients development
168 Summary(pl.UTF-8): Pliki do tworzenia klientów NUT-a
169 Group: Development/Libraries
170 Requires: %{name}-common = %{version}-%{release}
171 Requires: openssl-devel >= 0.9.7c
174 Object file and header for developing NUT clients.
176 %description devel -l pl.UTF-8
177 Plik wynikowy oraz nagłówek służące do tworzenia klientów NUT-a.
191 cp -f /usr/share/automake/config.sub .
197 --datadir=%{_datadir}/%{name} \
198 --with-htmlpath=%{_datadir}/%{name}/html \
200 --with%{!?with_usb:out}-usb \
201 --with%{!?with_snmp:out}-snmp \
202 --with%{!?with_cgi:out}-cgi \
206 --with%{!?with_neon:out}-neon \
209 %{?with_usb:--with-udev-dir=/etc/udev} \
210 --with-statepath=%{_var}/lib/ups \
211 --with-drvpath=/lib/nut \
212 --with-cgipath=/home/services/httpd/cgi-bin \
213 --with-systemdsystemunitdir=%{systemdunitdir} \
220 rm -rf $RPM_BUILD_ROOT
221 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},/var/lib/ups,/lib/nut,/sbin}
224 DESTDIR=$RPM_BUILD_ROOT
226 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/ups
227 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/ups
228 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/upsmon
229 install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/upsmon
231 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/ups.service
232 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/upsmon.service
234 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.sample; do
235 mv -f $i ${i%.sample}
238 %{!?with_usb:rm -f $RPM_BUILD_ROOT%{_udevrulesdir}/62-nut-usbups.rules}
240 cat > $RPM_BUILD_ROOT/sbin/poweroff-ups << EOF
242 echo "Switching the power off"
243 /lib/nut/upsdrvctl shutdown
247 %{__rm} $RPM_BUILD_ROOT%{_libdir}/*.la
250 rm -rf $RPM_BUILD_ROOT
254 /sbin/chkconfig --add ups
255 %service ups restart "NUT ups daemon"
256 %systemd_post nut-driver.service nut-server.service
259 if [ "$1" = "0" ]; then
261 /sbin/chkconfig --del ups
263 %systemd_preun nut-driver.service nut-server.service
269 %triggerpostun -- nut < 2.6.4-2
270 [ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
271 [ ${RPM_ENABLE_SYSTEMD_SERVICE:-yes} = no ] && exit 0
272 [ "$(echo /etc/rc.d/rc[0-6].d/S[0-9][0-9]ups)" != "/etc/rc.d/rc[0-6].d/S[0-9][0-9]ups" ] || exit 0
273 %systemd_service_enable nut-driver.service nut-server.service
277 if [ -n "`/usr/bin/getgid ups 2> /dev/null`" ] && [ "`/usr/bin/getgid ups 2> /dev/null`" = 121 ]; then
278 /usr/sbin/groupmod -g 76 ups
279 chgrp ups %{_sysconfdir}/{upsd.conf,ups.conf,upsd.users}
280 /usr/sbin/usermod -g 76 ups
283 %useradd -u 70 -d /usr/share/empty -s /bin/false -c "UPS Manager User" -g ups ups
285 %post common -p /sbin/ldconfig
289 if [ "$1" = "0" ]; then
295 /sbin/chkconfig --add upsmon
296 %service upsmon restart "NUT upsmon daemon"
297 %systemd_post nut-monitor.service
300 if [ "$1" = "0" ]; then
302 /sbin/chkconfig --del upsmon
304 %systemd_preun nut-monitor.service
309 %triggerpostun client -- nut-client < 2.6.4-2
310 [ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
311 [ ${RPM_ENABLE_SYSTEMD_SERVICE:-yes} = no ] && exit 0
312 /sbin/chkconfig --list upsmon 2>/dev/null | grep -qsv "[0-6]:on" && exit 0
313 [ "$(echo /etc/rc.d/rc[0-6].d/S[0-9][0-9]upsmon)" != "/etc/rc.d/rc[0-6].d/S[0-9][0-9]upsmon" ] || exit 0
314 %systemd_service_enable nut-monitor.service
317 %defattr(644,root,root,755)
318 %attr(755,root,root) %{_bindir}/nut-scanner
319 %attr(755,root,root) %{_bindir}/upscmd
320 %attr(755,root,root) %{_bindir}/upslog
321 %attr(755,root,root) %{_bindir}/upsrw
322 %attr(755,root,root) %{_sbindir}/upsd
323 %attr(755,root,root) %{_sbindir}/upsdrvctl
324 %attr(755,root,root) /sbin/poweroff-ups
325 %attr(755,root,root) %ghost %{_libdir}/libnutscan.so.1
326 %attr(755,root,root) %{_libdir}/libnutscan.so.*.*.*
327 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ups
328 %attr(754,root,root) /etc/rc.d/init.d/ups
329 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nut.conf
330 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsd.conf
331 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ups.conf
332 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsd.users
333 %{systemdunitdir}/nut-driver.service
334 %{systemdunitdir}/nut-server.service
335 %{systemdunitdir}/ups.service
336 %{_mandir}/man5/ups.conf.5*
337 %{_mandir}/man5/upsd.conf.5*
338 %{_mandir}/man5/upsd.users.5*
339 %{_mandir}/man8/nut-recorder.8*
340 %{_mandir}/man8/nut-scanner.8*
341 %{_mandir}/man8/upscmd.8*
342 %{_mandir}/man8/upscode2.8*
343 %{_mandir}/man8/upsd.8*
344 %{_mandir}/man8/upsdrvctl.8*
345 %{_mandir}/man8/upslog.8*
346 %{_mandir}/man8/upsrw.8*
347 %dir %attr(770,root,ups) /var/lib/ups
349 %attr(755,root,root) /lib/nut/al175
350 %attr(755,root,root) /lib/nut/apcsmart
351 %attr(755,root,root) /lib/nut/apcsmart-old
352 %attr(755,root,root) /lib/nut/apcupsd-ups
353 %attr(755,root,root) /lib/nut/bcmxcp
354 %{?with_usb:%attr(755,root,root) /lib/nut/bcmxcp_usb}
355 %attr(755,root,root) /lib/nut/belkin
356 %attr(755,root,root) /lib/nut/belkinunv
357 %attr(755,root,root) /lib/nut/bestfcom
358 %attr(755,root,root) /lib/nut/bestfortress
359 %attr(755,root,root) /lib/nut/bestuferrups
360 %attr(755,root,root) /lib/nut/bestups
361 %attr(755,root,root) /lib/nut/blazer_ser
362 %{?with_usb:%attr(755,root,root) /lib/nut/blazer_usb}
363 %attr(755,root,root) /lib/nut/clone
364 %attr(755,root,root) /lib/nut/clone-outlet
365 %attr(755,root,root) /lib/nut/dummy-ups
366 %attr(755,root,root) /lib/nut/etapro
367 %attr(755,root,root) /lib/nut/everups
368 %attr(755,root,root) /lib/nut/gamatronic
369 %attr(755,root,root) /lib/nut/genericups
370 %attr(755,root,root) /lib/nut/isbmex
371 %attr(755,root,root) /lib/nut/ivtscd
372 %attr(755,root,root) /lib/nut/liebert
373 %attr(755,root,root) /lib/nut/liebert-esp2
374 %attr(755,root,root) /lib/nut/masterguard
375 %attr(755,root,root) /lib/nut/metasys
376 %attr(755,root,root) /lib/nut/mge-shut
377 %attr(755,root,root) /lib/nut/mge-utalk
378 %attr(755,root,root) /lib/nut/microdowell
379 %{?with_neon:%attr(755,root,root) /lib/nut/netxml-ups}
380 %{?with_usb:%attr(755,root,root) /lib/nut/nutdrv_atcl_usb}
381 %attr(755,root,root) /lib/nut/nutdrv_qx
382 %attr(755,root,root) /lib/nut/nut-ipmipsu
383 %attr(755,root,root) /lib/nut/oldmge-shut
384 %attr(755,root,root) /lib/nut/oneac
385 %attr(755,root,root) /lib/nut/optiups
386 %attr(755,root,root) /lib/nut/powercom
387 %attr(755,root,root) /lib/nut/powerpanel
388 %attr(755,root,root) /lib/nut/rhino
389 %{?with_usb:%attr(755,root,root) /lib/nut/richcomm_usb}
390 %attr(755,root,root) /lib/nut/riello_ser
391 %{?with_usb:%attr(755,root,root) /lib/nut/riello_usb}
392 %attr(755,root,root) /lib/nut/safenet
393 %attr(755,root,root) /lib/nut/skel
394 %{?with_snmp:%attr(755,root,root) /lib/nut/snmp-ups}
395 %attr(755,root,root) /lib/nut/solis
396 %attr(755,root,root) /lib/nut/tripplite
397 %attr(755,root,root) /lib/nut/tripplitesu
398 %{?with_usb:%attr(755,root,root) /lib/nut/tripplite_usb}
399 %attr(755,root,root) /lib/nut/upscode2
400 %{?with_usb:%attr(755,root,root) /lib/nut/usbhid-ups}
401 %attr(755,root,root) /lib/nut/victronups
403 %{_datadir}/nut/cmdvartab
404 %{_datadir}/nut/driver.list
405 %{_mandir}/man5/nut.conf.5*
406 %{_mandir}/man8/al175.8*
407 %{_mandir}/man8/apcsmart.8*
408 %{_mandir}/man8/apcsmart-old.8*
409 %{_mandir}/man8/apcupsd-ups.8*
410 %{_mandir}/man8/bcmxcp.8*
411 %{?with_usb:%{_mandir}/man8/bcmxcp_usb.8*}
412 %{_mandir}/man8/belkin.8*
413 %{_mandir}/man8/belkinunv.8*
414 %{_mandir}/man8/bestfcom.8*
415 %{_mandir}/man8/bestfortress.8*
416 %{_mandir}/man8/bestuferrups.8*
417 %{_mandir}/man8/bestups.8*
418 %{_mandir}/man8/blazer_ser.8*
419 %{?with_usb:%{_mandir}/man8/blazer_usb.8*}
420 %{_mandir}/man8/clone.8*
421 %{_mandir}/man8/dummy-ups.8*
422 %{_mandir}/man8/etapro.8*
423 %{_mandir}/man8/everups.8*
424 %{_mandir}/man8/gamatronic.8*
425 %{_mandir}/man8/genericups.8*
426 %{_mandir}/man8/isbmex.8*
427 %{_mandir}/man8/ivtscd.8*
428 %{_mandir}/man8/liebert.8*
429 %{_mandir}/man8/liebert-esp2.8*
430 %{_mandir}/man8/masterguard.8*
431 %{_mandir}/man8/metasys.8*
432 %{_mandir}/man8/mge-shut.8*
433 %{_mandir}/man8/mge-utalk.8*
434 %{_mandir}/man8/microdowell.8*
435 %{?with_neon:%{_mandir}/man8/netxml-ups.8*}
436 %{?with_usb:%{_mandir}/man8/nutdrv_atcl_usb.8*}
437 %{_mandir}/man8/nutdrv_qx.8*
438 %{_mandir}/man8/nut-ipmipsu.8*
439 %{_mandir}/man8/nutupsdrv.8*
440 %{_mandir}/man8/oneac.8*
441 %{_mandir}/man8/optiups.8*
442 %{_mandir}/man8/powercom.8*
443 %{_mandir}/man8/powerpanel.8*
444 %{_mandir}/man8/rhino.8*
445 %{?with_usb:%{_mandir}/man8/richcomm_usb.8*}
446 %{_mandir}/man8/riello_ser.8*
447 %{?with_usb:%{_mandir}/man8/riello_usb.8*}
448 %{_mandir}/man8/safenet.8*
449 %{?with_snmp:%{_mandir}/man8/snmp-ups.8*}
450 %{_mandir}/man8/solis.8*
451 %{_mandir}/man8/tripplite.8*
452 %{_mandir}/man8/tripplitesu.8*
453 %{?with_usb:%{_mandir}/man8/tripplite_usb.8*}
454 %{?with_usb:%{_mandir}/man8/usbhid-ups.8*}
455 %{_mandir}/man8/victronups.8*
456 %{?with_usb:%config(noreplace) %verify(not md5 mtime size) %{_udevrulesdir}/62-nut-usbups.rules}
457 %config(noreplace) %verify(not md5 mtime size) %{_udevrulesdir}/52-nut-ipmipsu.rules
460 %defattr(644,root,root,755)
461 %doc AUTHORS MAINTAINERS NEWS README UPGRADING ChangeLog docs
463 %attr(755,root,root) %ghost %{_libdir}/libnutclient.so.0
464 %attr(755,root,root) %{_libdir}/libnutclient.so.*.*.*
465 %attr(755,root,root) %ghost %{_libdir}/libupsclient.so.4
466 %attr(755,root,root) %{_libdir}/libupsclient.so.*.*.*
469 %defattr(644,root,root,755)
470 %attr(755,root,root) %{_bindir}/upsc
471 %attr(755,root,root) %{_sbindir}/upsmon
472 %attr(755,root,root) %{_sbindir}/upssched
473 %attr(754,root,root) /etc/rc.d/init.d/upsmon
474 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsmon.conf
475 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upssched.conf
476 %attr(750,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upssched-cmd
477 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/upsmon
478 /lib/systemd/system-shutdown/nutshutdown
479 %{systemdunitdir}/nut-monitor.service
480 %{systemdunitdir}/upsmon.service
481 %{_mandir}/man5/upsmon.conf.5*
482 %{_mandir}/man5/upssched.conf.5*
483 %{_mandir}/man8/upsc.8*
484 %{_mandir}/man8/upsmon.8*
485 %{_mandir}/man8/upssched.8*
489 %defattr(644,root,root,755)
490 %{_datadir}/%{name}/html
491 %attr(755,root,root) /home/services/httpd/cgi-bin/*.cgi
492 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/hosts.conf
493 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsset.conf
494 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.html
495 %{_mandir}/man5/hosts.conf.5*
496 %{_mandir}/man5/upsset.conf.5*
497 %{_mandir}/man5/upsstats.html.5*
498 %{_mandir}/man8/upsimage.cgi.8*
499 %{_mandir}/man8/upsset.cgi.8*
500 %{_mandir}/man8/upsstats.cgi.8*
504 %defattr(644,root,root,755)
505 %attr(755,root,root) %{_libdir}/libnutclient.so
506 %attr(755,root,root) %{_libdir}/libupsclient.so
507 %attr(755,root,root) %{_libdir}/libnutscan.so
508 %{_pkgconfigdir}/libnutclient.pc
509 %{_pkgconfigdir}/libnutscan.pc
510 %{_pkgconfigdir}/libupsclient.pc