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