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