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
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.
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.
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
%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