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