From d93b6dd2ccda3c9bf9a889a525f621480b1e20fb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Fri, 24 Mar 2006 12:10:27 +0000 Subject: [PATCH] - webapps framework, rel .5 Changed files: amavis-stats.spec -> 1.25 --- amavis-stats.spec | 82 ++++++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/amavis-stats.spec b/amavis-stats.spec index 17e67c3..9d652a3 100644 --- a/amavis-stats.spec +++ b/amavis-stats.spec @@ -4,7 +4,7 @@ Summary: Simple amavisd-new statistics generator Summary(pl): Prosty generator statystyk dla amavisd-new Name: amavis-stats Version: 0.1.13 -Release: 0.%{_rc}.4 +Release: 0.%{_rc}.5 License: GPL Group: Applications/System Source0: http://rekudos.net/download/%{name}-%{version}-%{_rc}.tar.gz @@ -14,12 +14,16 @@ Patch0: %{name}-gzip.patch Patch1: %{name}-more_ac.patch Patch2: %{name}-Makefile.patch URL: http://rekudos.net/amavis-stats/ -BuildArch: noarch +BuildRequires: rpmbuild(macros) >= 1.268 Provides: %{name}-%{version}-%{release} +BuildArch: noarch BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) -%define _pkglibdir /var/lib/%{name} -%define _phpdir /usr/share/%{name} +%define _pkglibdir /var/lib/%{name} +%define _webapps /etc/webapps +%define _webapp %{name} +%define _webappdir %{_webapps}/%{_webapp} +%define _appdir %{_datadir}/%{_webapp} %description amavis-stats is a simple amavis statistics generator based on rrdtool. @@ -36,7 +40,9 @@ Summary: PHP interface for amavis-stats Summary(pl): Interfejs PHP dla amavis-stats Group: Applications/System Requires: %{name}-%{version}-%{release} +Requires: php Requires: php-pcre +Requires: webapps %description php PHP interface for amavis-stats. @@ -68,40 +74,40 @@ group=`id -g` web_group=$group install %{SOURCE1} $RPM_BUILD_ROOT/etc/cron.d/amavis-stats - -cd $RPM_BUILD_ROOT%{_datadir}/%{name}/ -ln -s amavis-stats.php index.php - +ln -s amavis-stats.php $RPM_BUILD_ROOT%{_datadir}/%{name}/index.php +install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp} +mv $RPM_BUILD_ROOT{/etc/amavis-stats/apache.conf,%{_webapps}/%{_webapp}/httpd.conf} +cp $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/{httpd,apache}.conf %clean rm -rf $RPM_BUILD_ROOT -%post php -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 +%triggerin php -- apache1 +%webapp_register apache %{_webapp} + +%triggerun php -- apache1 +%webapp_unregister apache %{_webapp} + +%triggerin php -- apache < 2.2.0, apache-base +%webapp_register httpd %{_webapp} + +%triggerun php -- apache < 2.2.0, apache-base +%webapp_unregister httpd %{_webapp} + +%triggerpostun php -- %{name}-php < 0.1.13-0.rc6.4.1 +if [ -f /etc/httpd/httpd.conf ]; then + sed -i -e "/^Include.*%{name}\/apache.conf/d" /etc/httpd/httpd.conf fi -%preun php -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 +if [ -f /etc/%{name}/apache.conf.rpmsave ]; then + cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew} + mv -f /etc/%{name}/apache.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf fi +rm -f /etc/httpd/httpd.conf/99_%{name}.conf +/usr/sbin/webapp register httpd %{_webapp} +%service -q httpd reload + %files %defattr(644,root,root,755) %doc README debian/changelog @@ -112,10 +118,12 @@ fi %files php %defattr(644,root,root,755) -%dir %{_sysconfdir}/%{name} -%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/apache.conf -%dir %{_phpdir} -%dir %attr(755,http,root) %{_phpdir}/img -%{_phpdir}/%{name}.php -%{_phpdir}/index.php -%attr(755,http,http) %dir %{_pkglibdir}/img +%dir %attr(750,root,http) %{_webapps}/%{_webapp} +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf +%dir %{_appdir} +# symlink +%{_appdir}/img +%{_appdir}/%{name}.php +%{_appdir}/index.php +%attr(775,root,http) %dir %{_pkglibdir}/img -- 2.44.0