/[gentoo-x86]/mail-filter/dspam/dspam-3.10.2-r1.ebuild
Gentoo

Contents of /mail-filter/dspam/dspam-3.10.2-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Sun Sep 23 08:15:37 2012 UTC (2 years, 2 months ago) by phajdan.jr
Branch: MAIN
Changes since 1.2: +2 -2 lines
x86 stable wrt bug #433299

(Portage version: 2.1.11.9/cvs/Linux i686)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.10.2-r1.ebuild,v 1.2 2012/09/08 13:11:53 ago Exp $
4
5 EAPI=4
6
7 inherit eutils user
8
9 DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter"
10 HOMEPAGE="http://dspam.sourceforge.net/"
11 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
12 LICENSE="AGPL-3"
13 SLOT="0"
14 KEYWORDS="amd64 ~ppc x86"
15 DRIVERS_IUSE="+hash mysql postgres sqlite"
16 SCALES_IUSE="small-scale +domain-scale large-scale"
17 IUSE="clamav daemon debug ldap static-libs syslog virtual-users user-homedirs ${DRIVERS_IUSE} ${SCALES_IUSE}"
18
19 DEPEND="
20 ldap? ( net-nds/openldap )
21 mysql? ( >=virtual/mysql-5.0 )
22 postgres? ( dev-db/postgresql-base )
23 sqlite? ( dev-db/sqlite:3 )
24 "
25
26 RDEPEND="
27 ${DEPEND}
28 clamav? ( app-antivirus/clamav )
29 syslog? ( virtual/logger )
30 "
31
32 # Demands on sane USE flags:
33 # - find out what driver to use: select at least one
34 # - if static-libs is set, only one driver may be selected
35 # - find out what scale to use: select exactly one
36 # - user-homedirs does not work with virtual-users
37 REQUIRED_USE="
38 || ( ${DRIVERS_IUSE//+} )
39 static-libs? ( ^^ ( ${DRIVERS_IUSE//+} ) )
40 ^^ ( ${SCALES_IUSE//+} )
41 virtual-users? ( !user-homedirs )
42 "
43
44 # dspam setup defaults
45 DSPAM_HOME=/var/spool/dspam
46 DSPAM_CONF=/etc/dspam
47 DSPAM_LOG=/var/log/dspam
48 DSPAM_MODE=2510
49 DSPAM_DRIVERS=
50 DSPAM_DRIVERS_EXTRAS=
51
52 pkg_setup() {
53 # setup storage, this sets DSPAM_DRIVERS
54 dspam_setup_storage_drivers
55
56 # create dspam user and group
57 dspam_setup_user
58 }
59
60 src_configure() {
61 econf \
62 --sysconfdir=${DSPAM_CONF} \
63 --with-dspam-home=${DSPAM_HOME} \
64 --with-dspam-home-group=dspam \
65 --with-dspam-mode=${DSPAM_MODE} \
66 --with-dspam-group=dspam \
67 --with-logdir=${DSPAM_LOG} \
68 --enable-external-lookup \
69 --enable-long-usernames \
70 --enable-split-configuration \
71 $(use_enable clamav) \
72 $(use_enable daemon) \
73 $(use_enable debug) \
74 $(use_enable debug bnr-debug) \
75 $(use_enable debug verbose-debug) \
76 $(use_enable domain-scale) \
77 $(use_enable large-scale) \
78 $(use_enable static-libs static) \
79 $(use_enable syslog) \
80 $(use_enable user-homedirs homedir) \
81 $(use_enable virtual-users) \
82 --with-storage-driver=${DSPAM_DRIVERS} ${DSPAM_DRIVERS_EXTRAS} \
83 $(use mysql || use postgres && echo "--enable-preferences-extension") \
84 $(use syslog || echo "--with-logfile=${DSPAM_LOG}/dspam.log")
85 }
86
87 dspam_setup_user() {
88 # DSPAM CGI web gui (www-apps/dspam-web) needs to run as a regular user
89 # under suexec in apache, so DSPAM user/group need to be regular users too
90
91 local euid egid
92 for euid in {1000..5000} ; do
93 [ -z "$(egetent passwd ${euid})" ] && break
94 done
95 for egid in {1000..5000} ; do
96 [ -z "$(egetent group ${egid})" ] && break
97 done
98 enewgroup dspam ${egid}
99 enewuser dspam ${euid} -1 "${DSPAM_HOMEDIR}" dspam,mail
100 }
101
102 dspam_setup_storage_drivers() {
103 # Find out which storage drivers need to be enabled, and set some
104 # variables so that src_configure can pick them up
105
106 if use hash; then
107 DSPAM_DRIVERS+=",hash_drv"
108 fi
109
110 if use mysql; then
111 DSPAM_DRIVERS+=",mysql_drv"
112 DSPAM_DRIVERS_EXTRAS+="--with-mysql-includes=/usr/include/mysql "
113 fi
114
115 if use postgres; then
116 DSPAM_DRIVERS+=",pgsql_drv"
117 fi
118
119 if use sqlite; then
120 DSPAM_DRIVERS+=",sqlite3_drv"
121 fi
122
123 if ! use static-libs; then
124 # set the driver name twice to avoid a static build
125 DSPAM_DRIVERS+=${DSPAM_DRIVERS}
126 fi
127
128 # remove first comma separator
129 DSPAM_DRIVERS=${DSPAM_DRIVERS:1}
130 einfo "Building with drivers: ${DSPAM_DRIVERS}"
131 #echo DSPAM_DRIVERS_EXTRAS=$DSPAM_DRIVERS_EXTRAS
132 }
133
134 src_install() {
135 default
136
137 if use daemon; then
138 newinitd "${FILESDIR}/dspam.initd" dspam
139 newconfd "${FILESDIR}/dspam.confd" dspam
140 fi
141
142 if use mysql; then
143 insinto "/usr/share/${PN}/mysql"
144
145 local files="mysql_objects-4.1.sql mysql_objects-space.sql mysql_objects-speed.sql purge-4.1.sql purge.sql"
146 if use virtual-users; then
147 files+=" virtual_user_aliases.sql virtual_users.sql"
148 fi
149
150 for file in $files; do
151 doins src/tools.mysql_drv/${file}
152 done
153 fi
154
155 if use postgres; then
156 insinto "/usr/share/${PN}/pgsql"
157
158 local files="pgsql_objects.sql purge-pe.sql purge.sql"
159 if use virtual-users; then
160 files+=" virtual_users.sql"
161 fi
162
163 for file in $files; do
164 doins src/tools.pgsql_drv/${file}
165 done
166 fi
167
168 if use sqlite; then
169 insinto "/usr/share/${PN}/sqlite"
170 newins src/tools.sqlite_drv/purge-3.sql purge.sql
171 fi
172
173 insinto "${DSPAM_HOME}/txt"
174 doins txt/*.txt
175 for i in spam nonspam; do
176 echo "Scanned and tagged with DSPAM ${PV} on Gentoo Linux as ${i} by ISP" > "${T}/msgtag.${i}"
177 doins "${T}/msgtag.${i}"
178 done
179
180 exeinto /usr/bin
181 newexe contrib/dspam_maintenance/dspam_maintenance.sh dspam_maintenance
182 exeinto /etc/cron.daily
183 newexe "${FILESDIR}/dspam.cron-r4" dspam
184
185 insinto /etc/logrotate.d
186 newins "${FILESDIR}/dspam.logrotate" dspam
187
188 dodoc CHANGELOG README* RELEASE.NOTES UPGRADING doc/*.txt
189
190 # stop logrotate-3.8 from complaining
191 dodir /var/log/dspam
192 fowners dspam:dspam /var/log/dspam
193 fperms 0750 /var/log/dspam
194
195 # Install dspamc setgid
196 fowners root:dspam /usr/bin/dspamc &&
197 fperms g+s /usr/bin/dspamc ||
198 die "failed to alter dspamc owner:group or mode"
199 }
200
201 pkg_preinst() {
202 # dspam-3.10.0: config dir change, should be removed at some later point
203 if [ -d "${ROOT}/etc/mail/dspam" ]; then
204 ewarn "The configuration directory of DSPAM has been relocated from /etc/mail/dspam to ${DSPAM_CONF}."
205 if [ -h "${ROOT}${DSPAM_CONF}" ]; then
206 # symlink, this is the setup in older ebuilds
207 ewarn "Moving contents of /etc/mail/dspam to ${DSPAM_CONF} ..."
208 rm "${ROOT}${DSPAM_CONF}" && mv "${ROOT}/etc/mail/dspam" "${DSPAM_CONF}"
209 eend $?
210
211 elif [ -d "${ROOT}${DSPAM_CONF}" ]; then
212 # directory and no symlink, do it manually since we cannot decide.
213 ewarn "You have both /etc/mail/dspam and ${DSPAM_CONF} directories, please delete the former."
214
215 else
216 # nothing interesting in /etc/dspam
217 ewarn "Moving contents of /etc/mail/dspam to ${DSPAM_CONF} ..."
218 mv "${ROOT}/etc/mail/dspam" "${DSPAM_CONF}"
219 eend $?
220 fi
221 fi
222 }

  ViewVC Help
Powered by ViewVC 1.1.20