]> git.pld-linux.org Git - packages/nut.git/blob - nut.spec
- separate hal stuff to -hal package
[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_with     neonxml                 # 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.2.2
16 Release:        1
17 License:        GPL
18 Group:          Applications/System
19 Source0:        http://eu1.networkupstools.org/source/2.2/%{name}-%{version}.tar.gz
20 # Source0-md5:  677a84a83e9be7bc93610413ee696375
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}-as-needed.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 Requires:       %{name}-common = %{version}-%{release}
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 %package hal
172 Summary:        NUT integration with FreeDesktop HAL
173 Summary(pl.UTF-8):      Pliki do integracji NUT-a z HAL-em
174 Group:          Development/Libraries
175 Requires:       %{name} = %{version}-%{release}
176
177 %description hal
178 NUT integration with FreeDesktop HAL.
179
180 %description hal -l pl.UTF-8
181 Pliki do integracji NUT-a z HAL-em.
182
183 %prep
184 %setup -q
185 %patch0 -p1
186 %patch1 -p1
187 %patch2 -p1
188 %patch3 -p1
189 %patch4 -p1
190
191 %build
192 cp -f /usr/share/automake/config.sub .
193 %{__libtoolize}
194 %{__aclocal} -I m4
195 %{__automake}
196 %{__autoconf}
197 %configure \
198         --datadir=%{_datadir}/%{name} \
199         --with-htmlpath=%{_datadir}/%{name}/html \
200         --with-serial \
201         --with%{!?with_usb:out}-usb \
202         --with%{!?with_snmp:out}-snmp \
203         --with%{!?with_hal:out}-hal \
204         --with%{!?with_cgi:out}-cgi \
205         --with-dev \
206         --with%{!?with_neonxml:out}-neonxml \
207         --with-linux-hiddev=%{_includedir}/linux/hiddev.h \
208         --with-ssl \
209         --with-ipv6 \
210         %{?with_usb:--with-udev-dir=/etc/udev} \
211         --with-statepath=%{_var}/lib/ups \
212         --with-drvpath=/lib/nut \
213         --with-cgipath=/home/services/httpd/cgi-bin \
214         --with-user=ups \
215         --with-group=ups
216
217 %{__make}
218
219 %install
220 rm -rf $RPM_BUILD_ROOT
221 install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},/var/lib/ups,/lib/nut,/sbin}
222
223 %{__make} install \
224         DESTDIR=$RPM_BUILD_ROOT
225
226 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/ups
227 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/ups
228 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/upsmon
229 install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/upsmon
230
231 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.sample; do
232         mv -f $i ${i%.sample}
233 done
234
235 %if %{with usb}
236 mv -f $RPM_BUILD_ROOT%{_udevrulesdir}/52{_,-}nut-usbups.rules
237 %else
238 rm -f $RPM_BUILD_ROOT%{_udevrulesdir}/52_nut-usbups.rules
239 %endif
240
241 cat > $RPM_BUILD_ROOT/sbin/poweroff-ups << EOF
242 #!/bin/sh
243 /etc/rc.d/init.d/ups powerdown
244 EOF
245
246 %clean
247 rm -rf $RPM_BUILD_ROOT
248
249 %post
250 /sbin/chkconfig --add ups
251 %service ups restart "NUT ups daemon"
252
253 %preun
254 if [ "$1" = "0" ]; then
255         %service ups stop
256         /sbin/chkconfig --del ups
257 fi
258
259 %pre common
260 # move to trigger?
261 if [ -n "`/usr/bin/getgid ups`" ] && [ "`/usr/bin/getgid ups`" = 121 ]; then
262         /usr/sbin/groupmod -g 76 ups
263         chgrp ups %{_sysconfdir}/{upsd.conf,ups.conf,upsd.users}
264         /usr/sbin/usermod -g 76 ups
265 fi
266 %groupadd -g 76 ups
267 %useradd -u 70 -d /usr/share/empty -s /bin/false -c "UPS Manager User" -g ups ups
268
269 %post client
270 /sbin/chkconfig --add upsmon
271 %service upsmon restart "NUT upsmon daemon"
272
273 %preun client
274 if [ "$1" = "0" ]; then
275         %service upsmon stop
276         /sbin/chkconfig --del upsmon
277 fi
278
279 %postun common
280 if [ "$1" = "0" ]; then
281         %userremove ups
282         %groupremove ups
283 fi
284
285 %files
286 %defattr(644,root,root,755)
287 %attr(755,root,root) %{_bindir}/upscmd
288 %attr(755,root,root) %{_bindir}/upslog
289 %attr(755,root,root) %{_bindir}/upsrw
290 %attr(755,root,root) %{_sbindir}/upsd
291 %attr(755,root,root) /sbin/poweroff-ups
292 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ups
293 %attr(754,root,root) /etc/rc.d/init.d/ups
294 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsd.conf
295 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ups.conf
296 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsd.users
297 %{_mandir}/man5/ups.conf.5*
298 %{_mandir}/man5/upsd.conf.5*
299 %{_mandir}/man5/upsd.users.5*
300 %{_mandir}/man8/upscmd.8*
301 %{_mandir}/man8/upscode2.8*
302 %{_mandir}/man8/upsd.8*
303 %{_mandir}/man8/upsdrvctl.8*
304 %{_mandir}/man8/upslog.8*
305 %{_mandir}/man8/upsrw.8*
306 %dir %attr(770,root,ups) /var/lib/ups
307 %dir /lib/nut
308 %attr(755,root,root) /lib/nut/al175
309 %attr(755,root,root) /lib/nut/apcsmart
310 %attr(755,root,root) /lib/nut/bcmxcp
311 %{?with_usb:%attr(755,root,root) /lib/nut/bcmxcp_usb}
312 %attr(755,root,root) /lib/nut/belkin
313 %attr(755,root,root) /lib/nut/belkinunv
314 %attr(755,root,root) /lib/nut/bestfcom
315 %attr(755,root,root) /lib/nut/bestuferrups
316 %attr(755,root,root) /lib/nut/bestups
317 %attr(755,root,root) /lib/nut/cpsups
318 %attr(755,root,root) /lib/nut/cyberpower
319 %attr(755,root,root) /lib/nut/dummy-ups
320 %{?with_usb:%attr(755,root,root) /lib/nut/energizerups}
321 %attr(755,root,root) /lib/nut/etapro
322 %attr(755,root,root) /lib/nut/everups
323 %attr(755,root,root) /lib/nut/gamatronic
324 %attr(755,root,root) /lib/nut/genericups
325 %attr(755,root,root) /lib/nut/isbmex
326 %attr(755,root,root) /lib/nut/liebert
327 %attr(755,root,root) /lib/nut/masterguard
328 %attr(755,root,root) /lib/nut/megatec
329 %{?with_usb:%attr(755,root,root) /lib/nut/megatec_usb}
330 %attr(755,root,root) /lib/nut/metasys
331 %attr(755,root,root) /lib/nut/mge-shut
332 %attr(755,root,root) /lib/nut/mge-utalk
333 %attr(755,root,root) /lib/nut/newmge-shut
334 %attr(755,root,root) /lib/nut/nitram
335 %attr(755,root,root) /lib/nut/oneac
336 %attr(755,root,root) /lib/nut/optiups
337 %attr(755,root,root) /lib/nut/powercom
338 %attr(755,root,root) /lib/nut/powerpanel
339 %attr(755,root,root) /lib/nut/rhino
340 %attr(755,root,root) /lib/nut/safenet
341 %attr(755,root,root) /lib/nut/skel
342 %{?with_snmp:%attr(755,root,root) /lib/nut/snmp-ups}
343 %attr(755,root,root) /lib/nut/solis
344 %attr(755,root,root) /lib/nut/tripplite
345 %attr(755,root,root) /lib/nut/tripplitesu
346 %{?with_usb:%attr(755,root,root) /lib/nut/tripplite_usb}
347 %attr(755,root,root) /lib/nut/upscode2
348 %attr(755,root,root) /lib/nut/upsdrvctl
349 %{?with_usb:%attr(755,root,root) /lib/nut/usbhid-ups}
350 %attr(755,root,root) /lib/nut/victronups
351 %{_datadir}/nut
352 %{_mandir}/man8/al175.8*
353 %{_mandir}/man8/apcsmart.8*
354 %{_mandir}/man8/bcmxcp.8*
355 %{?with_usb:%{_mandir}/man8/bcmxcp_usb.8*}
356 %{_mandir}/man8/belkin.8*
357 %{_mandir}/man8/belkinunv.8*
358 %{_mandir}/man8/bestfcom.8*
359 %{_mandir}/man8/bestuferrups.8*
360 %{_mandir}/man8/bestups.8*
361 %{_mandir}/man8/cpsups.8*
362 %{_mandir}/man8/cyberpower.8*
363 %{_mandir}/man8/dummy-ups.8*
364 %{?with_usb:%{_mandir}/man8/energizerups.8*}
365 %{_mandir}/man8/etapro.8*
366 %{_mandir}/man8/everups.8*
367 %{_mandir}/man8/gamatronic.8*
368 %{_mandir}/man8/genericups.8*
369 %{_mandir}/man8/isbmex.8*
370 %{_mandir}/man8/liebert.8*
371 %{_mandir}/man8/masterguard.8*
372 %{_mandir}/man8/megatec.8*
373 %{?with_usb:%{_mandir}/man8/megatec_usb.8*}
374 %{_mandir}/man8/metasys.8*
375 %{_mandir}/man8/mge-shut.8*
376 %{_mandir}/man8/mge-utalk.8*
377 %{_mandir}/man8/nitram.8*
378 %{_mandir}/man8/nutupsdrv.8*
379 %{_mandir}/man8/oneac.8*
380 %{_mandir}/man8/optiups.8*
381 %{_mandir}/man8/powercom.8*
382 %{_mandir}/man8/powerpanel.8*
383 %{_mandir}/man8/rhino.8*
384 %{_mandir}/man8/safenet.8*
385 %{?with_snmp:%{_mandir}/man8/snmp-ups.8*}
386 %{_mandir}/man8/solis.8*
387 %{_mandir}/man8/tripplite.8*
388 %{_mandir}/man8/tripplitesu.8*
389 %{?with_usb:%{_mandir}/man8/tripplite_usb.8*}
390 %{?with_usb:%{_mandir}/man8/usbhid-ups.8*}
391 %{_mandir}/man8/victronups.8*
392 %{?with_usb:%config(noreplace) %verify(not md5 mtime size) %{_udevrulesdir}/52-nut-usbups.rules}
393
394 %files common
395 %defattr(644,root,root,755)
396 %doc AUTHORS MAINTAINERS NEWS README UPGRADING ChangeLog docs
397 %dir %{_sysconfdir}
398 %ghost %{_libdir}/libupsclient.so.1
399 %attr(755,root,root) %{_libdir}/libupsclient.so.*.*.*
400
401 %files client
402 %defattr(644,root,root,755)
403 %attr(755,root,root) %{_bindir}/upsc
404 %attr(755,root,root) %{_sbindir}/upsmon
405 %attr(755,root,root) %{_sbindir}/upssched
406 %attr(754,root,root) /etc/rc.d/init.d/upsmon
407 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsmon.conf
408 %attr(640,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upssched.conf
409 %attr(750,root,ups) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upssched-cmd
410 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/upsmon
411 %{_mandir}/man5/upsmon.conf.5*
412 %{_mandir}/man5/upssched.conf.5*
413 %{_mandir}/man8/upsc.8*
414 %{_mandir}/man8/upsmon.8*
415 %{_mandir}/man8/upssched.8*
416
417 %if %{with cgi}
418 %files cgi
419 %defattr(644,root,root,755)
420 %{_datadir}/%{name}/html
421 %attr(755,root,root) /home/services/httpd/cgi-bin/*.cgi
422 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/hosts.conf
423 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upsset.conf
424 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.html
425 %{_mandir}/man5/hosts.conf.5*
426 %{_mandir}/man5/upsset.conf.5*
427 %{_mandir}/man5/upsstats.html.5*
428 %{_mandir}/man8/upsimage.cgi.8*
429 %{_mandir}/man8/upsset.cgi.8*
430 %{_mandir}/man8/upsstats.cgi.8*
431 %endif
432
433 %if %{with hal}
434 %files hal
435 %defattr(644,root,root,755)
436 %attr(755,root,root) %{_libdir}/hal/hald-addon-bcmxcp_usb
437 %attr(755,root,root) %{_libdir}/hal/hald-addon-megatec_usb
438 %attr(755,root,root) %{_libdir}/hal/hald-addon-tripplite_usb
439 %attr(755,root,root) %{_libdir}/hal/hald-addon-usbhid-ups
440 %{_datadir}/hal/fdi/information/20thirdparty/20-ups-nut-device.fdi
441 %endif
442
443 %files devel
444 %defattr(644,root,root,755)
445 %attr(755,root,root) %{_libdir}/libupsclient.la
446 %attr(755,root,root) %{_libdir}/libupsclient.so
447 %{_pkgconfigdir}/*
448 %{_includedir}/*.h
449 %{_mandir}/man3/*.3*
This page took 1.02602 seconds and 3 git commands to generate.