]>
Commit | Line | Data |
---|---|---|
830ec1e8 PG |
1 | # TODO: |
2 | # - make separate 2 packages: daemon and web-frontend | |
6007e901 GS |
3 | %include /usr/lib/rpm/macros.perl |
4 | Summary: Simple mail statistics for Postfix | |
1468d1ac | 5 | Summary(pl.UTF-8): Proste statystyki dla Postfiksa |
6007e901 | 6 | Name: mailgraph |
830ec1e8 | 7 | Version: 1.13 |
7df2f0b5 | 8 | Release: 1 |
b0c0a2dd | 9 | License: GPL v2 |
6007e901 | 10 | Group: Applications/Networking |
830ec1e8 PG |
11 | Source0: http://mailgraph.schweikert.ch/pub/%{name}-%{version}.tar.gz |
12 | # Source0-md5: b59cc2375662f6c113c6be2ab5bfa179 | |
6007e901 | 13 | Source1: %{name}.init |
b0c0a2dd | 14 | Source2: %{name}.sysconfig |
15 | Source3: %{name}.conf | |
6007e901 | 16 | Patch0: %{name}-paths.patch |
f84cb377 | 17 | Patch1: %{name}-postfix_rbl.patch |
830ec1e8 | 18 | URL: http://mailgraph.schweikert.ch/ |
07c0412f | 19 | BuildRequires: rpm-perlprov |
ca76bcfa | 20 | BuildRequires: rpmbuild(macros) >= 1.268 |
7f328116 | 21 | Requires(post,preun): /sbin/chkconfig |
ca76bcfa ER |
22 | Requires(triggerpostun): sed >= 4.0 |
23 | Requires: apache(mod_cgi) | |
24 | Requires: apache(mod_expires) | |
6007e901 | 25 | Requires: postfix |
5055e318 | 26 | Requires: rc-scripts |
0aebe0d2 | 27 | Requires: webapps |
ca76bcfa | 28 | Requires: webserver = apache |
ff195a84 | 29 | BuildArch: noarch |
6007e901 GS |
30 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
31 | ||
ca76bcfa ER |
32 | %define _webapps /etc/webapps |
33 | %define _webapp %{name} | |
34 | %define _sysconfdir %{_webapps}/%{_webapp} | |
35 | %define _appdir %{_prefix}/lib/cgi-bin/%{_webapp} | |
36 | %define _pkglibdir /var/lib/%{name} | |
b0c0a2dd | 37 | |
6007e901 GS |
38 | %description |
39 | Mailgraph is a very simple mail statistics RRDtool frontend for | |
40 | Postfix that produces daily, weekly, monthly and yearly graphs of | |
41 | received/sent and bounced/rejected mail. | |
42 | ||
32b62a49 | 43 | %description -l pl.UTF-8 |
03d2aa79 | 44 | Mailgraph to prosty frontend na RRDtool do statystyk pocztowych dla |
32b62a49 JR |
45 | Postfiksa. Produkuje wykresy dzienne, tygodniowe, miesięczne i roczne |
46 | poczty wysłanej/odebranej i odbitej/odrzuconej. | |
03d2aa79 | 47 | |
6007e901 GS |
48 | %prep |
49 | %setup -q | |
50 | %patch0 -p1 | |
7df2f0b5 | 51 | %patch1 -p1 |
6007e901 GS |
52 | |
53 | %install | |
54 | rm -rf $RPM_BUILD_ROOT | |
ca76bcfa ER |
55 | install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig},%{_sysconfdir},%{_sbindir}} \ |
56 | $RPM_BUILD_ROOT{%{_appdir},%{_pkglibdir}/img,/var/log} | |
6007e901 | 57 | |
ca76bcfa ER |
58 | install mailgraph.cgi $RPM_BUILD_ROOT%{_appdir}/index.cgi |
59 | install mailgraph.pl $RPM_BUILD_ROOT%{_sbindir}/mailgraph.pl | |
6007e901 | 60 | install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} |
b0c0a2dd | 61 | install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/mailgraph |
ca76bcfa ER |
62 | install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf |
63 | install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf | |
64 | touch $RPM_BUILD_ROOT/var/log/mailgraph.log | |
6007e901 | 65 | |
7f328116 JB |
66 | %clean |
67 | rm -rf $RPM_BUILD_ROOT | |
68 | ||
ca76bcfa ER |
69 | %triggerin -- syslog >= 1.4.1-19 |
70 | m=$(%addusertogroup stats syslog) | |
71 | if [ -n "$m" ]; then | |
72 | echo >&2 "$m" | |
73 | %service %{name} restart | |
74 | fi | |
75 | ||
6007e901 GS |
76 | %post |
77 | /sbin/chkconfig --add %{name} | |
ca76bcfa ER |
78 | %service %{name} restart |
79 | if [ ! -f /var/log/mailgraph.log ]; then | |
80 | touch /var/log/mailgraph.log | |
81 | chown stats /var/log/mailgraph.log | |
6007e901 GS |
82 | fi |
83 | ||
84 | %preun | |
85 | if [ "$1" = "0" ]; then | |
ca76bcfa | 86 | %service %{name} stop |
6007e901 GS |
87 | /sbin/chkconfig --del %{name} |
88 | fi | |
89 | ||
cd42ba4e | 90 | %triggerin -- apache1 < 1.3.37-3, apache1-base |
4ac8df55 ER |
91 | m=$(%addusertogroup http stats) |
92 | if [ -n "$m" ]; then | |
93 | echo >&2 "$m" | |
94 | %service apache restart | |
95 | fi | |
ca76bcfa ER |
96 | %webapp_register apache %{_webapp} |
97 | ||
cd42ba4e | 98 | %triggerun -- apache1 < 1.3.37-3, apache1-base |
ca76bcfa ER |
99 | %webapp_unregister apache %{_webapp} |
100 | ||
101 | %triggerin -- apache < 2.2.0, apache-base | |
4ac8df55 ER |
102 | m=$(%addusertogroup http stats) |
103 | if [ -n "$m" ]; then | |
104 | echo >&2 "$m" | |
105 | %service httpd restart | |
106 | fi | |
ca76bcfa ER |
107 | %webapp_register httpd %{_webapp} |
108 | ||
109 | %triggerun -- apache < 2.2.0, apache-base | |
110 | %webapp_unregister httpd %{_webapp} | |
111 | ||
112 | %triggerpostun -- %{name} < 1.12-2.2 | |
113 | # nuke very-old config location (this mostly for Ra) | |
114 | if [ -f /etc/httpd/httpd.conf ]; then | |
115 | sed -i -e "/^Include.*%{name}.conf/d" /etc/httpd/httpd.conf | |
116 | fi | |
117 | ||
118 | # migrate from httpd (apache2) config dir | |
119 | if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then | |
120 | cp -f %{_sysconfdir}/httpd.conf{,.rpmnew} | |
121 | mv -f /etc/httpd/%{name}.conf.rpmsave %{_sysconfdir}/httpd.conf | |
122 | sed -i -e 's,/usr/share/mailgraph,%{_appdir},' %{_sysconfdir}/httpd.conf | |
123 | fi | |
124 | ||
125 | rm -f /etc/httpd/conf.d/99_mailgraph.conf | |
126 | /usr/sbin/webapp register httpd %{_webapp} | |
127 | %service -q httpd reload | |
128 | ||
e8bca2e4 PG |
129 | %triggerpostun -- %{name} < 1.12-6 |
130 | chown stats:stats %{_pkglibdir}/*.rrd | |
131 | ||
6007e901 GS |
132 | %files |
133 | %defattr(644,root,root,755) | |
7f328116 | 134 | %doc README CHANGES |
ca76bcfa ER |
135 | %dir %attr(750,root,http) %{_sysconfdir} |
136 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf | |
137 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf | |
138 | %attr(755,root,root) %{_sbindir}/mailgraph.pl | |
6007e901 | 139 | %attr(754,root,root) /etc/rc.d/init.d/mailgraph |
5055e318 | 140 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/mailgraph |
ca76bcfa ER |
141 | %dir %{_appdir} |
142 | %attr(755,root,root) %{_appdir}/index.cgi | |
0aebe0d2 | 143 | %attr(770,root,stats) %dir %{_pkglibdir} |
60544aa3 | 144 | %attr(775,root,http) %dir %{_pkglibdir}/img |
ca76bcfa | 145 | %ghost /var/log/mailgraph.log |