Gentoo Archives: gentoo-commits

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