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