]> git.pld-linux.org Git - packages/nut.git/blob - nut.spec
- dropped SourceX-size
[packages/nut.git] / nut.spec
1 #
2 # Conditional build:
3 %bcond_without  hidups                  # experimental hidups driver
4 #
5 Summary:        Network UPS Tools
6 Summary(pl):    Sieciowe narzêdzie do UPS-ów
7 Name:           nut
8 Version:        2.0.1
9 Release:        7
10 License:        GPL
11 Group:          Applications/System
12 Source0:        http://eu1.networkupstools.org/source/2.0/testing/%{name}-%{version}-pre4.tar.gz
13 # Source0-md5:  399f79406e07aa2a689bc6a119b0fcad
14 Source1:        %{name}.init
15 Source2:        %{name}.sysconfig
16 Source3:        %{name}-upsmon.init
17 Source4:        %{name}.sysconfig.upsmon
18 Patch0:         %{name}-client.patch
19 Patch1:         %{name}-datadir.patch
20 Patch2:         %{name}-config.patch
21 URL:            http://www.networkupstools.org/
22 BuildRequires:  autoconf
23 BuildRequires:  automake
24 BuildRequires:  gd-devel >= 2.0.15
25 BuildRequires:  libpng-devel
26 BuildRequires:  openssl-devel >= 0.9.7d
27 BuildRequires:  rpmbuild(macros) >= 1.159
28 PreReq:         rc-scripts
29 Requires(pre):  /bin/id
30 Requires(pre):  /usr/bin/getgid
31 Requires(pre):  /usr/sbin/groupadd
32 Requires(pre):  /usr/sbin/groupmod
33 Requires(pre):  /usr/sbin/useradd
34 Requires(post,preun):   /sbin/chkconfig
35 Requires(postun):       /usr/sbin/groupdel
36 Requires(postun):       /usr/sbin/userdel
37 Requires:       %{name}-common = %{version}-%{release}
38 Provides:       group(ups)
39 Provides:       user(ups)
40 Obsoletes:      smartupstools
41 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
42
43 %define         _sysconfdir     /etc/ups
44
45 %description
46 These programs are part of a developing project to monitor the
47 assortment of UPSes that are found out there in the field. Many models
48 have serial serial ports of some kind that allow some form of state
49 checking. This capability has been harnessed where possible to allow
50 for safe shutdowns, live status tracking on web pages, and more.
51
52 This nut ships with modified everups.c - support for Ever UPS models
53 (by Mikolaj Tutak <mtutak@eranet.pl>)
54
55 %description -l pl
56 Te programy s± czê¶ci± projektu do monitorowania wielu UPS-ów w jakim¶
57 otoczeniu. Wiele modeli ma porty szeregowe i pozwala na jak±¶ formê
58 sprawdzania stanu. Ta funkcjonalno¶æ pozwala na bezpieczne
59 zatrzymywanie systemów, sprawdzanie stanu zasilania przez WWW i inne.
60
61 Ta wersja posiada zmieniony sterownik everups.c - obs³uguje zasilacze
62 firmy Ever UPS models (autorstwa Miko³aja Tutaka <mtutak@eranet.pl>)
63
64 %description -l ru
65 üÔÉ ÐÒÏÇÒÁÍÍÙ - ÞÁÓÔØ ÐÒÏÅËÔÁ ÐÏ ÍÏÎÉÔÏÒÉÎÇÕ ÒÁÚÌÉÞÎÙÈ UPS. õ ÍÎÏÇÉÈ
66 ÍÏÄÅÌÅÊ ÅÓÔØ ÓÅÒÉÁÌØÎÙÅ ÐÏÒÔÙ, ÐÏÚ×ÏÌÑÀÝÉÅ ÐÒÏ×ÅÒÑÔØ ÓÏÓÔÏÑÎÉÅ ÜÔÉÈ
67 UPS. üÔÁ ×ÏÚÍÏÖÎÏÓÔØ ÂÙÌÁ ÉÓÐÏÌØÚÏ×ÁÎÁ, ÇÄÅ ÜÔÏ ×ÏÚÍÏÖÎÏ, ÄÌÑ
68 ×ÙÐÏÌÎÅÎÉÑ ÂÅÚÏÐÁÓÎÙÈ ÏÓÔÁÎÏ×Ï× ËÏÍÐØÀÔÅÒÏ×, ÏÔÓÌÅÖÉ×ÁÎÉÑ ÓÔÁÔÕÓÁ
69 ÞÅÒÅÚ ×Å ɠÔ.Ð.
70
71 %description -l uk
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):    Pakiet z plikami wspólnymi dla demona nut i jego klientów
81 Group:          Applications/System
82
83 %description common
84 Package with common files for nut daemon and its clients.
85
86 %description common -l pl
87 Pakiet z plikami wspólnymi dla demona nut i jego klientów.
88
89 %package client
90 Summary:        Multi-vendor UPS Monitoring Project Client Utilities
91 Summary(pl):    Narzêdzia klienckie do monitorowania UPS-ów
92 Summary(uk):    Network UPS Tools - Ë̦¤ÎÔÓØ˦ ÕÔÉ̦ÔÉ ÍÏΦÔÏÒÉÎÇÕ
93 Summary(ru):    Network UPS Tools - ËÌÉÅÎÔÓËÉÅ ÕÔÉÌÉÔÙ ÍÏÎÉÔÏÒÉÎÇÁ
94 Group:          Applications/System
95 PreReq:         rc-scripts
96 Requires(post,preun):   /sbin/chkconfig
97 Requires:       %{name}-common = %{version}-%{release}
98
99 %description client
100 This package includes the client utilities that are required to
101 monitor a UPS that the client host is plugged into but monitored via
102 serial cable by another host on the network....
103
104 %description client -l pl
105 Ten pakiet zawiera narzêdzia kliencie potrzebne do monitorowania UPS-a
106 do którego pod³±czony jest komputer kliencki, kiedy kabel szeregowy
107 UPS-a jest pod³±czony do innego komputera w sieci.
108
109 %description client -l ru
110 üÔÏÔ ÐÁËÅÔ ×ËÌÀÞÁÅÔ ËÌÉÅÎÔÓËÉÅ ÕÔÉÌÉÔÙ, ÎÅÏÂÈÏÄÉÍÙÅ ÄÌÑ ÍÏÎÉÔÏÒÉÎÇÁ
111 UPS, Ë ËÏÔÏÒÏÍÕ ËÌÉÅÎÔÓËÉÊ ÈÏÓÔ ÉÍÅÅÔ ÄÏÓÔÕÐ, ÎÏ UPS ÆÉÚÉÞÅÓËÉ
112 ÐÏÄËÌÀÞÅΠˠÄÒÕÇÏÍÕ ËÏÍÐØÀÔÅÒÕ × ÓÅÔÉ.
113
114 %description client -l uk
115 ãÅÊ ÐÁËÅÔ ×ËÌÀÞÁ¤ Ë̦¤ÎÔÓØ˦ ÕÔÉ̦ÔÉ, ÐÏÔÒ¦ÂΦ ÄÌÑ ÍÏΦÔÏÒÉÎÇÕ UPS, ÄÏ
116 ÑËÏÇÏ Ë̦¤ÎÔÓØËÉÊ ÈÏÓÔ ÍÁ¤ ÄÏÓÔÕÐ, ÁÌÅ UPS Æ¦ÚÉÞÎϠЦÄËÌÀÞÅÎÉÊ ÄÏ
117 ¦ÎÛÏÇÏ ËÏÍÐ'ÀÔÅÒÕ × ÍÅÒÅÖ¦.
118
119 %package cgi
120 Summary:        Multi-vendor UPS Monitoring Project Server - CGI utils
121 Summary(pl):    Narzêdzia CGI do monitorowania UPS-ów
122 Summary(ru):    Network UPS Tools - CGI ÕÔÉÌÉÔÙ
123 Summary(uk):    Network UPS Tools - CGI ÕÔÉ̦ÔÉ
124 Group:          Applications/System
125 Requires:       %{name}-common = %{version}-%{release}
126
127 %description cgi
128 These programs are part of a developing project to monitor the
129 assortment of UPSes that are found out there in the field. Many models
130 have serial serial ports of some kind that allow some form of state
131 checking. This capability has been harnessed where possible to allow
132 for safe shutdowns, live status tracking on web pages, and more. This
133 package contains CGI utils.
134
135 %description cgi -l pl
136 Te programy s± czê¶ci± projektu do monitorowania wielu UPS-ów w jakim¶
137 otoczeniu. Wiele modeli ma porty szeregowe i pozwala na jak±¶ formê
138 sprawdzania stanu. Ta funkcjonalno¶æ pozwala na bezpieczne
139 zatrzymywanie systemów, sprawdzanie stanu zasilania przez WWW i inne.
140 Ten pakiet zawiera narzêdzia CGI.
141
142 %description cgi -l ru
143 üÔÏÔ ÐÁËÅÔ ×ËÌÀÞÁÅÔ CGI ÐÒÏÇÒÁÍÍÙ ÄÌÑ ÄÏÓÔÕÐÁ Ë ÉÎÆÏÒÍÁÃÉÉ Ï ÓÔÁÔÕÓÅ
144 UPS ÞÅÒÅÚ ×ÅÂ-ÉÎÔÅÒÆÅÊÓ.
145
146 %description cgi -l uk
147 ãÅÊ ÐÁËÅÔ ×ËÌÀÞÁ¤ CGI ÐÒÏÇÒÁÍÉ ÄÌÑ ÄÏÓÔÕÐÕ ÄÏ ¦ÎÆÏÒÍÁ槠ÐÒÏ ÓÔÁÔÕÓ
148 UPS ÞÅÒÅÚ ×ÅÂ-¦ÎÔÅÒÆÅÊÓ.
149
150 %package devel
151 Summary:        Files for NUT clients development
152 Summary(pl):    Pliki do tworzenia klientów NUT-a
153 Group:          Development/Libraries
154 Requires:       openssl-devel >= 0.9.7c
155 # it does NOT require nut
156
157 %description devel
158 Object file and header for developing NUT clients.
159
160 %description devel -l pl
161 Plik wynikowy oraz nag³ówek s³u¿±ce do tworzenia klientów NUT-a.
162
163 %prep
164 %setup -q
165 %patch0 -p1
166 %patch1 -p1
167 %patch2 -p1
168
169 %build
170 cp -f /usr/share/automake/config.sub .
171 %{__aclocal}
172 %{__autoconf}
173 LDFLAGS="-L%{_prefix}/X11R6/%{_lib}"; export LDFLAGS
174 %configure \
175         %{?with_hidups:--with-linux-hiddev} \
176         --with-ssl \
177         --with-cgi \
178         --with-linux-hiddev=%{_includedir}/linux/hiddev.h \
179         --with-statepath=%{_var}/lib/ups \
180         --with-drvpath=/lib/nut \
181         --with-cgipath=/home/services/httpd/cgi-bin \
182         --with-user=ups \
183         --with-group=ups
184 %{__make} all cgi
185 %{?with_hidups:%{__make} build-usb}
186
187 %install
188 rm -rf $RPM_BUILD_ROOT
189 install -d $RPM_BUILD_ROOT{/sbin,/etc/{sysconfig,rc.d/init.d},/var/lib/ups} \
190         $RPM_BUILD_ROOT{/lib/nut,%{_libdir},%{_includedir}/nut}
191
192 %{__make} install install-cgi \
193         DESTDIR=$RPM_BUILD_ROOT
194
195 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/ups
196 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/ups
197 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/upsmon
198 install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/upsmon
199
200 rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/*
201 install conf/*.users conf/*.conf conf/*.html $RPM_BUILD_ROOT%{_sysconfdir}
202
203 install clients/upsclient.o common/parseconf.o $RPM_BUILD_ROOT%{_libdir}
204 install clients/upsclient.h include/parseconf.h $RPM_BUILD_ROOT%{_includedir}/nut
205
206 %{?with_hidups:install drivers/hidups $RPM_BUILD_ROOT/lib/nut}
207
208 cat > $RPM_BUILD_ROOT/sbin/poweroff-ups << EOF
209 #!/bin/sh
210 /etc/rc.d/init.d/ups powerdown
211 EOF
212
213 %clean
214 rm -rf $RPM_BUILD_ROOT
215
216 %pre
217 if [ -n "`/usr/bin/getgid ups`" ]; then
218         if [ "`/usr/bin/getgid ups`" != 76 ]; then
219                 if [ "`/usr/bin/getgid ups`" = 121 ]; then
220                         /usr/sbin/groupmod -g 76 ups
221                         chgrp ups %{_sysconfdir}/{upsd.conf,ups.conf,upsd.users}
222                         /usr/sbin/usermod -g 76 ups
223                 else
224                         echo "Error: group ups doesn't have gid=76. Correct this before installing %{name}." 1>&2
225                         exit 1
226                 fi
227         fi
228 else
229         /usr/sbin/groupadd -g 76 ups
230 fi
231 if [ -n "`/bin/id -u ups 2>/dev/null`" ]; then
232         if [ "`/bin/id -u ups`" != 70 ]; then
233                 echo "Error: user ups doesn't have uid=70. Correct this before installing %{name}." 1>&2
234                 exit 1
235         fi
236 else
237         echo "Adding user ups UID=70."
238         /usr/sbin/useradd -u 70 -d /usr/share/empty -s /bin/false \
239                 -c "UPS Manager User" -g ups ups 1>&2
240 fi
241
242
243 %post
244 /sbin/chkconfig --add ups
245 if [ -f /var/lock/subsys/ups ]; then
246         /etc/rc.d/init.d/ups restart >&2
247 else
248         echo "Run \"/etc/rc.d/init.d/ups start\" to start NUT ups daemon."
249 fi
250
251 %post client
252 /sbin/chkconfig --add upsmon
253 if [ -f /var/lock/subsys/upsmon ]; then
254         /etc/rc.d/init.d/upsmon restart >&2
255 else
256         echo "Run \"/etc/rc.d/init.d/upsmon start\" to start NUT upsmon daemon."
257 fi
258
259 %preun
260 if [ "$1" = "0" ]; then
261         if [ -f /var/lock/subsys/ups ]; then
262                 /etc/rc.d/init.d/ups stop >&2
263         fi
264         /sbin/chkconfig --del ups
265 fi
266
267 %preun client
268 if [ "$1" = "0" ]; then
269         if [ -f /var/lock/subsys/upsmon ]; then
270                 /etc/rc.d/init.d/upsmon stop >&2
271         fi
272         /sbin/chkconfig --del upsmon
273 fi
274
275 %postun
276 if [ "$1" = "0" ]; then
277         %userremove ups
278         %groupremove ups
279 fi
280
281 %files
282 %defattr(644,root,root,755)
283 %attr(755,root,root) %{_bindir}/upscmd
284 %attr(755,root,root) %{_bindir}/upslog
285 %attr(755,root,root) %{_bindir}/upsrw
286 %attr(755,root,root) %{_sbindir}/upsd
287 %attr(755,root,root) /sbin/poweroff-ups
288 %config(noreplace) %verify(not size mtime md5) /etc/sysconfig/ups
289 %attr(754,root,root) /etc/rc.d/init.d/ups
290 %attr(640,root,ups) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/upsd.conf
291 %attr(640,root,ups) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/ups.conf
292 %attr(640,root,ups) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/upsd.users
293 %{_mandir}/man5/ups.conf.5*
294 %{_mandir}/man5/upsd.conf.5*
295 %{_mandir}/man5/upsd.users.5*
296 %{_mandir}/man8/[!u]*.8*
297 %{_mandir}/man8/upscmd.8*
298 %{_mandir}/man8/upsd.8*
299 %{_mandir}/man8/upsdrvctl.8*
300 %{_mandir}/man8/upslog.8*
301 %{_mandir}/man8/upsrw.8*
302 %dir %attr(770,root,ups) /var/lib/ups
303 %dir /lib/nut
304 %attr(755,root,root) /lib/nut/*
305 %{_datadir}/nut
306
307 %files common
308 %defattr(644,root,root,755)
309 %doc NEWS README CHANGES CREDITS docs
310 %dir %{_sysconfdir}
311
312 %files client
313 %defattr(644,root,root,755)
314 %attr(755,root,root) %{_bindir}/upsc
315 %attr(755,root,root) %{_sbindir}/upsmon
316 %attr(755,root,root) %{_sbindir}/upssched
317 %attr(755,root,root) %{_sbindir}/upssched-cmd
318 %attr(754,root,root) /etc/rc.d/init.d/upsmon
319 %attr(600,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/upsmon.conf
320 %attr(600,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/upssched.conf
321 %config(noreplace) %verify(not size mtime md5) /etc/sysconfig/upsmon
322 %{_mandir}/man5/upsmon.conf.5*
323 %{_mandir}/man5/upssched.conf.5*
324 %{_mandir}/man8/upsc.8*
325 %{_mandir}/man8/upsmon.8*
326 %{_mandir}/man8/upssched.8*
327
328 %files cgi
329 %defattr(644,root,root,755)
330 %attr(755,root,root) /home/services/httpd/cgi-bin/*.cgi
331 %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/hosts.conf
332 %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/upsset.conf
333 %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/*.html
334 %{_mandir}/man5/hosts.conf.5*
335 %{_mandir}/man5/upsset.conf.5*
336 %{_mandir}/man5/upsstats.html.5*
337 %{_mandir}/man8/upsimage.cgi.8*
338 %{_mandir}/man8/upsset.cgi.8*
339 %{_mandir}/man8/upsstats.cgi.8*
340
341 %files devel
342 %defattr(644,root,root,755)
343 %{_libdir}/upsclient.o
344 %{_libdir}/parseconf.o
345 %{_includedir}/nut
This page took 0.064034 seconds and 4 git commands to generate.