1 |
mrness 07/09/10 04:06:02 |
2 |
|
3 |
Modified: ChangeLog |
4 |
Added: dspam-3.8.0-r6.ebuild |
5 |
Removed: dspam-3.8.0-r5.ebuild |
6 |
Log: |
7 |
Use Postgres command vacuumdb --analyse instead --full (#191271). |
8 |
(Portage version: 2.1.2.12) |
9 |
|
10 |
Revision Changes Path |
11 |
1.96 mail-filter/dspam/ChangeLog |
12 |
|
13 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/mail-filter/dspam/ChangeLog?rev=1.96&view=markup |
14 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/mail-filter/dspam/ChangeLog?rev=1.96&content-type=text/plain |
15 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/mail-filter/dspam/ChangeLog?r1=1.95&r2=1.96 |
16 |
|
17 |
Index: ChangeLog |
18 |
=================================================================== |
19 |
RCS file: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v |
20 |
retrieving revision 1.95 |
21 |
retrieving revision 1.96 |
22 |
diff -u -r1.95 -r1.96 |
23 |
--- ChangeLog 9 Sep 2007 20:29:34 -0000 1.95 |
24 |
+++ ChangeLog 10 Sep 2007 04:06:01 -0000 1.96 |
25 |
@@ -1,6 +1,12 @@ |
26 |
# ChangeLog for mail-filter/dspam |
27 |
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2 |
28 |
-# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v 1.95 2007/09/09 20:29:34 mrness Exp $ |
29 |
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v 1.96 2007/09/10 04:06:01 mrness Exp $ |
30 |
+ |
31 |
+*dspam-3.8.0-r6 (10 Sep 2007) |
32 |
+ |
33 |
+ 10 Sep 2007; Alin Năstac <mrness@g.o> files/dspam.cron, |
34 |
+ -dspam-3.8.0-r5.ebuild, +dspam-3.8.0-r6.ebuild: |
35 |
+ Use Postgres command vacuumdb --analyse instead --full (#191271). |
36 |
|
37 |
*dspam-3.8.0-r5 (09 Sep 2007) |
38 |
|
39 |
|
40 |
|
41 |
|
42 |
1.1 mail-filter/dspam/dspam-3.8.0-r6.ebuild |
43 |
|
44 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/mail-filter/dspam/dspam-3.8.0-r6.ebuild?rev=1.1&view=markup |
45 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/mail-filter/dspam/dspam-3.8.0-r6.ebuild?rev=1.1&content-type=text/plain |
46 |
|
47 |
Index: dspam-3.8.0-r6.ebuild |
48 |
=================================================================== |
49 |
# Copyright 1999-2007 Gentoo Foundation |
50 |
# Distributed under the terms of the GNU General Public License v2 |
51 |
# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.8.0-r6.ebuild,v 1.1 2007/09/10 04:06:01 mrness Exp $ |
52 |
|
53 |
WANT_AUTOCONF="latest" |
54 |
WANT_AUTOMAKE="latest" |
55 |
|
56 |
inherit eutils autotools flag-o-matic multilib |
57 |
|
58 |
DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter" |
59 |
HOMEPAGE="http://dspam.nuclearelephant.com/" |
60 |
SRC_URI="http://dspam.nuclearelephant.com/sources/${P}.tar.gz |
61 |
mirror://gentoo/${P}-patches-20070909.tar.gz |
62 |
http://dspam.nuclearelephant.com/sources/extras/dspam_sa_trainer.tar.gz" |
63 |
|
64 |
LICENSE="GPL-2" |
65 |
SLOT="0" |
66 |
IUSE="clamav daemon debug large-domain ldap logrotate mysql postgres \ |
67 |
sqlite sqlite3 virtual-users user-homedirs" |
68 |
|
69 |
DEPEND="clamav? ( >=app-antivirus/clamav-0.90.2 ) |
70 |
ldap? ( >=net-nds/openldap-2.2 ) |
71 |
mysql? ( virtual/mysql ) |
72 |
postgres? ( >=dev-db/postgresql-7.4.3 ) |
73 |
sqlite? ( <dev-db/sqlite-3 ) |
74 |
sqlite3? ( =dev-db/sqlite-3* )" |
75 |
|
76 |
RDEPEND="${DEPEND} |
77 |
sys-process/cronbase |
78 |
virtual/logger |
79 |
logrotate? ( app-admin/logrotate )" |
80 |
|
81 |
KEYWORDS="~alpha ~amd64 ~ppc sparc x86" |
82 |
|
83 |
# some FHS-like structure |
84 |
HOMEDIR="/var/spool/dspam" |
85 |
CONFDIR="/etc/mail/dspam" |
86 |
LOGDIR="/var/log/dspam" |
87 |
DSPAMPERMS=2511 |
88 |
|
89 |
create_dspam_usergroup() { |
90 |
local egid euid |
91 |
#Need a UID and GID >= 1000, for being able to use suexec in apache |
92 |
for euid in $(seq 1000 5000 ) ; do |
93 |
[[ -z $(egetent passwd ${euid}) ]] && break |
94 |
done |
95 |
for egid in $(seq 1000 5000 ) ; do |
96 |
[[ -z $(egetent group ${egid}) ]] && break |
97 |
done |
98 |
|
99 |
enewgroup dspam ${egid} |
100 |
enewuser dspam ${euid} -1 ${HOMEDIR} dspam,mail |
101 |
} |
102 |
|
103 |
pkg_setup() { |
104 |
if use virtual-users && use user-homedirs ; then |
105 |
eerror "If the users are virtual, then they probably should not have home directories." |
106 |
die "Incompatible USE flag selection" |
107 |
fi |
108 |
|
109 |
create_dspam_usergroup |
110 |
} |
111 |
|
112 |
src_unpack() { |
113 |
unpack ${A} |
114 |
cd "${S}" |
115 |
|
116 |
EPATCH_SUFFIX="patch" |
117 |
epatch "${WORKDIR}"/patches |
118 |
|
119 |
# Fix Lazy bindings |
120 |
append-flags $(bindnow-flags) |
121 |
|
122 |
AT_M4DIR="${S}/m4" |
123 |
eautoreconf |
124 |
} |
125 |
|
126 |
src_compile() { |
127 |
local myconf="--enable-long-usernames --enable-syslog" |
128 |
|
129 |
use large-domain && myconf="${myconf} --enable-large-scale" || \ |
130 |
myconf="${myconf} --enable-domain-scale" |
131 |
|
132 |
use user-homedirs && myconf="${myconf} --enable-homedir" |
133 |
|
134 |
use debug && myconf="${myconf} --enable-debug --enable-bnr-debug" |
135 |
|
136 |
if use virtual-users ; then |
137 |
if use mysql || use postgres ; then |
138 |
myconf="${myconf} --enable-virtual-users" |
139 |
fi |
140 |
fi |
141 |
|
142 |
if use mysql || use postgres ; then |
143 |
myconf="${myconf} --enable-preferences-extension" |
144 |
fi |
145 |
|
146 |
local STORAGE="hash_drv" |
147 |
# select storage driver |
148 |
if use sqlite ; then |
149 |
STORAGE="${STORAGE},sqlite_drv" |
150 |
fi |
151 |
if use sqlite3 ; then |
152 |
STORAGE="${STORAGE},sqlite3_drv" |
153 |
fi |
154 |
if use mysql; then |
155 |
STORAGE="${STORAGE},mysql_drv" |
156 |
myconf="${myconf} --with-mysql-includes=/usr/include/mysql" |
157 |
myconf="${myconf} --with-mysql-libraries=/usr/$(get_libdir)/mysql" |
158 |
fi |
159 |
if use postgres ; then |
160 |
STORAGE="${STORAGE},pgsql_drv" |
161 |
myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql" |
162 |
myconf="${myconf} --with-pgsql-libraries=/usr/$(get_libdir)/postgresql" |
163 |
fi |
164 |
|
165 |
econf ${myconf} --with-storage-driver=${STORAGE} \ |
166 |
--with-dspam-home=${HOMEDIR} \ |
167 |
--sysconfdir=${CONFDIR} \ |
168 |
$(use_enable daemon) \ |
169 |
$(use_enable ldap) \ |
170 |
$(use_enable clamav) \ |
171 |
--with-dspam-group=dspam \ |
172 |
--with-dspam-home-group=dspam \ |
173 |
--with-dspam-mode=${DSPAMPERMS} \ |
174 |
--with-logdir=${LOGDIR} || die "econf failed" |
175 |
emake || die "emake failed" |
176 |
} |
177 |
|
178 |
src_install () { |
179 |
diropts -m0770 -o dspam -g dspam |
180 |
dodir ${CONFDIR} |
181 |
insinto ${CONFDIR} |
182 |
insopts -m640 -o dspam -g dspam |
183 |
doins src/dspam.conf |
184 |
|
185 |
dosym /etc/mail/dspam /etc/dspam |
186 |
|
187 |
# make install |
188 |
make DESTDIR="${D}" install || die "make install failed" |
189 |
|
190 |
diropts -m0755 -o dspam -g dspam |
191 |
keepdir /var/run/dspam |
192 |
|
193 |
# create logdir |
194 |
if use debug ; then |
195 |
diropts -m0770 -o dspam -g dspam |
196 |
keepdir ${LOGDIR} |
197 |
fi |
198 |
|
199 |
#clean options |
200 |
diropts -m0755 |
201 |
insopts -m0644 |
202 |
|
203 |
if use daemon; then |
204 |
# We use sockets for the daemon instead of tcp port 24 |
205 |
sed -e 's:^#*\(ServerDomainSocketPath[\t ]\{1,\}\).*:\1\"/var/run/dspam/dspam.sock\":gI' \ |
206 |
-e 's:^#*\(ServerPID[\t ]\{1,\}\).*:\1/var/run/dspam/dspam.pid:gI' \ |
207 |
-e 's:^#*\(ClientHost[\t ]\{1,\}\)/.*:\1\"/var/run/dspam/dspam.sock\":gI' \ |
208 |
-i "${D}/${CONFDIR}/dspam.conf" |
209 |
|
210 |
newinitd "${FILESDIR}/dspam.rc" dspam |
211 |
|
212 |
fowners root:dspam /usr/bin/dspamc |
213 |
fperms u=rx,g=xs,o=x /usr/bin/dspamc |
214 |
fi |
215 |
|
216 |
# generate random password |
217 |
local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" |
218 |
|
219 |
# database related configuration and scripts |
220 |
if use sqlite; then |
221 |
insinto ${CONFDIR} |
222 |
newins src/tools.sqlite_drv/purge-2.sql sqlite_purge.sql |
223 |
fi |
224 |
if use sqlite3; then |
225 |
insinto ${CONFDIR} |
226 |
newins src/tools.sqlite_drv/purge-3.sql sqlite3_purge.sql |
227 |
fi |
228 |
if use mysql; then |
229 |
DSPAM_DB_DATA[0]="/var/run/mysqld/mysqld.sock" |
230 |
DSPAM_DB_DATA[1]="" |
231 |
DSPAM_DB_DATA[2]="dspam" |
232 |
DSPAM_DB_DATA[3]="${PASSWORD}" |
233 |
DSPAM_DB_DATA[4]="dspam" |
234 |
DSPAM_DB_DATA[5]="true" |
235 |
|
236 |
# Modify configuration and create mysql.data file |
237 |
sed -e "s:^#*\(MySQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \ |
238 |
-e "s:^#*\(MySQLPort[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \ |
239 |
-e "s:^#*\(MySQLUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \ |
240 |
-e "s:^#*\(MySQLPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI" \ |
241 |
-e "s:^#*\(MySQLDb[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[4]}:gI" \ |
242 |
-e "s:^#*\(MySQLCompress[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[5]}:gI" \ |
243 |
-i "${D}"/${CONFDIR}/dspam.conf |
244 |
for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do |
245 |
echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> "${D}"/${CONFDIR}/mysql.data |
246 |
done |
247 |
|
248 |
insinto ${CONFDIR} |
249 |
newins src/tools.mysql_drv/mysql_objects-space.sql mysql_objects-space.sql |
250 |
newins src/tools.mysql_drv/mysql_objects-speed.sql mysql_objects-speed.sql |
251 |
newins src/tools.mysql_drv/mysql_objects-4.1.sql mysql_objects-4.1.sql |
252 |
if use virtual-users ; then |
253 |
newins src/tools.mysql_drv/virtual_users.sql mysql_virtual_users.sql |
254 |
newins src/tools.mysql_drv/virtual_user_aliases.sql mysql_virtual_user_aliases.sql |
255 |
fi |
256 |
newins src/tools.mysql_drv/purge.sql mysql_purge.sql |
257 |
newins src/tools.mysql_drv/purge-4.1.sql mysql_purge-4.1.sql |
258 |
|
259 |
fperms 640 ${CONFDIR}/mysql.data |
260 |
fowners root:dspam ${CONFDIR}/mysql.data |
261 |
fi |
262 |
if use postgres ; then |
263 |
DSPAM_DB_DATA[0]="127.0.0.1" |
264 |
DSPAM_DB_DATA[1]="5432" |
265 |
DSPAM_DB_DATA[2]="dspam" |
266 |
DSPAM_DB_DATA[3]="${PASSWORD}" |
267 |
DSPAM_DB_DATA[4]="dspam" |
268 |
|
269 |
# Modify configuration and create pgsql.data file |
270 |
sed -e "s:^#*\(PgSQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \ |
271 |
-e "s:^#*\(PgSQLPort[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \ |
272 |
-e "s:^#*\(PgSQLUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \ |
273 |
-e "s:^#*\(PgSQLPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI" \ |
274 |
-e "s:^#*\(PgSQLDb[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[4]}:gI" \ |
275 |
-e "s:^#*\(PgSQLConnectionCache[\t ]*.\):\1:gI" \ |
276 |
-i "${D}"/${CONFDIR}/dspam.conf |
277 |
for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do |
278 |
echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> "${D}"/${CONFDIR}/pgsql.data |
279 |
done |
280 |
|
281 |
insinto ${CONFDIR} |
282 |
newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql |
283 |
if use virtual-users ; then |
284 |
newins src/tools.pgsql_drv/virtual_users.sql pgsql_virtual_users.sql |
285 |
fi |
286 |
newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql |
287 |
|
288 |
fperms 640 ${CONFDIR}/pgsql.data |
289 |
fowners root:dspam ${CONFDIR}/pgsql.data |
290 |
fi |
291 |
|
292 |
sed -e "s:^\(Purge.*\):###\1:g" \ |
293 |
-e "s:^#\(Purge.*\):\1:g" \ |
294 |
-e "s:^###\(Purge.*\):#\1:g" \ |
295 |
-i "${D}"/${CONFDIR}/dspam.conf |
296 |
if ! ( use mysql || use postgres || use sqlite || use sqlite3 ) ; then |
297 |
# When only one storage driver is compiled, it is linked statically with dspam |
298 |
# thus you should not set the StorageDriver at all |
299 |
# Also, hash_drv requires certain tokenizer and PValue (see bug #185718) |
300 |
sed -e "s:^\(StorageDriver .*\)$:#\1:" \ |
301 |
-e "s:^Tokenizer .*$:Tokenizer sbph:" \ |
302 |
-e "/^#PValue/d" \ |
303 |
-e "s:^PValue .*$:PValue markov:" \ |
304 |
-i "${D}"/${CONFDIR}/dspam.conf |
305 |
fi |
306 |
|
307 |
# installs the notification messages |
308 |
# -> The documentation is wrong! The files need to be in ./txt |
309 |
echo "Scanned and tagged as SPAM with DSPAM ${PV} by Your ISP.com">"${T}"/msgtag.spam |
310 |
echo "Scanned and tagged as non-SPAM with DSPAM ${PV} by Your ISP.com">"${T}"/msgtag.nonspam |
311 |
insinto ${CONFDIR}/txt |
312 |
doins "${S}"/txt/*.txt |
313 |
doins "${T}"/msgtag.* |
314 |
|
315 |
# Create the opt-in / opt-out directories |
316 |
diropts -m0770 -o dspam -g dspam |
317 |
dodir ${HOMEDIR} |
318 |
keepdir ${HOMEDIR}/opt-in |
319 |
keepdir ${HOMEDIR}/opt-out |
320 |
diropts -m0755 |
321 |
|
322 |
# logrotation scripts |
323 |
if use logrotate && use debug ; then |
324 |
insinto /etc/logrotate.d |
325 |
newins "${FILESDIR}/logrotate.dspam" dspam |
326 |
fi |
327 |
|
328 |
# dspam cron job |
329 |
exeinto /etc/cron.daily |
330 |
newexe "${FILESDIR}/dspam.cron" dspam.cron |
331 |
|
332 |
# documentation |
333 |
dodoc CHANGELOG README* RELEASE.NOTES UPGRADING |
334 |
docinto doc |
335 |
dodoc doc/*.txt |
336 |
docinto gentoo |
337 |
dodoc "${FILESDIR}"/README.{postfix,qmail} |
338 |
docinto sa_train |
339 |
dodoc "${WORKDIR}"/dspam_sa_trainer/* |
340 |
doman man/dspam* |
341 |
} |
342 |
|
343 |
pkg_preinst() { |
344 |
# Preserve *.data files |
345 |
local installed_datafiles="${ROOT}"/${CONFDIR}/*.data |
346 |
if [[ "${installed_datafiles}" != *"*.data" ]]; then |
347 |
cp "${ROOT}"/${CONFDIR}/*.data "${D}"/${CONFDIR} |
348 |
fi |
349 |
} |
350 |
|
351 |
pkg_postinst() { |
352 |
# need enewgroup/enewuser in this function for binary install. |
353 |
create_dspam_usergroup |
354 |
|
355 |
ewarn "The hash_drv storage backend has the following requirements:" |
356 |
ewarn " - PValue must be set to 'markov'; Do not use this pvalue with any other storage backend!" |
357 |
ewarn " - Tokenizer must be either 'sbph' or 'osb'" |
358 |
ewarn "See markov.txt for more info." |
359 |
|
360 |
if use mysql || use postgres; then |
361 |
elog |
362 |
elog "To setup DSPAM to run out-of-the-box on your system with a MySQL" |
363 |
elog "or PostgreSQL database, run:" |
364 |
elog "emerge --config =${PF}" |
365 |
fi |
366 |
|
367 |
if use postgres && has_version ">dev-db/postgresql-8.0"; then |
368 |
elog |
369 |
elog "Before executing the configuration command mentioned above you have" |
370 |
elog "to execute the following command:" |
371 |
elog "createlang plpgsql -U postgres dspam" |
372 |
fi |
373 |
|
374 |
if use daemon; then |
375 |
elog |
376 |
elog "If you want to run DSPAM in the new daemon mode remember" |
377 |
elog "to make the DSPAM daemon start during boot:" |
378 |
elog " rc-update add dspam default" |
379 |
fi |
380 |
if use daemon ; then |
381 |
elog |
382 |
elog "To use the DSPAM daemon mode, the used storage driver must be thread-safe." |
383 |
fi |
384 |
|
385 |
elog |
386 |
elog "Edit /etc/mail/dspam.conf with your delivery agent" |
387 |
elog "See http://dspamwiki.expass.de/Installation for more info" |
388 |
elog |
389 |
} |
390 |
|
391 |
pkg_config () { |
392 |
local AVAIL_BACKENDS=() |
393 |
use mysql && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} mysql ) |
394 |
use postgres && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} postgres ) |
395 |
use sqlite && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} sqlite ) |
396 |
use sqlite3 && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} sqlite3 ) |
397 |
local USE_BACKEND |
398 |
read -p "Which backend do you want to configure? (available backends are ${AVAIL_BACKENDS[*]}) " USE_BACKEND |
399 |
if [[ " ${AVAIL_BACKENDS[*]} " != *" ${USE_BACKEND} "* ]] |
400 |
then |
401 |
eerror "The '${USE_BACKEND}' backend is not available." |
402 |
return 1 |
403 |
fi |
404 |
|
405 |
case "${USE_BACKEND}" in |
406 |
|
407 |
sqlite | sqlite3) |
408 |
einfo "sqlite_drv will automatically create the necessary database" |
409 |
;; |
410 |
|
411 |
mysql) |
412 |
DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${CONFDIR}/mysql.data") ) |
413 |
for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do |
414 |
[[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" |
415 |
done |
416 |
DSPAM_MySQL_USER="${DSPAM_DB_DATA[2]}" |
417 |
DSPAM_MySQL_PWD="${DSPAM_DB_DATA[3]}" |
418 |
DSPAM_MySQL_DB="${DSPAM_DB_DATA[4]}" |
419 |
|
420 |
local MYSQL_ROOT_USER="" |
421 |
echo -n "Please enter your administrative MySQL account (default root): " |
422 |
read MYSQL_ROOT_USER |
423 |
if [[ -z "${MYSQL_ROOT_USER}" ]]; then |
424 |
MYSQL_ROOT_USER="root" |
425 |
fi |
426 |
ewarn "When prompted for a password, please enter your MySQL ${MYSQL_ROOT_USER} password" |
427 |
ewarn |
428 |
|
429 |
einfo "Creating DSPAM MySQL database \"${DSPAM_MySQL_DB}\"" |
430 |
/usr/bin/mysqladmin -u ${MYSQL_ROOT_USER} -p create ${DSPAM_MySQL_DB} |
431 |
|
432 |
if has_version ">=virtual/mysql-4.1"; then |
433 |
/usr/bin/mysql -u ${MYSQL_ROOT_USER} -p ${DSPAM_MySQL_DB} < ${CONFDIR}/mysql_objects-4.1.sql |
434 |
else |
435 |
einfo "Creating DSPAM MySQL tables for data objects" |
436 |
einfo " Please select what kind of object database you like to use." |
437 |
einfo " [1] Space optimized database" |
438 |
einfo " [2] Speed optimized database" |
439 |
einfo |
440 |
while true |
441 |
do |
442 |
read -n 1 -s -p " Press 1 or 2 on the keyboard to select database" DSPAM_MySQL_DB_Type |
443 |
[[ "${DSPAM_MySQL_DB_Type}" == "1" || "${DSPAM_MySQL_DB_Type}" == "2" ]] && echo && break |
444 |
done |
445 |
|
446 |
if [[ "${DSPAM_MySQL_DB_Type}" == "1" ]]; then |
447 |
/usr/bin/mysql -u ${MYSQL_ROOT_USER} -p ${DSPAM_MySQL_DB} < ${CONFDIR}/mysql_objects-space.sql |
448 |
else |
449 |
/usr/bin/mysql -u ${MYSQL_ROOT_USER} -p ${DSPAM_MySQL_DB} < ${CONFDIR}/mysql_objects-speed.sql |
450 |
fi |
451 |
fi |
452 |
|
453 |
if use virtual-users ; then |
454 |
einfo "Creating DSPAM MySQL database for virtual-users users" |
455 |
einfo " Please select what kind of virtual_uids table you like to use." |
456 |
einfo " [1] Virtual users added automatically (use this if this server is the primary MX)" |
457 |
einfo " [2] Virtual users added manually (use it if this server is a secondary MX)" |
458 |
einfo |
459 |
while true; do |
460 |
read -n 1 -s -p " Press 1 or 2 on the keyboard to select table type" DSPAM_MySQL_DB_Type |
461 |
[[ "${DSPAM_MySQL_DB_Type}" == "1" || "${DSPAM_MySQL_DB_Type}" == "2" ]] && echo && break |
462 |
done |
463 |
|
464 |
if [[ "${DSPAM_MySQL_DB_Type}" == "1" ]]; then |
465 |
/usr/bin/mysql -u ${MYSQL_ROOT_USER} -p ${DSPAM_MySQL_DB} < ${CONFDIR}/mysql_virtual_users.sql |
466 |
else |
467 |
/usr/bin/mysql -u ${MYSQL_ROOT_USER} -p ${DSPAM_MySQL_DB} < ${CONFDIR}/mysql_virtual_user_aliases.sql |
468 |
fi |
469 |
fi |
470 |
|
471 |
einfo "Creating DSPAM MySQL user \"${DSPAM_MySQL_USER}\"" |
472 |
/usr/bin/mysql -u ${MYSQL_ROOT_USER} -p -e "GRANT SELECT,INSERT,UPDATE,DELETE ON ${DSPAM_MySQL_DB}.* TO ${DSPAM_MySQL_USER}@localhost IDENTIFIED BY '${DSPAM_MySQL_PWD}';FLUSH PRIVILEGES;" -D mysql |
473 |
;; |
474 |
|
475 |
postgres) |
476 |
DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${CONFDIR}/pgsql.data") ) |
477 |
for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do |
478 |
[[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" |
479 |
done |
480 |
DSPAM_PgSQL_USER="${DSPAM_DB_DATA[2]}" |
481 |
DSPAM_PgSQL_PWD="${DSPAM_DB_DATA[3]}" |
482 |
DSPAM_PgSQL_DB="${DSPAM_DB_DATA[4]}" |
483 |
|
484 |
ewarn "When prompted for a password, please enter your PgSQL postgres password" |
485 |
ewarn |
486 |
|
487 |
einfo "Creating DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\" and user \"${DSPAM_PgSQL_USER}\"" |
488 |
/usr/bin/psql -h localhost -d template1 -U postgres -c "CREATE USER ${DSPAM_PgSQL_USER} WITH PASSWORD '${DSPAM_PgSQL_PWD}' NOCREATEDB NOCREATEUSER; CREATE DATABASE ${DSPAM_PgSQL_DB}; GRANT ALL PRIVILEGES ON DATABASE ${DSPAM_PgSQL_DB} TO ${DSPAM_PgSQL_USER}; GRANT ALL PRIVILEGES ON SCHEMA public TO ${DSPAM_PgSQL_USER}; UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='${DSPAM_PgSQL_USER}') WHERE datname='${DSPAM_PgSQL_DB}';" |
489 |
|
490 |
einfo "Creating DSPAM PostgreSQL tables" |
491 |
PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${CONFDIR}/pgsql_objects.sql 1>/dev/null 2>&1 |
492 |
|
493 |
if use virtual-users ; then |
494 |
einfo "Creating DSPAM PostgreSQL database for virtual-users users" |
495 |
PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${CONFDIR}/pgsql_virtual_users.sql 1>/dev/null 2>&1 |
496 |
fi |
497 |
;; |
498 |
|
499 |
esac |
500 |
} |
501 |
|
502 |
|
503 |
|
504 |
-- |
505 |
gentoo-commits@g.o mailing list |