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