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