2 # - upsdrvctl (used by ups.init) doesn't recognize status and reload commands
5 %bcond_without cgi # CGI support
6 %bcond_without freeipmi # IPMI support
7 %bcond_without i2c # I2C support
8 %bcond_without neon # neon based XML/HTTP driver
9 %bcond_without powerman # PowerMan support
10 %bcond_without snmp # SNMP driver
11 %bcond_without usb # USB drivers
13 Summary: Network UPS Tools
14 Summary(pl.UTF-8): Sieciowe narzędzie do UPS-ów
19 Group: Applications/System
20 Source0: http://www.networkupstools.org/source/2.7/%{name}-%{version}.tar.gz
21 # Source0-md5: 3ba53656933d7471f95140b32a5b8d5c
23 Source2: %{name}.sysconfig
24 Source3: %{name}-upsmon.init
25 Source4: %{name}.sysconfig.upsmon
26 Patch0: %{name}-client.patch
27 Patch1: %{name}-config.patch
28 Patch2: %{name}-smartdp-load.patch
29 Patch3: %{name}-upssched-cmd-sysconf.patch
30 Patch4: %{name}-matrix.patch
31 Patch5: systemd-sysconfig.patch
32 Patch6: bcmxcp-off-by-one.patch
33 Patch7: %{name}-build.patch
34 Patch8: %{name}-i2c.patch
36 URL: http://www.networkupstools.org/
37 BuildRequires: asciidoc >= 8.6.3
38 BuildRequires: autoconf >= 2.60
39 BuildRequires: automake
40 BuildRequires: avahi-devel >= 0.6.30
41 %{?with_freeipmi:BuildRequires: freeipmi-devel}
42 %{?with_cgi:BuildRequires: gd-devel >= 2.0.15}
43 %{?with_i2c:BuildRequires: libi2c-devel}
44 BuildRequires: libltdl-devel
45 BuildRequires: libstdc++-devel
46 BuildRequires: libtool
47 %{?with_usb:BuildRequires: libusb-compat-devel}
48 BuildRequires: libwrap-devel
49 BuildRequires: libxml2-progs >= 2
50 BuildRequires: libxslt-progs
51 %{?with_neon:BuildRequires: neon-devel >= 0.25.0}
52 %{?with_snmp:BuildRequires: net-snmp-devel}
53 BuildRequires: openssl-devel >= 0.9.7d
54 BuildRequires: pkgconfig
55 %{?with_powerman:BuildRequires: powerman-devel}
56 BuildRequires: rpmbuild(macros) >= 1.647
57 Requires: systemd-units >= 38
58 Requires(post,preun): /sbin/chkconfig
59 Requires: %{name}-common = %{version}-%{release}
62 Obsoletes: smartupstools
63 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
65 %define _sysconfdir /etc/ups
66 %define _udevrulesdir /etc/udev/rules.d
69 These programs are part of a developing project to monitor the
70 assortment of UPSes that are found out there in the field. Many models
71 have serial serial ports of some kind that allow some form of state
72 checking. This capability has been harnessed where possible to allow
73 for safe shutdowns, live status tracking on web pages, and more.
75 %description -l pl.UTF-8
76 Te programy są częścią projektu do monitorowania wielu UPS-ów w jakimś
77 otoczeniu. Wiele modeli ma porty szeregowe i pozwala na jakąś formę
78 sprawdzania stanu. Ta funkcjonalność pozwala na bezpieczne
79 zatrzymywanie systemów, sprawdzanie stanu zasilania przez WWW i inne.
81 %description -l ru.UTF-8
82 Эти программы - часть проекта по мониторингу различных UPS. У многих
83 моделей есть сериальные порты, позволяющие проверять состояние этих
84 UPS. Эта возможность была использована, где это возможно, для
85 выполнения безопасных остановов компьютеров, отслеживания статуса
88 %description -l uk.UTF-8
89 Ці програми є частиною проекту по моніторингу різноманітних UPS.
90 Багато моделей мають серіальні порти, що дозволять перевіряти стан цих
91 UPS. Ця можливість була використана, де це можливо, для виконання
92 безпечних зупинок комп'ютерів, відслідковування статусу через веб,
96 Summary: Package with common files for nut daemon and its clients
97 Summary(pl.UTF-8): Pakiet z plikami wspólnymi dla demona nut i jego klientów
98 Group: Applications/System
99 Requires(postun): /usr/sbin/groupdel
100 Requires(postun): /usr/sbin/userdel
101 Requires(pre): /bin/id
102 Requires(pre): /usr/bin/getgid
103 Requires(pre): /usr/sbin/groupadd
104 Requires(pre): /usr/sbin/groupmod
105 Requires(pre): /usr/sbin/useradd
110 Package with common files for nut daemon and its clients.
112 %description common -l pl.UTF-8
113 Pakiet z plikami wspólnymi dla demona nut i jego klientów.
116 Summary: Multi-vendor UPS Monitoring Project Client Utilities
117 Summary(pl.UTF-8): Narzędzia klienckie do monitorowania UPS-ów
118 Summary(ru.UTF-8): Network UPS Tools - клиентские утилиты мониторинга
119 Summary(uk.UTF-8): Network UPS Tools - клієнтські утиліти моніторингу
120 Group: Applications/System
121 Requires(post,preun): /sbin/chkconfig
122 Requires: %{name}-common = %{version}-%{release}
124 Requires: systemd-units >= 38
127 This package includes the client utilities that are required to
128 monitor a UPS that the client host is plugged into but monitored via
129 serial cable by another host on the network....
131 %description client -l pl.UTF-8
132 Ten pakiet zawiera narzędzia kliencie potrzebne do monitorowania UPS-a
133 do którego podłączony jest komputer kliencki, kiedy kabel szeregowy
134 UPS-a jest podłączony do innego komputera w sieci.
136 %description client -l ru.UTF-8
137 Этот пакет включает клиентские утилиты, необходимые для мониторинга
138 UPS, к которому клиентский хост имеет доступ, но UPS физически
139 подключен к другому компьютеру в сети.
141 %description client -l uk.UTF-8
142 Цей пакет включає клієнтські утиліти, потрібні для моніторингу UPS, до
143 якого клієнтський хост має доступ, але UPS фізично підключений до
144 іншого комп'ютеру в мережі.
147 Summary: Multi-vendor UPS Monitoring Project Server - CGI utils
148 Summary(pl.UTF-8): Narzędzia CGI do monitorowania UPS-ów
149 Summary(ru.UTF-8): Network UPS Tools - CGI утилиты
150 Summary(uk.UTF-8): Network UPS Tools - CGI утиліти
151 Group: Applications/System
152 Requires: %{name}-common = %{version}-%{release}
155 These programs are part of a developing project to monitor the
156 assortment of UPSes that are found out there in the field. Many models
157 have serial serial ports of some kind that allow some form of state
158 checking. This capability has been harnessed where possible to allow
159 for safe shutdowns, live status tracking on web pages, and more. This
160 package contains CGI utils.
162 %description cgi -l pl.UTF-8
163 Te programy są częścią projektu do monitorowania wielu UPS-ów w jakimś
164 otoczeniu. Wiele modeli ma porty szeregowe i pozwala na jakąś formę
165 sprawdzania stanu. Ta funkcjonalność pozwala na bezpieczne
166 zatrzymywanie systemów, sprawdzanie stanu zasilania przez WWW i inne.
167 Ten pakiet zawiera narzędzia CGI.
169 %description cgi -l ru.UTF-8
170 Этот пакет включает CGI программы для доступа к информации о статусе
171 UPS через веб-интерфейс.
173 %description cgi -l uk.UTF-8
174 Цей пакет включає CGI програми для доступу до інформації про статус
175 UPS через веб-інтерфейс.
178 Summary: Files for NUT clients development
179 Summary(pl.UTF-8): Pliki do tworzenia klientów NUT-a
180 Group: Development/Libraries
181 Requires: %{name}-common = %{version}-%{release}
182 Requires: openssl-devel >= 0.9.7c
185 Header files for developing NUT clients.
187 %description devel -l pl.UTF-8
188 Pliki nagłówkowe służące do tworzenia klientów NUT-a.
191 Summary: Static NUT libraries
192 Summary(pl.UTF-8): Statyczne biblioteki NUT-a
193 Group: Development/Libraries
194 Requires: %{name}-client = %{version}-%{release}
197 Static NUT libraries.
199 %description static -l pl.UTF-8
200 Statyczne biblioteki NUT-a.
221 export CXXFLAGS="%{rpmcxxflags} -std=c++11"
223 --datadir=%{_datadir}/%{name} \
224 --with-cgipath=/home/services/httpd/cgi-bin \
225 --with-drvpath=/lib/nut \
226 --with-htmlpath=%{_datadir}/%{name}/html \
227 --with-statepath=%{_var}/lib/ups \
228 --with-systemdsystemunitdir=%{systemdunitdir} \
229 %{?with_usb:--with-udev-dir=/etc/udev} \
233 --with-cgi%{!?with_cgi:=no} \
235 --with-ipmi%{!?with_freeipmi:=no} \
236 --with-linux-i2c%{!?with_i2c:=no} \
237 --with-neon%{!?with_neon:=no} \
239 --with-powerman%{!?with_powerman:=no} \
241 --with-snmp%{!?with_snmp:=no} \
243 --with-usb%{!?with_usb:=no}
248 rm -rf $RPM_BUILD_ROOT
249 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},/var/lib/ups,/lib/nut,/sbin}
252 DESTDIR=$RPM_BUILD_ROOT
254 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/ups
255 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/ups
256 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/upsmon
257 install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/upsmon
259 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/ups.service
260 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/upsmon.service
262 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.sample; do
263 %{__mv} $i ${i%.sample}
266 %{!?with_usb:%{__rm} $RPM_BUILD_ROOT%{_udevrulesdir}/62-nut-usbups.rules}
268 cat > $RPM_BUILD_ROOT/sbin/poweroff-ups << EOF
270 echo "Switching the power off"
271 /usr/sbin/upsdrvctl shutdown
275 %{__rm} $RPM_BUILD_ROOT%{_libdir}/*.la
278 rm -rf $RPM_BUILD_ROOT
282 /sbin/chkconfig --add ups
283 %service ups restart "NUT ups daemon"
284 %systemd_post nut-driver.service nut-server.service
287 if [ "$1" = "0" ]; then
289 /sbin/chkconfig --del ups
291 %systemd_preun nut-driver.service nut-server.service
297 %triggerpostun -- nut < 2.6.4-2
298 %systemd_trigger nut-driver.service nut-server.service
302 if [ -n "`/usr/bin/getgid ups 2> /dev/null`" ] && [ "`/usr/bin/getgid ups 2> /dev/null`" = 121 ]; then
303 /usr/sbin/groupmod -g 76 ups
304 chgrp ups %{_sysconfdir}/{upsd.conf,ups.conf,upsd.users}
305 /usr/sbin/usermod -g 76 ups
308 %useradd -u 70 -d /usr/share/empty -s /bin/false -c "UPS Manager User" -g ups ups
310 %post common -p /sbin/ldconfig
314 if [ "$1" = "0" ]; then
320 /sbin/chkconfig --add upsmon
321 %service upsmon restart "NUT upsmon daemon"
322 %systemd_post nut-monitor.service
325 if [ "$1" = "0" ]; then
327 /sbin/chkconfig --del upsmon
329 %systemd_preun nut-monitor.service
334 %triggerpostun client -- nut-client < 2.6.4-2
335 %systemd_trigger nut-monitor.service
338 %defattr(644,root,root,755)
339 %attr(755,root,root) %{_bindir}/nut-scanner
340 %attr(755,root,root) %{_bindir}/upscmd
341 %attr(755,root,root) %{_bindir}/upslog
342 %attr(755,root,root) %{_bindir}/upsrw
343 %attr(755,root,root) %{_sbindir}/upsd
344 %attr(755,root,root) %{_sbindir}/upsdrvctl
345 %attr(755,root,root) /sbin/poweroff-ups
346 %attr(755,root,root) %ghost %{_libdir}/libnutscan.so.1
347 %attr(755,root,root) %{_libdir}/libnutscan.so.*.*.*
348 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ups
349 %attr(754,root,root) /etc/rc.d/init.d/ups
350 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nut.conf
351 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsd.conf
352 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ups.conf
353 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsd.users
354 %{systemdunitdir}/nut-driver.service
355 %{systemdunitdir}/nut-server.service
356 %{systemdunitdir}/ups.service
357 %{_mandir}/man5/ups.conf.5*
358 %{_mandir}/man5/upsd.conf.5*
359 %{_mandir}/man5/upsd.users.5*
360 %{_mandir}/man8/nut-recorder.8*
361 %{_mandir}/man8/nut-scanner.8*
362 %{_mandir}/man8/upscmd.8*
363 %{_mandir}/man8/upscode2.8*
364 %{_mandir}/man8/upsd.8*
365 %{_mandir}/man8/upsdrvctl.8*
366 %{_mandir}/man8/upslog.8*
367 %{_mandir}/man8/upsrw.8*
368 %dir %attr(770,root,ups) /var/lib/ups
370 %attr(755,root,root) /lib/nut/al175
371 %attr(755,root,root) /lib/nut/apcsmart
372 %attr(755,root,root) /lib/nut/apcsmart-old
373 %attr(755,root,root) /lib/nut/apcupsd-ups
374 %{?with_i2c:%attr(755,root,root) /lib/nut/asem}
375 %attr(755,root,root) /lib/nut/bcmxcp
376 %{?with_usb:%attr(755,root,root) /lib/nut/bcmxcp_usb}
377 %attr(755,root,root) /lib/nut/belkin
378 %attr(755,root,root) /lib/nut/belkinunv
379 %attr(755,root,root) /lib/nut/bestfcom
380 %attr(755,root,root) /lib/nut/bestfortress
381 %attr(755,root,root) /lib/nut/bestuferrups
382 %attr(755,root,root) /lib/nut/bestups
383 %attr(755,root,root) /lib/nut/blazer_ser
384 %{?with_usb:%attr(755,root,root) /lib/nut/blazer_usb}
385 %attr(755,root,root) /lib/nut/clone
386 %attr(755,root,root) /lib/nut/clone-outlet
387 %attr(755,root,root) /lib/nut/dummy-ups
388 %attr(755,root,root) /lib/nut/etapro
389 %attr(755,root,root) /lib/nut/everups
390 %attr(755,root,root) /lib/nut/gamatronic
391 %attr(755,root,root) /lib/nut/genericups
392 %attr(755,root,root) /lib/nut/isbmex
393 %attr(755,root,root) /lib/nut/ivtscd
394 %attr(755,root,root) /lib/nut/liebert
395 %attr(755,root,root) /lib/nut/liebert-esp2
396 %attr(755,root,root) /lib/nut/masterguard
397 %attr(755,root,root) /lib/nut/metasys
398 %attr(755,root,root) /lib/nut/mge-shut
399 %attr(755,root,root) /lib/nut/mge-utalk
400 %attr(755,root,root) /lib/nut/microdowell
401 %{?with_neon:%attr(755,root,root) /lib/nut/netxml-ups}
402 %{?with_ipmi:%attr(755,root,root) /lib/nut/nut-ipmipsu}
403 %{?with_usb:%attr(755,root,root) /lib/nut/nutdrv_atcl_usb}
404 %attr(755,root,root) /lib/nut/nutdrv_qx
405 %attr(755,root,root) /lib/nut/oldmge-shut
406 %attr(755,root,root) /lib/nut/oneac
407 %attr(755,root,root) /lib/nut/optiups
408 %attr(755,root,root) /lib/nut/powercom
409 %{?with_powerman:%attr(755,root,root) /lib/nut/powerman-pdu}
410 %attr(755,root,root) /lib/nut/powerpanel
411 %attr(755,root,root) /lib/nut/rhino
412 %{?with_usb:%attr(755,root,root) /lib/nut/richcomm_usb}
413 %attr(755,root,root) /lib/nut/riello_ser
414 %{?with_usb:%attr(755,root,root) /lib/nut/riello_usb}
415 %attr(755,root,root) /lib/nut/safenet
416 %attr(755,root,root) /lib/nut/skel
417 %{?with_snmp:%attr(755,root,root) /lib/nut/snmp-ups}
418 %attr(755,root,root) /lib/nut/solis
419 %attr(755,root,root) /lib/nut/tripplite
420 %attr(755,root,root) /lib/nut/tripplitesu
421 %{?with_usb:%attr(755,root,root) /lib/nut/tripplite_usb}
422 %attr(755,root,root) /lib/nut/upscode2
423 %{?with_usb:%attr(755,root,root) /lib/nut/usbhid-ups}
424 %attr(755,root,root) /lib/nut/victronups
426 %{_datadir}/nut/cmdvartab
427 %{_datadir}/nut/driver.list
428 %{_mandir}/man5/nut.conf.5*
429 %{_mandir}/man8/al175.8*
430 %{_mandir}/man8/apcsmart.8*
431 %{_mandir}/man8/apcsmart-old.8*
432 %{_mandir}/man8/apcupsd-ups.8*
433 %{_mandir}/man8/bcmxcp.8*
434 %{?with_usb:%{_mandir}/man8/bcmxcp_usb.8*}
435 %{_mandir}/man8/belkin.8*
436 %{_mandir}/man8/belkinunv.8*
437 %{_mandir}/man8/bestfcom.8*
438 %{_mandir}/man8/bestfortress.8*
439 %{_mandir}/man8/bestuferrups.8*
440 %{_mandir}/man8/bestups.8*
441 %{_mandir}/man8/blazer_ser.8*
442 %{?with_usb:%{_mandir}/man8/blazer_usb.8*}
443 %{_mandir}/man8/clone.8*
444 %{_mandir}/man8/dummy-ups.8*
445 %{_mandir}/man8/etapro.8*
446 %{_mandir}/man8/everups.8*
447 %{_mandir}/man8/gamatronic.8*
448 %{_mandir}/man8/genericups.8*
449 %{_mandir}/man8/isbmex.8*
450 %{_mandir}/man8/ivtscd.8*
451 %{_mandir}/man8/liebert.8*
452 %{_mandir}/man8/liebert-esp2.8*
453 %{_mandir}/man8/masterguard.8*
454 %{_mandir}/man8/metasys.8*
455 %{_mandir}/man8/mge-shut.8*
456 %{_mandir}/man8/mge-utalk.8*
457 %{_mandir}/man8/microdowell.8*
458 %{?with_neon:%{_mandir}/man8/netxml-ups.8*}
459 %{?with_ipmi:%{_mandir}/man8/nut-ipmipsu.8*}
460 %{?with_usb:%{_mandir}/man8/nutdrv_atcl_usb.8*}
461 %{_mandir}/man8/nutdrv_qx.8*
462 %{_mandir}/man8/nutupsdrv.8*
463 %{_mandir}/man8/oneac.8*
464 %{_mandir}/man8/optiups.8*
465 %{_mandir}/man8/powercom.8*
466 %{?with_powerman:%{_mandir}/man8/powerman-pdu.8*}
467 %{_mandir}/man8/powerpanel.8*
468 %{_mandir}/man8/rhino.8*
469 %{?with_usb:%{_mandir}/man8/richcomm_usb.8*}
470 %{_mandir}/man8/riello_ser.8*
471 %{?with_usb:%{_mandir}/man8/riello_usb.8*}
472 %{_mandir}/man8/safenet.8*
473 %{?with_snmp:%{_mandir}/man8/snmp-ups.8*}
474 %{_mandir}/man8/solis.8*
475 %{_mandir}/man8/tripplite.8*
476 %{_mandir}/man8/tripplitesu.8*
477 %{?with_usb:%{_mandir}/man8/tripplite_usb.8*}
478 %{?with_usb:%{_mandir}/man8/usbhid-ups.8*}
479 %{_mandir}/man8/victronups.8*
480 %{?with_ipmi:%config(noreplace) %verify(not md5 mtime size) %{_udevrulesdir}/52-nut-ipmipsu.rules}
481 %{?with_usb:%config(noreplace) %verify(not md5 mtime size) %{_udevrulesdir}/62-nut-usbups.rules}
484 %defattr(644,root,root,755)
485 %doc AUTHORS MAINTAINERS NEWS README UPGRADING ChangeLog docs
487 %attr(755,root,root) %ghost %{_libdir}/libnutclient.so.0
488 %attr(755,root,root) %{_libdir}/libnutclient.so.*.*.*
489 %attr(755,root,root) %ghost %{_libdir}/libupsclient.so.4
490 %attr(755,root,root) %{_libdir}/libupsclient.so.*.*.*
493 %defattr(644,root,root,755)
494 %attr(755,root,root) %{_bindir}/upsc
495 %attr(755,root,root) %{_sbindir}/upsmon
496 %attr(755,root,root) %{_sbindir}/upssched
497 %attr(754,root,root) /etc/rc.d/init.d/upsmon
498 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsmon.conf
499 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upssched.conf
500 %attr(750,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upssched-cmd
501 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/upsmon
502 /lib/systemd/system-shutdown/nutshutdown
503 %{systemdunitdir}/nut-monitor.service
504 %{systemdunitdir}/upsmon.service
505 %{_mandir}/man5/upsmon.conf.5*
506 %{_mandir}/man5/upssched.conf.5*
507 %{_mandir}/man8/upsc.8*
508 %{_mandir}/man8/upsmon.8*
509 %{_mandir}/man8/upssched.8*
513 %defattr(644,root,root,755)
514 %{_datadir}/%{name}/html
515 %attr(755,root,root) /home/services/httpd/cgi-bin/*.cgi
516 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/hosts.conf
517 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsset.conf
518 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.html
519 %{_mandir}/man5/hosts.conf.5*
520 %{_mandir}/man5/upsset.conf.5*
521 %{_mandir}/man5/upsstats.html.5*
522 %{_mandir}/man8/upsimage.cgi.8*
523 %{_mandir}/man8/upsset.cgi.8*
524 %{_mandir}/man8/upsstats.cgi.8*
528 %defattr(644,root,root,755)
529 %attr(755,root,root) %{_libdir}/libnutclient.so
530 %attr(755,root,root) %{_libdir}/libupsclient.so
531 %attr(755,root,root) %{_libdir}/libnutscan.so
532 %{_pkgconfigdir}/libnutclient.pc
533 %{_pkgconfigdir}/libnutscan.pc
534 %{_pkgconfigdir}/libupsclient.pc
535 %{_includedir}/nut-scan.h
536 %{_includedir}/nutclient.h
537 %{_includedir}/nutscan-*.h
538 %{_includedir}/parseconf.h
539 %{_includedir}/upsclient.h
540 %{_mandir}/man3/libnutclient*.3*
541 %{_mandir}/man3/nutclient_*.3*
542 %{_mandir}/man3/nutscan*.3*
543 %{_mandir}/man3/upscli_*.3*
544 %{_mandir}/man3/upsclient.3*
547 %defattr(644,root,root,755)
548 %{_libdir}/libnutclient.a
549 %{_libdir}/libnutscan.a
550 %{_libdir}/libupsclient.a