SPECS: awstats.spec - use apache config triggers, rel 1.10

glen glen at pld-linux.org
Mon Aug 22 09:15:13 CEST 2005


Author: glen                         Date: Mon Aug 22 07:15:13 2005 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- use apache config triggers, rel 1.10

---- Files affected:
SPECS:
   awstats.spec (1.37 -> 1.38) 

---- Diffs:

================================================================
Index: SPECS/awstats.spec
diff -u SPECS/awstats.spec:1.37 SPECS/awstats.spec:1.38
--- SPECS/awstats.spec:1.37	Sun Aug 21 19:59:25 2005
+++ SPECS/awstats.spec	Mon Aug 22 09:15:07 2005
@@ -10,7 +10,7 @@
 Summary(pl):	Zaawansowany program do analizowania logów serwera
 Name:		awstats
 Version:	6.5
-Release:	1.5
+Release:	1.10
 License:	GPL
 Group:		Applications/Networking
 Source0:	http://awstats.sourceforge.net/files/%{name}-%{version}.tgz
@@ -22,6 +22,8 @@
 Patch1:		%{name}-created_dir_mode.patch
 URL:		http://awstats.sourceforge.net/
 BuildRequires:	rpm-perlprov
+BuildRequires:	rpmbuild(macros) >= 1.221
+Requires(triggerpostun):	sed >= 4.0
 Requires:	perl-Geo-IP
 Requires:	perl-Time-HiRes
 Requires:	perl-Storable
@@ -76,47 +78,51 @@
 mv $RPM_BUILD_ROOT%{_datadir}/awstats/wwwroot/cgi-bin/awstats.model.conf $RPM_BUILD_ROOT%{_sysconfdir}/awstats
 mv $RPM_BUILD_ROOT%{_datadir}/awstats/wwwroot/cgi-bin/{lang,lib,plugins} $RPM_BUILD_ROOT%{_datadir}/%{name}
 install %{SOURCE1} $RPM_BUILD_ROOT/etc/cron.d/awstats
-install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/%{name}.conf
+install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/apache.conf
 install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/%{name}.conf
 ln -s %{_datadir}/awstats/wwwroot/cgi-bin/awstats.pl $RPM_BUILD_ROOT%{_bindir}
 
-%post
-if [ -f /etc/httpd/httpd.conf ] && ! grep -q "^Include.*/%{name}.conf" /etc/httpd/httpd.conf; then
-	echo "Include /etc/httpd/%{name}.conf" >> /etc/httpd/httpd.conf
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%triggerin -- apache >= 2.0.0
+%apache_config_install -v 2 -c %{_sysconfdir}/awstats/apache.conf
+
+%triggerun -- apache >= 2.0.0
+%apache_config_uninstall -v 2
+
+%triggerpostun -- %{name} < 6.5-1.10
+# migrate from old config location (only apache2, as there was no apache1 support)
+if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
+	cp -f %{_sysconfdir}/apache-%{name}.conf{,.rpmnew}
+	mv -f /etc/httpd/%{name}.conf.rpmsave %{_sysconfdir}/awstats/apache.conf
 	if [ -f /var/lock/subsys/httpd ]; then
-		/etc/rc.d/init.d/httpd restart 1>&2
+		/etc/rc.d/init.d/httpd reload 1>&2
 	fi
-elif [ -d /etc/httpd/httpd.conf ]; then
-	ln -sf /etc/httpd/%{name}.conf /etc/httpd/httpd.conf/99_%{name}.conf
+fi
+
+# nuke very-old config location
+if [ ! -d /etc/httpd/httpd.conf ]; then
+	sed -i -e "/^Include.*%{name}.conf/d" /etc/httpd/httpd.conf
 	if [ -f /var/lock/subsys/httpd ]; then
-		/etc/rc.d/init.d/httpd restart 1>&2
+		/etc/rc.d/init.d/httpd reload 1>&2
 	fi
 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.*%{name}.conf" /etc/httpd/httpd.conf > \
-			/etc/httpd/httpd.conf.tmp
-		mv -f /etc/httpd/httpd.conf.tmp /etc/httpd/httpd.conf
-	fi
+# apache2
+if [ -d /etc/httpd/httpd.conf ]; then
+	ln -sf %{_sysconfdir}/awstats/apache.conf /etc/httpd/httpd.conf/99_%{name}.conf
 	if [ -f /var/lock/subsys/httpd ]; then
-		/etc/rc.d/init.d/httpd restart 1>&2
+		/etc/rc.d/init.d/httpd reload 1>&2
 	fi
 fi
 
-%clean
-rm -rf $RPM_BUILD_ROOT
-
 %files
 %defattr(644,root,root,755)
 %doc README.TXT docs/* tools/webmin tools/xslt
 %dir %{_sysconfdir}/awstats
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/awstats/*.conf
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd/%{name}.conf
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/awstats/awstats*.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/awstats/apache.conf
 %attr(640,root,root) /etc/cron.d/awstats
 %attr(755,root,root) %{_bindir}/*
 %dir %{_datadir}/%{name}
@@ -138,6 +144,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.38  2005/08/22 07:15:07  glen
+- use apache config triggers, rel 1.10
+
 Revision 1.37  2005/08/21 17:59:25  jajcus
 - Release: 1.5
 - Awstats is started with uid of stats. Parsing logs with root privileges is a
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/awstats.spec?r1=1.37&r2=1.38&f=u




More information about the pld-cvs-commit mailing list