]> TLD Linux GIT Repositories - packages/munin.git/blob - munin.spec
- fixed asyncd init script, added asyncd sysconfig
[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.25
9 Release:        1
10 License:        GPL
11 Group:          Applications/WWW
12 Source0:        http://downloads.sourceforge.net/munin/%{name}-%{version}.tar.gz
13 # Source0-md5:  b418a667ce42665557329a7ac3bd1b93
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 common
74 Summary:        Munin - the Linpro RRD data agent - common files
75 Summary(pl.UTF-8):      Munin - agent danych RRD Linpro - wspólne pliki
76 Group:          Daemons
77 Requires(postun):       /usr/sbin/groupdel
78 Requires(postun):       /usr/sbin/userdel
79 Requires(pre):  /bin/id
80 Requires(pre):  /usr/bin/getgid
81 Requires(pre):  /usr/sbin/groupadd
82 Requires(pre):  /usr/sbin/useradd
83
84 %description common
85 Munin, formerly known as The Linpro RRD server, queries a number of
86 nodes, and processes the data using RRDtool and presents it on web
87 pages.
88
89 %description common -l pl.UTF-8
90 Munin, znany poprzednio jako serwer RRD Linpro, odpytuje wiele węzłów
91 i przetwarza dane przy użyciu RRDtoola, a następnie prezentuje je na
92 stronach WWW.
93
94 %package node
95 Summary:        Linpro RRD data agent
96 Summary(pl.UTF-8):      Agent danych RRD Linpro
97 Group:          Daemons
98 Requires(post,preun):   /sbin/chkconfig
99 Requires:       %{name}-common = %{version}-%{release}
100 Requires:       logtail
101 Requires:       logtool
102 #Requires:      perl-Config-General
103 Requires:       perl-Net-Netmask
104 Requires:       perl-Net-SNMP
105 Requires:       perl-Net-Server
106 Requires:       perl-libwww
107 Requires:       procps >= 2.0.7
108 Requires:       rc-scripts >= 0.4.0.15
109 Requires:       sysstat
110 Suggests:       perl-DBD-Pg
111 Conflicts:      logrotate < 3.7-4
112
113 %description node
114 The Munin node package returns statistical data on the request of a
115 Munin server.
116
117 %description node -l pl.UTF-8
118 Pakiet Munin dla węzła zwraca dane statystyczne na żądanie serwera
119 Munin.
120
121 %prep
122 %setup -q
123 %patch0 -p1
124 %patch1 -p1
125 %patch2 -p1
126 %patch3 -p1
127 %patch4 -p1
128
129 %build
130 %{__make} -j1 build \
131         PERL_MB_OPT="perl=%{__perl}" \
132         JCVALID=no
133
134 %install
135 rm -rf $RPM_BUILD_ROOT
136 install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,cron.d,logrotate.d,sysconfig},%{_bindir},%{_sbindir}} \
137         $RPM_BUILD_ROOT/var/log/archive/munin \
138         $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
139
140 %{__make} -j1 install \
141         JCVALID=no \
142         CHOWN=/bin/true \
143         DESTDIR=$RPM_BUILD_ROOT
144
145 # move asyncd daemon do sbin
146 %{__mv} $RPM_BUILD_ROOT{%{_datadir}/munin,%{_sbindir}}/munin-asyncd
147
148 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/munin-node
149 install -p %{SOURCE11} $RPM_BUILD_ROOT/etc/rc.d/init.d/munin-asyncd
150 install %{SOURCE12} $RPM_BUILD_ROOT/etc/sysconfig/munin-asyncd
151
152 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/munin
153 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/logrotate.d/munin
154 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/munin-node
155
156 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
157 cp -p %{SOURCE8} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
158 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/lighttpd.conf
159
160
161 cp -p dists/tarball/plugins.conf $RPM_BUILD_ROOT%{_sysconfdir}
162 ln -sf %{_sysconfdir}/plugins.conf $RPM_BUILD_ROOT%{_sysconfdir}/plugin-conf.d/munin-node
163
164 for f in cgi-graph cgi-html graph html limits update ; do
165         touch $RPM_BUILD_ROOT/var/log/munin/munin-$f.log
166 done
167
168 %clean
169 rm -rf $RPM_BUILD_ROOT
170
171 %triggerin -- apache1 < 1.3.37-3, apache1-base
172 %webapp_register apache %{_webapp}
173
174 %triggerun -- apache1 < 1.3.37-3, apache1-base
175 %webapp_unregister apache %{_webapp}
176
177 %triggerin -- apache-base
178 %webapp_register httpd %{_webapp}
179
180 %triggerun -- apache-base
181 %webapp_unregister httpd %{_webapp}
182
183 %triggerin -- lighttpd
184 %webapp_register lighttpd %{_webapp}
185
186 %triggerun -- lighttpd
187 %webapp_unregister lighttpd %{_webapp}
188
189 %triggerpostun -- munin < 1.3.4-5
190 # rescue app config
191 if [ -f /etc/munin/munin.conf.rpmsave ]; then
192         mv -f %{_webapps}/%{_webapp}/munin.conf{,.rpmnew}
193         mv -f /etc/munin/munin.conf.rpmsave %{_webapps}/%{_webapp}/munin.conf
194
195         # fix paths in munin.conf
196         sed -i -e 's|dbdir.*|dbdir      /var/lib/munin/db|' \
197                 -e 's|tmpldir.*|tmpldir %{_webapps}/%{_webapp}/templates|' \
198                 %{_webapps}/%{_webapp}/munin.conf
199 fi
200 # move RRDs to new location
201 cd /var/lib/munin
202 for i in *; do
203         case "$i" in
204                 db|html|plugin-state) ;;
205                 *) mv -f "$i" db/ ;;
206         esac
207 done
208
209 %post
210 for f in cgi-graph cgi-html graph html limits update ; do
211         touch /var/log/munin/munin-$f.log
212         chmod 660 /var/log/munin/munin-$f.log
213         chown munin:http /var/log/munin/munin-$f.log
214 done
215
216 %post node
217 if [ "$1" = "1" ] ; then
218         /sbin/chkconfig --add munin-node
219         %{_sbindir}/munin-node-configure --shell | sh
220 fi
221 %service munin-node restart "Munin Node agent"
222 %service munin-asyncd try-restart "Munin Asyncd agent"
223
224 %preun node
225 if [ "$1" = "0" ] ; then
226         %service munin-asyncd stop
227         %service munin-node stop
228         /sbin/chkconfig --del munin-node
229         /sbin/chkconfig --del munin-asyncd
230 fi
231
232 %pre common
233 %groupadd -g 158 munin
234 %useradd -o -u 158 -s /bin/false -g munin -c "Munin Node agent" -d /var/lib/munin munin
235
236 %postun common
237 if [ "$1" = "0" ]; then
238         %userremove munin
239         %groupremove munin
240 fi
241
242 %files
243 %defattr(644,root,root,755)
244 %dir %attr(750,munin,http) %{_webapps}/%{_webapp}
245 %dir %attr(750,munin,http) %{_webapps}/%{_webapp}/munin-conf.d
246 %dir %{_webapps}/%{_webapp}/templates
247 %{_webapps}/%{_webapp}/templates/*.tmpl
248 %dir %{_webapps}/%{_webapp}/templates/static
249 %{_webapps}/%{_webapp}/templates/static/*.css
250 %{_webapps}/%{_webapp}/templates/static/*.html
251 %{_webapps}/%{_webapp}/templates/static/*.ico
252 %{_webapps}/%{_webapp}/templates/static/*.js
253 %{_webapps}/%{_webapp}/templates/static/*.png
254 %dir %{_webapps}/%{_webapp}/templates/partial
255 %{_webapps}/%{_webapp}/templates/partial/*.tmpl
256 %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/munin.conf
257 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
258 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
259 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/lighttpd.conf
260 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/munin
261 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/munin
262 %attr(755,root,root) %{_sbindir}/munin-cron
263 %attr(755,root,root) %{_datadir}/munin/munin-check
264 %attr(755,root,root) %{_datadir}/munin/munin-graph
265 %attr(755,root,root) %{_datadir}/munin/munin-html
266 %attr(755,root,root) %{_datadir}/munin/munin-limits
267 %attr(755,root,root) %{_datadir}/munin/munin-update
268 %attr(755,root,root) %{_datadir}/munin/munin-datafile2storable
269 %attr(755,root,root) %{_datadir}/munin/munin-storable2datafile
270 %attr(755,munin,root) %dir %{_datadir}/munin/cgi
271 %attr(755,munin,root) %{_datadir}/munin/cgi/munin-cgi-graph
272 %attr(755,munin,root) %{_datadir}/munin/cgi/munin-cgi-html
273 %attr(755,munin,root) %dir %{_htmldir}
274 %{perl_vendorlib}/Munin/Master
275 %{_mandir}/man3/Munin::Master*
276 %{_mandir}/man5/munin.conf*
277 %{_mandir}/man8/munin-check*
278 %{_mandir}/man8/munin-cron*
279 %{_mandir}/man8/munin-graph*
280 %{_mandir}/man8/munin-html*
281 %{_mandir}/man8/munin-limits*
282 %{_mandir}/man8/munin-update*
283 %{_mandir}/man8/munin.*
284 %attr(771,munin,munin) %dir /var/lib/munin/db
285 %attr(770,munin,http) %dir /var/lib/munin/db/cgi-tmp
286 %attr(660,munin,http) %ghost /var/log/munin/munin-cgi-graph.log
287 %attr(660,munin,http) %ghost /var/log/munin/munin-cgi-html.log
288 %attr(660,munin,http) %ghost /var/log/munin/munin-graph.log
289 %attr(660,munin,http) %ghost /var/log/munin/munin-html.log
290 %attr(660,munin,http) %ghost /var/log/munin/munin-limits.log
291 %attr(660,munin,http) %ghost /var/log/munin/munin-update.log
292
293 %files common
294 %defattr(644,root,root,755)
295 %doc README ChangeLog logo* Checklist
296 %dir %{_datadir}/munin
297 %attr(770,munin,http) %dir /var/log/munin
298 %attr(750,munin,http) %dir /var/log/archive/munin
299 %attr(771,munin,munin) %dir /var/lib/munin
300 %attr(770,munin,http) %dir /var/run/munin
301 %dir %{perl_vendorlib}/Munin
302 %{perl_vendorlib}/Munin/Common
303 %{_mandir}/man3/Munin::Common*
304
305 %files node
306 %defattr(644,root,root,755)
307 %dir %{_sysconfdir}
308 %dir %{_sysconfdir}/plugins
309 %dir %{_sysconfdir}/plugin-conf.d
310 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/munin-node.conf
311 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/plugins.conf
312 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/plugin-conf.d/munin-node
313 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/munin-node
314 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/munin-asyncd
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*