SPECS: mailgraph.spec - migrate to webapps framework - add stats u...
glen
glen at pld-linux.org
Sun Mar 5 14:27:46 CET 2006
Author: glen Date: Sun Mar 5 13:27:46 2006 GMT
Module: SPECS Tag: HEAD
---- Log message:
- migrate to webapps framework
- add stats user to syslog group if sysklogd is used
- package /var/log/mailgraph.log ghost which stats user attempts to log into
- use %service
- rel 3
---- Files affected:
SPECS:
mailgraph.spec (1.37 -> 1.38)
---- Diffs:
================================================================
Index: SPECS/mailgraph.spec
diff -u SPECS/mailgraph.spec:1.37 SPECS/mailgraph.spec:1.38
--- SPECS/mailgraph.spec:1.37 Sun Feb 12 21:22:03 2006
+++ SPECS/mailgraph.spec Sun Mar 5 14:27:41 2006
@@ -1,14 +1,10 @@
# $Revision$, $Date$
-#
-# TODO:
-# - switch to webapps framework...
-#
%include /usr/lib/rpm/macros.perl
Summary: Simple mail statistics for Postfix
Summary(pl): Proste statystyki dla Postfiksa
Name: mailgraph
Version: 1.12
-Release: 2
+Release: 3
License: GPL v2
Group: Applications/Networking
Source0: http://people.ee.ethz.ch/~dws/software/mailgraph/pub/%{name}-%{version}.tar.gz
@@ -20,19 +16,22 @@
Patch1: %{name}-postfix_rbl.patch
URL: http://people.ee.ethz.ch/~dws/software/mailgraph/
BuildRequires: rpm-perlprov
-BuildRequires: rpmbuild(macros) >= 1.176
+BuildRequires: rpmbuild(macros) >= 1.268
Requires(post,preun): /sbin/chkconfig
-Requires(post,preun): grep
-Requires(preun): fileutils
-Requires: apache >= 2.0
-Requires: apache-mod_expires
+Requires(triggerpostun): sed >= 4.0
+Requires: apache(mod_cgi)
+Requires: apache(mod_expires)
Requires: postfix
Requires: rc-scripts
+Requires: webserver = apache
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define _pkglibdir /var/lib/%{name}
-%define _httpappsdir %{_datadir}/%{name}
+%define _webapps /etc/webapps
+%define _webapp %{name}
+%define _sysconfdir %{_webapps}/%{_webapp}
+%define _appdir %{_prefix}/lib/cgi-bin/%{_webapp}
+%define _pkglibdir /var/lib/%{name}
%description
Mailgraph is a very simple mail statistics RRDtool frontend for
@@ -51,70 +50,84 @@
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig,httpd},%{_bindir}} \
- $RPM_BUILD_ROOT{%{_httpappsdir},%{_pkglibdir}/img}
-
-install mailgraph.cgi $RPM_BUILD_ROOT%{_httpappsdir}/index.cgi
-install mailgraph.pl $RPM_BUILD_ROOT%{_bindir}/mailgraph.pl
+install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig},%{_sysconfdir},%{_sbindir}} \
+ $RPM_BUILD_ROOT{%{_appdir},%{_pkglibdir}/img,/var/log}
+install mailgraph.cgi $RPM_BUILD_ROOT%{_appdir}/index.cgi
+install mailgraph.pl $RPM_BUILD_ROOT%{_sbindir}/mailgraph.pl
install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/mailgraph
-install %{SOURCE3} $RPM_BUILD_ROOT/etc/httpd/%{name}.conf
+install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
+install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
+touch $RPM_BUILD_ROOT/var/log/mailgraph.log
%clean
rm -rf $RPM_BUILD_ROOT
+%triggerin -- syslog >= 1.4.1-19
+m=$(%addusertogroup stats syslog)
+if [ -n "$m" ]; then
+ echo >&2 "$m"
+ %service %{name} restart
+fi
+
%post
/sbin/chkconfig --add %{name}
-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
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-elif [ -d /etc/httpd/httpd.conf ]; then
- ln -sf /etc/httpd/%{name}.conf /etc/httpd/httpd.conf/99_%{name}.conf
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
-if [ -f /var/lock/subsys/%{name} ]; then
- /etc/rc.d/init.d/%{name} restart 1>&2
-else
- %banner %{name} -e <<EOF
-Run "/etc/rc.d/init.d/%{name} start" to start %{name} daemon.
-EOF
+%service %{name} restart
+if [ ! -f /var/log/mailgraph.log ]; then
+ touch /var/log/mailgraph.log
+ chown stats /var/log/mailgraph.log
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
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
- if [ -f /var/lock/subsys/%{name} ]; then
- /etc/rc.d/init.d/%{name} stop 1>&2
- fi
+ %service %{name} stop
/sbin/chkconfig --del %{name}
fi
+%triggerin -- apache1
+%webapp_register apache %{_webapp}
+
+%triggerun -- apache1
+%webapp_unregister apache %{_webapp}
+
+%triggerin -- apache < 2.2.0, apache-base
+%webapp_register httpd %{_webapp}
+
+%triggerun -- apache < 2.2.0, apache-base
+%webapp_unregister httpd %{_webapp}
+
+%triggerpostun -- %{name} < 1.12-2.2
+# nuke very-old config location (this mostly for Ra)
+if [ -f /etc/httpd/httpd.conf ]; then
+ sed -i -e "/^Include.*%{name}.conf/d" /etc/httpd/httpd.conf
+fi
+
+# migrate from httpd (apache2) config dir
+if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
+ cp -f %{_sysconfdir}/httpd.conf{,.rpmnew}
+ mv -f /etc/httpd/%{name}.conf.rpmsave %{_sysconfdir}/httpd.conf
+ sed -i -e 's,/usr/share/mailgraph,%{_appdir},' %{_sysconfdir}/httpd.conf
+fi
+
+rm -f /etc/httpd/conf.d/99_mailgraph.conf
+/usr/sbin/webapp register httpd %{_webapp}
+%service -q httpd reload
+
%files
%defattr(644,root,root,755)
%doc README CHANGES
-%attr(755,root,root) %{_bindir}/mailgraph.pl
+%dir %attr(750,root,http) %{_sysconfdir}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
+%attr(755,root,root) %{_sbindir}/mailgraph.pl
%attr(754,root,root) /etc/rc.d/init.d/mailgraph
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/mailgraph
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/httpd/mailgraph.conf
-%dir %{_httpappsdir}
-%attr(755,root,root) %{_httpappsdir}/index.cgi
+%dir %{_appdir}
+%attr(755,root,root) %{_appdir}/index.cgi
%attr(771,root,stats) %dir %{_pkglibdir}
%attr(775,root,http) %dir %{_pkglibdir}/img
+%ghost /var/log/mailgraph.log
%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
%changelog
@@ -122,6 +135,13 @@
All persons listed below can be reached at <cvs_login>@pld-linux.org
$Log$
+Revision 1.38 2006/03/05 13:27:41 glen
+- migrate to webapps framework
+- add stats user to syslog group if sysklogd is used
+- package /var/log/mailgraph.log ghost which stats user attempts to log into
+- use %service
+- rel 3
+
Revision 1.37 2006/02/12 20:22:03 blues
- TODO added
@@ -152,7 +172,7 @@
Revision 1.28 2005/02/04 14:22:09 pzurowski
- BR: rpmbuild(macros) >= 1.176 due to:
-- %%banner support
+- %banner support
Revision 1.27 2004/11/03 11:36:42 orzech
- up to 1.10, rel.1
@@ -236,7 +256,7 @@
- adaptarized
Revision 1.4 2002/01/18 02:13:47 kloczek
-perl -pi -e "s/pld-list\@pld.org.pl/feedback\@pld.org.pl/"
+- perl -pi -e "s/pld-list\@pld.org.pl/feedback\@pld.org.pl/"
Revision 1.3 2001/12/08 02:19:39 blues
- added sources url
================================================================
---- CVS-web:
http://cvs.pld-linux.org/SPECS/mailgraph.spec?r1=1.37&r2=1.38&f=u
More information about the pld-cvs-commit
mailing list