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