SPECS: munin.spec - added apache config and pre/post scripts - sim...

baggins baggins at pld-linux.org
Thu Oct 6 23:48:17 CEST 2005


Author: baggins                      Date: Thu Oct  6 21:48:17 2005 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- added apache config and pre/post scripts
- simplify use of sysconfdir macro
- move html stuff to /home/services/httpd/html/munin

---- Files affected:
SPECS:
   munin.spec (1.11 -> 1.12) 

---- Diffs:

================================================================
Index: SPECS/munin.spec
diff -u SPECS/munin.spec:1.11 SPECS/munin.spec:1.12
--- SPECS/munin.spec:1.11	Thu Oct  6 19:28:43 2005
+++ SPECS/munin.spec	Thu Oct  6 23:48:12 2005
@@ -16,6 +16,7 @@
 Source1:	%{name}-node.init
 Source2:	%{name}.cron
 Source3:	%{name}-Makefile.config
+Source4:	%{name}-apache.conf
 Patch0:		%{name}-Makefile.patch
 URL:		http://munin.sourceforge.net/
 BuildRequires:	htmldoc
@@ -29,6 +30,9 @@
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
+%define		_sysconfdir	/etc/%{name}
+%define		htmldir		/home/services/httpd/html/%{name}
+
 %description
 Munin, formerly known as The Linpro RRD server, queries a number of
 nodes, and processes the data using RRDtool and presents it on web
@@ -94,9 +98,9 @@
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,cron.d}
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/munin/{plugins,plugin-conf.d}
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/{plugins,plugin-conf.d}
 install -d $RPM_BUILD_ROOT/var/{lib,log}/munin
-install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/html
+install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/cgi
 
 %{__make} install \
 	CONFIG=Makefile.config.pld \
@@ -107,13 +111,16 @@
 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/munin-node
 install %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/munin
 
+install %{SOURCE4} $RPM_BUILD_ROOT/%{_sysconfdir}/apache.conf
+
 install node/node.d/README README.plugins
 
-install dists/tarball/plugins.conf $RPM_BUILD_ROOT%{_sysconfdir}/munin/
-install dists/tarball/plugins.conf $RPM_BUILD_ROOT%{_sysconfdir}/munin/plugin-conf.d/munin-node
+install dists/tarball/plugins.conf $RPM_BUILD_ROOT%{_sysconfdir}/
+install dists/tarball/plugins.conf $RPM_BUILD_ROOT%{_sysconfdir}/plugin-conf.d/munin-node
 
-install server/munin-htaccess $RPM_BUILD_ROOT%{_datadir}/%{name}/html/.htaccess
-install server/style.css $RPM_BUILD_ROOT%{_datadir}/%{name}/html
+install server/munin-htaccess $RPM_BUILD_ROOT%{htmldir}/.htaccess
+install server/style.css $RPM_BUILD_ROOT%{htmldir}/
+mv -f $RPM_BUILD_ROOT%{htmldir}/cgi/* $RPM_BUILD_ROOT%{_datadir}/%{name}/cgi/
 
 # A hack so rpm won't find deps on perl(DBD::Sybase)
 %if %{without sybase}
@@ -123,6 +130,32 @@
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post
+if [ -f /etc/httpd/httpd.conf ] && ! grep -q "^Include.*/etc/%{name}/apache.conf" /etc/httpd/httpd.conf; then
+        echo "Include /etc/%{name}/apache.conf" >> /etc/httpd/httpd.conf
+elif [ -d /etc/httpd/httpd.conf ]; then
+        ln -sf /etc/%{name}/apache.conf /etc/httpd/httpd.conf/99_%{name}.conf
+fi
+if [ -f /var/lock/subsys/httpd ]; then
+        /usr/sbin/apachectl restart 1>&2
+fi
+
+%preun
+if [ "$1" = "0" ]; then
+        umask 027
+        if [ -d /etc/httpd/httpd.conf ]; then
+                rm -f /etc/httpd/httpd.conf/99_%{name}.conf
+        else
+                grep -v "^Include.*/etc/%{name}/apache.conf" /etc/httpd/httpd.conf > \
+                        /etc/httpd/httpd.conf.tmp
+                mv -f /etc/httpd/httpd.conf.tmp /etc/httpd/httpd.conf
+        fi
+
+        if [ -f /var/lock/subsys/httpd ]; then
+                /usr/sbin/apachectl restart 1>&2
+        fi
+fi
+
 %post node
 if [ "$1" = "1" ] ; then
 	/sbin/chkconfig --add munin-node
@@ -155,19 +188,20 @@
 %files
 %defattr(644,root,root,755)
 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/cron.d/munin
-%dir %{_sysconfdir}/munin/templates
-%{_sysconfdir}/munin/templates/*
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/munin/munin.conf
+%dir %{_sysconfdir}/templates
+%{_sysconfdir}/templates/*
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/munin.conf
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
 %attr(755,root,root) %{_sbindir}/munin-cron
 %attr(755,root,root) %{_datadir}/munin/munin-graph
 %attr(755,root,root) %{_datadir}/munin/munin-html
 %attr(755,root,root) %{_datadir}/munin/munin-limits
 %attr(755,root,root) %{_datadir}/munin/munin-update
-%attr(755,munin,root) %dir %{_datadir}/munin/html
-%attr(755,munin,root) %dir %{_datadir}/munin/html/cgi
-%attr(644,munin,root) %{_datadir}/munin/html/.htaccess
-%attr(644,munin,root) %{_datadir}/munin/html/style.css
-%attr(755,munin,root) %{_datadir}/munin/html/cgi/munin-cgi-graph
+%attr(755,munin,root) %dir %{htmldir}
+%attr(644,munin,root) %{htmldir}/.htaccess
+%attr(644,munin,root) %{htmldir}/style.css
+%attr(755,munin,root) %dir %{_datadir}/munin/cgi
+%attr(755,munin,root) %{_datadir}/munin/cgi/munin-cgi-graph
 %{perl_vendorlib}/Munin.pm
 %{_mandir}/man8/munin-graph*
 %{_mandir}/man8/munin-update*
@@ -181,17 +215,17 @@
 %doc README.api README.plugins ChangeLog
 # %{_docdir}/munin/README.config
 %doc build/doc/*.{html,pdf}
-%dir %{_sysconfdir}/munin
+%dir %{_sysconfdir}
 %dir %{_datadir}/munin
 %attr(750,munin,root) %dir /var/log/munin
 %attr(770,munin,munin) %dir /var/lib/munin
 
 %files node
 %defattr(644,root,root,755)
-%dir %{_sysconfdir}/munin/plugins
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/munin/munin-node.conf
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/munin/plugins.conf
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/munin/plugin-conf.d/munin-node
+%dir %{_sysconfdir}/plugins
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/munin-node.conf
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/plugins.conf
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/plugin-conf.d/munin-node
 %attr(754,root,root) /etc/rc.d/init.d/munin-node
 %attr(755,root,root) %{_sbindir}/munin-run
 %attr(755,root,root) %{_sbindir}/munin-node
@@ -210,6 +244,11 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.12  2005/10/06 21:48:12  baggins
+- added apache config and pre/post scripts
+- simplify use of sysconfdir macro
+- move html stuff to /home/services/httpd/html/munin
+
 Revision 1.11  2005/10/06 17:28:43  baggins
 - fix source numbers
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/munin.spec?r1=1.11&r2=1.12&f=u




More information about the pld-cvs-commit mailing list