]> git.pld-linux.org Git - packages/awstats.git/commitdiff
- use apache config triggers, rel 1.10
authorElan Ruusamäe <glen@pld-linux.org>
Mon, 22 Aug 2005 07:15:07 +0000 (07:15 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    awstats.spec -> 1.38

awstats.spec

index 65829cd324d68ac19355b40efaf93e532d57dac0..cb473de2216edae10ab244a350962c5f95cb4f7b 100644 (file)
@@ -9,7 +9,7 @@ Summary:        Advanced Web Statistics is a free powerful server log file analyzer
 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
@@ -21,6 +21,8 @@ Patch0:               %{name}_conf.patch
 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
@@ -75,47 +77,51 @@ cp -r wwwroot $RPM_BUILD_ROOT%{_datadir}/awstats
 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}
This page took 0.084276 seconds and 4 git commands to generate.