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