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