]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # TODO: | |
3 | # - add init script | |
4 | # - add trigger to update apache configuration | |
5 | # | |
6 | %include /usr/lib/rpm/macros.perl | |
7 | Summary: Simple amavisd-new statistics generator | |
8 | Summary(pl.UTF-8): Prosty generator statystyk dla amavisd-new | |
9 | Name: amavis-stats | |
10 | Version: 0.1.22 | |
11 | Release: 0.1 | |
12 | License: GPL | |
13 | Group: Applications/System | |
14 | Source0: http://downloads.topicdesk.com/amavis_stats/%{name}-%{version}.tar.gz | |
15 | # Source0-md5: 5bea6811c00a4fda4b96b6a318a04a92 | |
16 | Patch0: %{name}-gzip.patch | |
17 | Patch1: %{name}-Makefile.patch | |
18 | Patch2: %{name}-pid.patch | |
19 | URL: http://osx.topicdesk.com/content/view/42/59/ | |
20 | BuildRequires: rpmbuild(macros) >= 1.268 | |
21 | BuildRequires: sed >= 4.0 | |
22 | Provides: %{name}-%{version}-%{release} | |
23 | BuildArch: noarch | |
24 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
25 | ||
26 | %define _pkglibdir /var/lib/%{name} | |
27 | %define _pkgcachedir /var/cache/%{name} | |
28 | %define _webapps /etc/webapps | |
29 | %define _webapp %{name} | |
30 | %define _webappdir %{_webapps}/%{_webapp} | |
31 | %define _appdir %{_datadir}/%{_webapp} | |
32 | ||
33 | %description | |
34 | amavis-stats is a simple amavis statistics generator based on rrdtool. | |
35 | It produces graphs from amavisd-new log entries of infections broken | |
36 | down by virus. | |
37 | ||
38 | %description -l pl.UTF-8 | |
39 | amavis-stats jest prostym generatorem statystyk opartym na rrdtool. | |
40 | Tworzy wykresy zainfekowanych wiadomości, w rozbiciu na poszczególne | |
41 | wirusy, na podstawie logów amavisd-new. | |
42 | ||
43 | %package php | |
44 | Summary: PHP interface for amavis-stats | |
45 | Summary(pl.UTF-8): Interfejs PHP dla amavis-stats | |
46 | Group: Applications/System | |
47 | Requires: %{name}-%{version}-%{release} | |
48 | Requires: php(pcre) | |
49 | Requires: webapps | |
50 | Requires: webserver(php) | |
51 | ||
52 | %description php | |
53 | PHP interface for amavis-stats. | |
54 | ||
55 | %description php -l pl.UTF-8 | |
56 | Interfejs PHP dla amavis-stats. | |
57 | ||
58 | %prep | |
59 | %setup -q | |
60 | %patch0 -p1 | |
61 | %patch1 -p1 | |
62 | %patch2 -p1 | |
63 | ||
64 | %build | |
65 | %{__libtoolize} | |
66 | %{__aclocal} | |
67 | %{__autoconf} | |
68 | %{__autoheader} | |
69 | %{__automake} | |
70 | sed -i -e '/basic_machine=powerpc-apple/s/$/\n\t\t;;\n\tnoarch-*)\n\t\tbasic_machine=noarch/;' config.sub | |
71 | %configure \ | |
72 | --with-user=http \ | |
73 | --with-group=http \ | |
74 | --with-log-file=/var/log/maillog | |
75 | %{__make} | |
76 | ||
77 | %install | |
78 | rm -rf $RPM_BUILD_ROOT | |
79 | ||
80 | %{__make} install \ | |
81 | DESTDIR=$RPM_BUILD_ROOT | |
82 | ||
83 | install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp} | |
84 | mv $RPM_BUILD_ROOT{%{_datadir}/amavis-stats/amavis-stats.alias.conf,%{_webapps}/%{_webapp}/httpd.conf} | |
85 | mv $RPM_BUILD_ROOT{%{_datadir}/amavis-stats/amavis-stats.php.conf,%{_webapps}/%{_webapp}} | |
86 | ln -s %{_webapps}/%{_webapp}/amavis-stats.php.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/amavis-stats.php.conf | |
87 | cp $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/{httpd,apache}.conf | |
88 | ||
89 | %clean | |
90 | rm -rf $RPM_BUILD_ROOT | |
91 | ||
92 | %triggerin php -- apache1 < 1.3.37-3, apache1-base | |
93 | %webapp_register apache %{_webapp} | |
94 | ||
95 | %triggerun php -- apache1 < 1.3.37-3, apache1-base | |
96 | %webapp_unregister apache %{_webapp} | |
97 | ||
98 | %triggerin php -- apache < 2.2.0, apache-base | |
99 | %webapp_register httpd %{_webapp} | |
100 | ||
101 | %triggerun php -- apache < 2.2.0, apache-base | |
102 | %webapp_unregister httpd %{_webapp} | |
103 | ||
104 | %triggerpostun php -- %{name}-php < 0.1.13-0.rc6.4.1 | |
105 | if [ -f /etc/httpd/httpd.conf ]; then | |
106 | sed -i -e "/^Include.*%{name}\/apache.conf/d" /etc/httpd/httpd.conf | |
107 | fi | |
108 | ||
109 | if [ -f /etc/%{name}/apache.conf.rpmsave ]; then | |
110 | cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew} | |
111 | mv -f /etc/%{name}/apache.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf | |
112 | fi | |
113 | ||
114 | rm -f /etc/httpd/httpd.conf/99_%{name}.conf | |
115 | /usr/sbin/webapp register httpd %{_webapp} | |
116 | %service -q httpd reload | |
117 | ||
118 | %files | |
119 | %defattr(644,root,root,755) | |
120 | %doc README ChangeLog | |
121 | %attr(755,root,root) %{_sbindir}/amavis-stats | |
122 | %dir %{_pkglibdir} | |
123 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/amavis-stats.conf | |
124 | %{_mandir}/man1/* | |
125 | ||
126 | %files php | |
127 | %defattr(644,root,root,755) | |
128 | %dir %attr(750,root,http) %{_webapps}/%{_webapp} | |
129 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf | |
130 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf | |
131 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/amavis-stats.php.conf | |
132 | %dir %{_appdir} | |
133 | %{_appdir}/amavis-stats.php.conf | |
134 | %{_appdir}/img | |
135 | %{_appdir}/includes | |
136 | %{_appdir}/index.php | |
137 | %{_appdir}/templates | |
138 | %{_appdir}/%{name}.php | |
139 | %{_appdir}/%{name}.html | |
140 | %{_appdir}/*.png | |
141 | %{_appdir}/*.ttf | |
142 | %attr(775,root,http) %dir %{_pkgcachedir} |