]> TLD Linux GIT Repositories - packages/munin.git/blob - munin.spec
91e9c58391ecdc44b0916868e84a8a5d7d3fcf8d
[packages/munin.git] / munin.spec
1 # Condtional build:
2 %bcond_with     sybase          # add Sybase support to munin-node
3
4 %include        /usr/lib/rpm/macros.perl
5 Summary:        Munin - the Linpro RRD data agent
6 Summary(pl.UTF-8):      Munin - agent danych RRD Linpro
7 Name:           munin
8 Version:        2.0.42
9 Release:        1
10 License:        GPL
11 Group:          Applications/WWW
12 Source0:        https://github.com/munin-monitoring/munin/archive/%{version}.tar.gz
13 # Source0-md5:  802394c56aa714a97b8535c8d6388b17
14 Source1:        %{name}-node.init
15 Source2:        %{name}.cron
16 Source3:        %{name}-apache.conf
17 Source4:        %{name}.logrotate
18 Source5:        %{name}-node.logrotate
19 Source6:        %{name}-lighttpd.conf
20 Source8:        %{name}-httpd.conf
21 Source11:       %{name}-asyncd.init
22 Source12:       %{name}-asyncd.sysconfig
23 Patch0:         %{name}-Makefile.patch
24 Patch1:         %{name}-plugins.patch
25 Patch2:         %{name}-templatedir.patch
26 Patch3:         %{name}-separate-configs.patch
27 Patch4:         %{name}-timeout.patch
28 URL:            http://munin.sourceforge.net/
29 BuildRequires:  perl-Encode
30 BuildRequires:  perl-Net-SNMP
31 BuildRequires:  perl-devel
32 BuildRequires:  rpm-perlprov
33 BuildRequires:  rpm-pythonprov
34 BuildRequires:  rpmbuild(macros) >= 1.671
35 BuildRequires:  which
36 Requires(triggerpostun):        sed >= 4.0
37 Requires:       %{name}-common = %{version}-%{release}
38 Requires:       fonts-TTF-DejaVu
39 Requires:       perl-Date-Manip
40 Requires:       perl-FCGI
41 Requires:       perl-HTML-Template
42 Requires:       perl-Net-Server
43 Requires:       rrdtool >= 1.3.0
44 Requires:       webapps
45 Requires:       webserver(alias)
46 Requires:       webserver(auth)
47 Requires:       webserver(cgi)
48 Requires:       webserver(expires)
49 Suggests:       crondaemon
50 Conflicts:      apache-base < 2.4.0-1
51 Conflicts:      logrotate < 3.8.0
52 BuildArch:      noarch
53 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
54
55 %define         _noautoreq_perl DBD::Pg
56
57 %define         _sysconfdir     /etc/%{name}
58 %define         _webapps        /etc/webapps
59 %define         _webapp         %{name}
60 %define         _appdir         %{_datadir}/%{_webapp}
61 %define         _htmldir        /var/lib/%{name}/html
62
63 %description
64 Munin, formerly known as The Linpro RRD server, queries a number of
65 nodes, and processes the data using RRDtool and presents it on web
66 pages.
67
68 %description -l pl.UTF-8
69 Munin, znany poprzednio jako serwer RRD Linpro, odpytuje wiele węzłów
70 i przetwarza dane przy użyciu RRDtoola, a następnie prezentuje je na
71 stronach WWW.
72
73 %package async
74 Summary:        Munin asynchronous proxy client/server
75 Summary(pl.UTF-8):      Klient/serwer asynchronicznego proxy dla Munina
76 Group:          Daemons
77 Requires(post,preun):   /sbin/chkconfig
78 Requires:       %{name}-node = %{version}-%{release}
79
80 %description async
81 Asynchronous proxy client/server for Munin node.
82
83 %description async -l pl.UTF-8
84 Klient/serwer asynchronicznego proxy dla węzła Munina.
85
86 %package common
87 Summary:        Munin - the Linpro RRD data agent - common files
88 Summary(pl.UTF-8):      Munin - agent danych RRD Linpro - wspólne pliki
89 Group:          Daemons
90 Requires(postun):       /usr/sbin/groupdel
91 Requires(postun):       /usr/sbin/userdel
92 Requires(pre):  /bin/id
93 Requires(pre):  /usr/bin/getgid
94 Requires(pre):  /usr/sbin/groupadd
95 Requires(pre):  /usr/sbin/useradd
96
97 %description common
98 Munin, formerly known as The Linpro RRD server, queries a number of
99 nodes, and processes the data using RRDtool and presents it on web
100 pages.
101
102 %description common -l pl.UTF-8
103 Munin, znany poprzednio jako serwer RRD Linpro, odpytuje wiele węzłów
104 i przetwarza dane przy użyciu RRDtoola, a następnie prezentuje je na
105 stronach WWW.
106
107 %package node
108 Summary:        Linpro RRD data agent
109 Summary(pl.UTF-8):      Agent danych RRD Linpro
110 Group:          Daemons
111 Requires(post,preun):   /sbin/chkconfig
112 Requires:       %{name}-common = %{version}-%{release}
113 Requires:       logtail
114 Requires:       logtool
115 #Requires:      perl-Config-General
116 Requires:       perl-Net-Netmask
117 Requires:       perl-Net-SNMP
118 Requires:       perl-Net-Server
119 Requires:       perl-libwww
120 Requires:       procps >= 2.0.7
121 Requires:       rc-scripts >= 0.4.0.15
122 Requires:       sysstat
123 Suggests:       perl-DBD-Pg
124 Conflicts:      logrotate < 3.7-4
125
126 %description node
127 The Munin node package returns statistical data on the request of a
128 Munin server.
129
130 %description node -l pl.UTF-8
131 Pakiet Munin dla węzła zwraca dane statystyczne na żądanie serwera
132 Munin.
133
134 %prep
135 %setup -q
136 %patch0 -p1
137 %patch1 -p1
138 %patch2 -p1
139 %patch3 -p1
140 %patch4 -p1
141
142 %build
143 %{__make} -j1 build \
144         PERL_MB_OPT="perl=%{__perl}" \
145         JCVALID=no
146
147 %install
148 rm -rf $RPM_BUILD_ROOT
149 install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,cron.d,logrotate.d,sysconfig},%{_bindir},%{_sbindir}} \
150         $RPM_BUILD_ROOT/var/log/archive/munin \
151         $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
152
153 %{__make} -j1 install \
154         JCVALID=no \
155         CHOWN=/bin/true \
156         DESTDIR=$RPM_BUILD_ROOT
157
158 # move asyncd daemon do sbin
159 %{__mv} $RPM_BUILD_ROOT{%{_datadir}/munin,%{_sbindir}}/munin-asyncd
160
161 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/munin-node
162 install -p %{SOURCE11} $RPM_BUILD_ROOT/etc/rc.d/init.d/munin-asyncd
163 install %{SOURCE12} $RPM_BUILD_ROOT/etc/sysconfig/munin-asyncd
164
165 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/munin
166 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/logrotate.d/munin
167 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/munin-node
168
169 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
170 cp -p %{SOURCE8} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
171 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
172
173
174 cp -p dists/tarball/plugins.conf $RPM_BUILD_ROOT%{_sysconfdir}
175 ln -sf %{_sysconfdir}/plugins.conf $RPM_BUILD_ROOT%{_sysconfdir}/plugin-conf.d/munin-node
176
177 for f in cgi-graph cgi-html graph html limits update ; do
178         touch $RPM_BUILD_ROOT/var/log/munin/munin-$f.log
179 done
180
181 %clean
182 rm -rf $RPM_BUILD_ROOT
183
184 %triggerin -- apache1 < 1.3.37-3, apache1-base
185 %webapp_register apache %{_webapp}
186
187 %triggerun -- apache1 < 1.3.37-3, apache1-base
188 %webapp_unregister apache %{_webapp}
189
190 %triggerin -- apache-base
191 %webapp_register httpd %{_webapp}
192
193 %triggerun -- apache-base
194 %webapp_unregister httpd %{_webapp}
195
196 %triggerin -- lighttpd
197 %webapp_register lighttpd %{_webapp}
198
199 %triggerun -- lighttpd
200 %webapp_unregister lighttpd %{_webapp}
201
202 %triggerpostun -- munin < 1.3.4-5
203 # rescue app config
204 if [ -f /etc/munin/munin.conf.rpmsave ]; then
205         mv -f %{_webapps}/%{_webapp}/munin.conf{,.rpmnew}
206         mv -f /etc/munin/munin.conf.rpmsave %{_webapps}/%{_webapp}/munin.conf
207
208         # fix paths in munin.conf
209         sed -i -e 's|dbdir.*|dbdir      /var/lib/munin/db|' \
210                 -e 's|tmpldir.*|tmpldir %{_webapps}/%{_webapp}/templates|' \
211                 %{_webapps}/%{_webapp}/munin.conf
212 fi
213 # move RRDs to new location
214 cd /var/lib/munin
215 for i in *; do
216         case "$i" in
217                 db|html|plugin-state) ;;
218                 *) mv -f "$i" db/ ;;
219         esac
220 done
221
222 %post
223 for f in cgi-graph cgi-html graph html limits update ; do
224         touch /var/log/munin/munin-$f.log
225         chmod 660 /var/log/munin/munin-$f.log
226         chown munin:http /var/log/munin/munin-$f.log
227 done
228
229 %post async
230 if [ "$1" = "1" ] ; then
231         /sbin/chkconfig --add munin-asyncd
232 fi
233 %service munin-asyncd try-restart "Munin Asyncd"
234
235 %preun async
236 if [ "$1" = "0" ] ; then
237         %service munin-asyncd stop
238         /sbin/chkconfig --del munin-asyncd
239 fi
240
241 %post node
242 if [ "$1" = "1" ] ; then
243         /sbin/chkconfig --add munin-node
244         %{_sbindir}/munin-node-configure --shell | sh
245 fi
246 %service munin-node restart "Munin Node"
247
248 %preun node
249 if [ "$1" = "0" ] ; then
250         %service munin-node stop
251         /sbin/chkconfig --del munin-node
252 fi
253
254 %pre common
255 %groupadd -g 158 munin
256 %useradd -o -u 158 -s /bin/false -g munin -c "Munin Node" -d /var/lib/munin munin
257
258 %postun common
259 if [ "$1" = "0" ]; then
260         %userremove munin
261         %groupremove munin
262 fi
263
264 %files
265 %defattr(644,root,root,755)
266 %dir %attr(750,munin,http) %{_webapps}/%{_webapp}
267 %dir %attr(750,munin,http) %{_webapps}/%{_webapp}/munin-conf.d
268 %dir %{_webapps}/%{_webapp}/templates
269 %{_webapps}/%{_webapp}/templates/*.tmpl
270 %dir %{_webapps}/%{_webapp}/templates/static
271 %{_webapps}/%{_webapp}/templates/static/*.css
272 %{_webapps}/%{_webapp}/templates/static/*.html
273 %{_webapps}/%{_webapp}/templates/static/*.ico
274 %{_webapps}/%{_webapp}/templates/static/*.js
275 %{_webapps}/%{_webapp}/templates/static/*.png
276 %dir %{_webapps}/%{_webapp}/templates/partial
277 %{_webapps}/%{_webapp}/templates/partial/*.tmpl
278 %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/munin.conf
279 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
280 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
281 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
282 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/munin
283 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/munin
284 %attr(755,root,root) %{_sbindir}/munin-cron
285 %attr(755,root,root) %{_datadir}/munin/munin-check
286 %attr(755,root,root) %{_datadir}/munin/munin-graph
287 %attr(755,root,root) %{_datadir}/munin/munin-html
288 %attr(755,root,root) %{_datadir}/munin/munin-limits
289 %attr(755,root,root) %{_datadir}/munin/munin-update
290 %attr(755,root,root) %{_datadir}/munin/munin-datafile2storable
291 %attr(755,root,root) %{_datadir}/munin/munin-storable2datafile
292 %attr(755,munin,root) %dir %{_datadir}/munin/cgi
293 %attr(755,munin,root) %{_datadir}/munin/cgi/munin-cgi-graph
294 %attr(755,munin,root) %{_datadir}/munin/cgi/munin-cgi-html
295 %attr(755,munin,root) %dir %{_htmldir}
296 %{perl_vendorlib}/Munin/Master
297 %{_mandir}/man3/Munin::Master*
298 %{_mandir}/man5/munin.conf*
299 %{_mandir}/man8/munin-check*
300 %{_mandir}/man8/munin-cron*
301 %{_mandir}/man8/munin-graph*
302 %{_mandir}/man8/munin-html*
303 %{_mandir}/man8/munin-limits*
304 %{_mandir}/man8/munin-update*
305 %{_mandir}/man8/munin.*
306 %attr(771,munin,munin) %dir /var/lib/munin/db
307 %attr(770,munin,http) %dir /var/lib/munin/db/cgi-tmp
308 %attr(660,munin,http) %ghost /var/log/munin/munin-cgi-graph.log
309 %attr(660,munin,http) %ghost /var/log/munin/munin-cgi-html.log
310 %attr(660,munin,http) %ghost /var/log/munin/munin-graph.log
311 %attr(660,munin,http) %ghost /var/log/munin/munin-html.log
312 %attr(660,munin,http) %ghost /var/log/munin/munin-limits.log
313 %attr(660,munin,http) %ghost /var/log/munin/munin-update.log
314
315 %files common
316 %defattr(644,root,root,755)
317 %doc README ChangeLog logo* Checklist
318 %dir %{_datadir}/munin
319 %attr(770,munin,http) %dir /var/log/munin
320 %attr(750,munin,http) %dir /var/log/archive/munin
321 %attr(771,munin,munin) %dir /var/lib/munin
322 %attr(770,munin,http) %dir /var/run/munin
323 %dir %{perl_vendorlib}/Munin
324 %{perl_vendorlib}/Munin/Common
325 %{_mandir}/man3/Munin::Common*
326
327 %files async
328 %defattr(644,root,root,755)
329 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/munin-asyncd
330 %attr(754,root,root) /etc/rc.d/init.d/munin-asyncd
331 %attr(755,root,root) %{_sbindir}/munin-asyncd
332 %attr(755,root,root) %{_datadir}/munin/munin-async
333
334 %files node
335 %defattr(644,root,root,755)
336 %dir %{_sysconfdir}
337 %dir %{_sysconfdir}/plugins
338 %dir %{_sysconfdir}/plugin-conf.d
339 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/munin-node.conf
340 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/plugins.conf
341 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/plugin-conf.d/munin-node
342 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/munin-node
343 %attr(754,root,root) /etc/rc.d/init.d/munin-node
344 %attr(755,root,root) %{_bindir}/munindoc
345 %attr(755,root,root) %{_sbindir}/munin-node
346 %attr(755,root,root) %{_sbindir}/munin-node-configure
347 %attr(755,root,root) %{_sbindir}/munin-run
348 %attr(755,root,root) %{_sbindir}/munin-sched
349 %{perl_vendorlib}/Munin/Node
350 %{perl_vendorlib}/Munin/Plugin
351 %{perl_vendorlib}/Munin/Plugin.pm
352 %dir %{_datadir}/munin/plugins
353 %attr(755,root,root) %{_datadir}/munin/plugins/*
354 %if !%{with sybase}
355 %exclude %{_datadir}/munin/plugins/sybase_space
356 %endif
357 %dir %attr(770,munin,munin) /var/lib/munin/plugin-state
358 %dir %attr(770,munin,munin) /var/spool/munin
359 %{_mandir}/man1/munin-node*
360 %{_mandir}/man1/munin-run*
361 %{_mandir}/man1/munin-sched*
362 %{_mandir}/man1/munindoc*
363 %{_mandir}/man3/Munin::Node*
364 %{_mandir}/man3/Munin::Plugin*
365 %{_mandir}/man5/munin-node.conf*