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