summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLim Swee Tat <st_lim@gentoo.org>2004-08-21 18:12:21 +0000
committerLim Swee Tat <st_lim@gentoo.org>2004-08-21 18:12:21 +0000
commite5db0c647f2b64ea9225ee43ab7b761722f7a0e3 (patch)
treef35d9aed78fdb350375d0f1a106c2571b076cd83 /mail-filter
parentInitial import (diff)
downloadhistorical-e5db0c647f2b64ea9225ee43ab7b761722f7a0e3.tar.gz
historical-e5db0c647f2b64ea9225ee43ab7b761722f7a0e3.tar.bz2
historical-e5db0c647f2b64ea9225ee43ab7b761722f7a0e3.zip
Fixed bug 57838 on 3.1.1, and version bumped.
Diffstat (limited to 'mail-filter')
-rw-r--r--mail-filter/dspam/ChangeLog10
-rw-r--r--mail-filter/dspam/Manifest7
-rw-r--r--mail-filter/dspam/dspam-3.1.1.ebuild398
-rw-r--r--mail-filter/dspam/files/digest-dspam-3.1.11
-rw-r--r--mail-filter/dspam/files/dspam.cron53
-rw-r--r--mail-filter/dspam/files/logrotate.dspam2
6 files changed, 467 insertions, 4 deletions
diff --git a/mail-filter/dspam/ChangeLog b/mail-filter/dspam/ChangeLog
index cbdcb2c63a8e..71456fe7b9e1 100644
--- a/mail-filter/dspam/ChangeLog
+++ b/mail-filter/dspam/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for mail-filter/dspam
# Copyright 1999-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v 1.9 2004/07/31 04:36:40 st_lim Exp $
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v 1.10 2004/08/21 18:12:21 st_lim Exp $
+
+*dspam-3.1.1 (22 Aug 2004)
+
+ 22 Aug 2004; Lim Swee Tat <st_lim@gentoo.org> +files/dspam.cron,
+ files/logrotate.dspam, +dspam-3.1.1.ebuild:
+ We waited some time before fixing bug #57838. My fault.
+ Thanx to steveb <tp22a@softhome.net> for his kind suppport and help.
+ 3.1.1 built without chi-square and robinson due to compilation errors.
31 Jul 2004; Lim Swee Tat <st_lim@gentoo.org> +dspam-3.1.0.ebuild:
Version bump
diff --git a/mail-filter/dspam/Manifest b/mail-filter/dspam/Manifest
index 382bdcd4993b..24c69a0916be 100644
--- a/mail-filter/dspam/Manifest
+++ b/mail-filter/dspam/Manifest
@@ -1,18 +1,21 @@
+MD5 ed553466dbfdc473ebe412a82aca23b9 dspam-3.1.1.ebuild 14633
MD5 ae3a688715ae77f8c9acfa862adbb8e8 dspam-3.0.0.ebuild 6928
MD5 0b670a5ca13881c4f77d70935c913dcf dspam-3.1.0.ebuild 9277
-MD5 724938273d7091f1b6c7de17c400f98e ChangeLog 2046
+MD5 e134e20bd745f518c01cd8a1097ed433 ChangeLog 2392
MD5 02610fe17122bb3a27ca3dcbf7374fcc metadata.xml 311
MD5 2cd345708a9889a04c472a9e5be7400e files/untrusted.mailer_args 24
MD5 2a79c945ef6c7e7bd45aa1d46ae99e69 files/mysql_install_db 114
MD5 f2f86e8f7ab440c8537f40fa18a0ee43 files/crontab.mysql 118
MD5 05dce5dc8cf516655657aa2a4cc5f1da files/digest-dspam-3.0.0 63
MD5 7f1185a1a89bc7c74aafba93afc2b0cf files/digest-dspam-3.1.0 63
+MD5 1abffcec9dd1aad2db3d68918b4aec05 files/digest-dspam-3.1.1 63
MD5 8b68501138fbe92e10bbd93a03c9f2ab files/upgrade.sql 807
MD5 cd1bdb75fd86304f9453741a910cb8a2 files/crontab.db4 196
MD5 84ec40b77696359ae49560588db9b948 files/mysql.data 52
MD5 e6d1b8232199f288fe75501251ade317 files/trusted.users 19
-MD5 cefc786a1b60f3041eb3972aafb0b543 files/logrotate.dspam 154
+MD5 2163ca41de383f09f4d754e2d35cb158 files/logrotate.dspam 156
MD5 e0469b961385fda4305602dc2519d319 files/README.qmail 2317
+MD5 9a2fda6789f0db17b6a32ca84e9e3884 files/dspam.cron 2501
MD5 9fed58b73e35e02ecc3f9a08dcd94eaa files/mysql_purge_db 73
MD5 a6fc685d30abb83a1ab5ac0181ad1f7c files/pgsql.data 51
MD5 5bcf982f468f4843ef3aa51213cc0023 files/mysql_create_user.sql 194
diff --git a/mail-filter/dspam/dspam-3.1.1.ebuild b/mail-filter/dspam/dspam-3.1.1.ebuild
new file mode 100644
index 000000000000..25b2d01b5a88
--- /dev/null
+++ b/mail-filter/dspam/dspam-3.1.1.ebuild
@@ -0,0 +1,398 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.1.1.ebuild,v 1.1 2004/08/21 18:12:21 st_lim Exp $
+
+inherit eutils
+
+MY_PV=${PV/_beta20/.beta.2}
+S=${WORKDIR}/${PN}-${MY_PV}
+DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter"
+SRC_URI="http://www.nuclearelephant.com/projects/dspam/sources/${PN}-${MY_PV}.tar.gz"
+HOMEPAGE="http://www.nuclearelephant.com/projects/dspam/index.html"
+LICENSE="GPL-2"
+
+IUSE="cyrus debug exim mysql maildrop neural oci8 postgres procmail"
+DEPEND="exim? ( >=mail-mta/exim-4.34 )
+ mysql? ( >=dev-db/mysql-3.23 ) || ( >=sys-libs/db-4.0 )
+ maildrop? ( >=mail-filter/maildrop-1.5.3 )
+ postgres? ( >=dev-db/postgresql-7.4.3 )
+ procmail? ( >=mail-filter/procmail-3.22 )
+ x86? ( cyrus? ( >=net-mail/cyrus-imapd-2.1.15 ) )
+ "
+RDEPEND="virtual/cron
+ app-admin/logrotate"
+KEYWORDS="~x86 ~ppc"
+SLOT="0"
+
+# some FHS-like structure
+HOMEDIR="/etc/mail/dspam"
+DATADIR="/var/spool/dspam"
+LOGDIR="/var/log/dspam"
+CONFIGDIR="${HOMEDIR}/config"
+
+MYSQL_TABLE_TYPE="space.optimized"
+
+pkg_setup() {
+ if (use mysql && use postgres) || \
+ (use mysql && use oci8) || \
+ (use postgres && use oci8); then
+ echo
+ ewarn "You have two of either \"mysql\", \"postgres\" or \"oci\" in your USE flags."
+ ewarn "Will default to MySQL as your dspam database backend."
+ ewarn "If you want to build with Postgres support; hit Control-C now."
+ ewarn "Change your USE flag -mysql and emerge again."
+ echo
+ has_version ">=sys-apps/portage-2.0.50" && (
+ einfo "It would be best practice to add the set of USE flags that you use for this"
+ einfo "package to the file: /etc/portage/package.use. Example:"
+ einfo "\`echo \"net-mail/dspam -mysql postgres\" >> /etc/portage/package.use\`"
+ einfo "to build dspam with Postgres database as your dspam backend."
+ )
+ echo
+ ewarn "Waiting 30 seconds before starting..."
+ ewarn "(Control-C to abort)..."
+ sleep 30
+ fi
+ id dspam 2>/dev/null || enewgroup dspam 65532
+ id dspam 2>/dev/null || enewuser dspam 65532 /bin/bash ${HOMEDIR} dspam
+}
+
+src_compile() {
+ local myconf
+ local agent
+
+ # these are the default settings
+ myconf="${myconf} --with-signature-life=14"
+ if use cyrus; then
+ agent="/usr/lib/cyrus/deliver %u"
+ elif use exim; then
+ agent="/usr/sbin/exim -oMr spam-scanned"
+ elif use maildrop; then
+ agent="/usr/bin/maildrop -d %u"
+ elif use procmail; then
+ agent="/usr/bin/procmail"
+ fi
+ myconf="${myconf} --enable-source-address-tracking"
+ myconf="${myconf} --enable-large-scale"
+ myconf="${myconf} --enable-long-username"
+ myconf="${myconf} --enable-spam-subject"
+ myconf="${myconf} --enable-signature-headers"
+ myconf="${myconf} --enable-whitelist"
+ #myconf="${myconf} --enable-chi-square"
+ #myconf="${myconf} --enable-robinson"
+ #myconf="${myconf} --enable-robinson-pvalues"
+
+ # ${HOMEDIR}/data is a symlink to ${DATADIR}
+ myconf="${myconf} --with-dspam-home=${HOMEDIR}"
+ myconf="${myconf} --with-dspam-mode=4755"
+ myconf="${myconf} --with-dspam-owner=dspam"
+ myconf="${myconf} --with-dspam-group=dspam"
+ myconf="${myconf} --with-dspam-home-owner=dspam"
+ myconf="${myconf} --with-dspam-home-group=dspam"
+ myconf="${myconf} --with-dspam-home-mode=4755"
+
+ # enables support for debugging (touch /etc/dspam/.debug to turn on)
+ # optional: even MORE debugging output, use with extreme caution!
+ use debug && myconf="${myconf} --enable-debug --enable-verbose-debug"
+
+ # select storage driver
+ if use mysql ; then
+ myconf="${myconf} --with-storage-driver=mysql_drv"
+ myconf="${myconf} --with-mysql-includes=/usr/include/mysql"
+ myconf="${myconf} --with-mysql-libraries=/usr/lib/mysql"
+ myconf="${myconf} --with-client-compression"
+ myconf="${myconf} --enable-virtual-users"
+
+ # an experimental feature available with MySQL and PgSQL backend
+ if use neural ; then
+ myconf="${myconf} --enable-neural-networking"
+ fi
+ elif use postgres ; then
+ myconf="${myconf} --with-storage-driver=pgsql_drv"
+ myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql"
+ myconf="${myconf} --with-pgsql-libraries=/usr/lib/postgresql"
+ myconf="${myconf} --enable-virtual-users"
+
+ # an experimental feature available with MySQL and PgSQL backend
+ if use neural ; then
+ myconf="${myconf} --enable-neural-networking"
+ fi
+ elif use oci8 ; then
+ myconf="${myconf} --with-storage-driver=ora_drv"
+ myconf="${myconf} --with-oracle-home=${ORACLE_HOME}"
+ myconf="${myconf} --enable-virtual-users"
+
+ # I am in no way a Oracle specialist. If someone knows
+ # how to query the version of Oracle, then let me know.
+ if (expr ${ORACLE_HOME/*\/} : 10 1>/dev/null 2>&1)
+ then
+ --with-oracle-version=MAJOR
+ myconf="${myconf} --with-oracle-version=10"
+ fi
+ else
+ myconf="${myconf} --with-storage-driver=libdb4_drv"
+ myconf="${myconf} --with-db4-includes=/usr/include"
+ myconf="${myconf} --with-db4-libraries=/usr/lib"
+ fi
+
+ econf ${myconf} \
+ --with-delivery-agent="${agent}" || die
+ emake || die
+
+}
+
+src_install () {
+ # open up perms on /etc/mail/dspam
+ diropts -m0775 -o dspam -g dspam
+ dodir ${HOMEDIR}
+ keepdir ${HOMEDIR}
+
+ # keeps dspam data in /var
+ diropts -m0770 -o dspam -g dspam
+ dodir ${DATADIR}
+ keepdir ${DATADIR}
+
+ # keeps dspam log in /var/log
+ diropts -m0775 -o dspam -g dspam
+ dodir ${LOGDIR}
+ keepdir ${LOGDIR}
+
+ # make install
+ make DESTDIR=${D} install || die
+ chmod 4755 ${D}/usr/bin/dspam
+
+ # documentation
+ dodoc CHANGELOG LICENSE README RELEASE.NOTES
+ dodoc ${FILESDIR}/README.postfix ${FILESDIR}/README.qmail
+ if use mysql ; then
+ newdoc tools.mysql_drv/README README.MYSQL
+ elif use postgres ; then
+ newdoc tools.pgsql_drv/README README.PGSQL
+ elif use oci8 ; then
+ newdoc tools.ora_drv/README README.ORACLE
+ fi
+
+ # build some initial configuration data
+ (echo "trainingMode=TEFT"
+ echo "spamAction=deliver"
+ echo "spamSubject=[SPAM]"
+ echo "statisticalSedation=5"
+ echo "enableBNR=on"
+ echo "enableWhitelist=on") >${T}/default.prefs
+ echo "groupname:classification:*globaluser" >${T}/group
+ if use cyrus; then
+ echo "/usr/lib/cyrus/deliver %u" > ${T}/untrusted.mailer_args
+ elif use exim; then
+ echo "/usr/sbin/exim -oMr spam-scanned" > ${T}/untrusted.mailer_args
+ elif use courier; then
+ echo "/usr/bin/maildrop -d %u" > ${T}/untrusted.mailer_args
+ elif use procmail; then
+ echo "/usr/bin/procmail -d %u" > ${T}/untrusted.mailer_args
+ fi
+
+ # install some initial configuration
+ insinto ${HOMEDIR}
+ insopts -m0640 -o dspam -g dspam
+ doins ${FILESDIR}/trusted.users
+ doins ${T}/untrusted.mailer_args
+ doins ${T}/default.prefs
+ doins ${T}/group
+
+ local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}"
+
+ # database related configuration and scripts
+ if use mysql ; then
+ insinto ${CONFIGDIR}
+ insopts -m644 -o dspam -g dspam
+
+ if [ -f ${HOMEDIR}/mysql.data ]; then
+ # Use an existing password
+ PASSWORD="$(tail -n 2 ${HOMEDIR}/mysql.data | head -n 1 )"
+ else
+ # Create the mysql.data file
+ echo "127.0.0.1" >${T}/mysql.data
+ echo "3306" >>${T}/mysql.data
+ echo "dspam" >>${T}/mysql.data
+ echo "${PASSWORD}" >>${T}/mysql.data
+ echo "dspam" >>${T}/mysql.data
+ doins ${T}/mysql.data
+ fi
+
+ newins tools.mysql_drv/mysql_objects.sql mysql_objects.sql
+ newins tools.mysql_drv/virtual_users.sql mysql_virtual_users.sql
+ newins tools.mysql_drv/purge.sql mysql_purge.sql
+ newins ${FILESDIR}/upgrade.sql mysql_upgrade.sql
+ elif use postgres ; then
+ insinto ${CONFIGDIR}
+ insopts -m644 -o dspam -g dspam
+
+ if [ -f ${HOMEDIR}/mysql.data ]; then
+ # Use an existing password
+ PASSWORD="$(tail -n 2 ${HOMEDIR}/pgsql.data | head -n 1 )"
+ else
+ # Create the pgsql.data file
+ echo "127.0.0.1" >${T}/pgsql.data
+ echo "5432" >>${T}/pgsql.data
+ echo "dspam" >>${T}/pgsql.data
+ echo "${PASSWORD}" >>${T}/pgsql.data
+ echo "dspam" >>${T}/pgsql.data
+ doins ${T}/pgsql.data
+ fi
+
+ newins tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql
+ newins tools.pgsql_drv/virtual_users.sql pgsql_virtual_users.sql
+ newins tools.pgsql_drv/purge.sql pgsql_purge.sql
+
+ elif use oci8 ; then
+ insinto ${CONFIGDIR}
+ insopts -m644 -o dspam -g dspam
+
+ if [ -f ${HOMEDIR}/oracle.data ]; then
+ # Use an existing password
+ PASSWORD="$(tail -n 2 ${HOMEDIR}/oracle.data | head -n 1 )"
+ else
+ # Create the pgsql.data file
+ echo "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=PROD)))" >${T}/oracle.data
+ echo "dspam" >>${T}/oracle.data
+ echo "${PASSWORD}" >>${T}/oracle.data
+ echo "dspam" >>${T}/oracle.data
+ doins ${T}/oracle.data
+ fi
+
+ newins tools.ora_drv/oral_objects.sql ora_objects.sql
+ newins tools.ora_drv/virtual_users.sql ora_virtual_users.sql
+ newins tools.ora_drv/purge.sql ora_purge.sql
+ fi
+
+ # installs the cron job to the cron directory
+ diropts -m0755 -o dspam -g dspam
+ dodir /etc/cron.daily
+ keepdir /etc/cron.daily
+ exeinto /etc/cron.daily
+ exeopts -m0755 -o dspam -g dspam
+ doexe ${FILESDIR}/dspam.cron
+
+ # installs the logrotation scripts to the logrotate.d directory
+ diropts -m0755 -o dspam -g dspam
+ dodir /etc/logrotate.d
+ keepdir /etc/logrotate.d
+ insinto /etc/logrotate.d
+ insopts -m0755 -o dspam -g dspam
+ newins ${FILESDIR}/logrotate.dspam dspam
+
+ # Symlinks data to HOMEDIR
+ dosym ${DATADIR} ${HOMEDIR}/data
+
+ # Log files for symlinks
+ diropts -m0755 -o dspam -g dspam
+ dodir ${LOGDIR}
+ keepdir ${LOGDIR}
+ touch ${T}/empty.file
+ newins ${T}/empty.file sql.errors
+ newins ${T}/empty.file system.log
+ newins ${T}/empty.file dspam.debug
+ newins ${T}/empty.file dspam.messages
+
+ # dspam still wants to write to a few files in it's home dir
+ dosym ${LOGDIR}/sql.errors ${HOMEDIR}/sql.errors
+ dosym ${LOGDIR}/system.log ${HOMEDIR}/system.log
+ dosym ${LOGDIR}/dspam.debug ${HOMEDIR}/dspam.debug
+ dosym ${LOGDIR}/dspam.messages ${HOMEDIR}/dspam.messages
+
+ # dspam enviroment
+ dodir /etc/env.d
+ keepdir /etc/env.d
+ insinto /etc/env.d
+ echo -ne "CONFIG_PROTECT_MASK=\"${HOMEDIR} ${CONFIGDIR}\"\n\n" > ${T}/40dspam
+ doins ${T}/40dspam || die
+}
+
+pkg_postinst() {
+ if use mysql || use postgres; then
+ einfo "To setup dspam to run out-of-the-box on your system with a mysql or pgsql database, run:"
+ einfo "ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config"
+ fi
+ if use exim ; then
+ echo
+ einfo "To use dspam in conjunction with your exim system, you should read the README"
+ fi
+}
+
+pkg_config () {
+ if use mysql ; then
+ [[ -f ${CONFIGDIR}/mysql.data ]] && mv -f ${CONFIGDIR}/mysql.data ${HOMEDIR}
+ DSPAM_MySQL_USER="$(cat ${HOMEDIR}/mysql.data|head -n 3|tail -n 1)"
+ DSPAM_MySQL_PWD="$(cat ${HOMEDIR}/mysql.data|head -n 4|tail -n 1)"
+ DSPAM_MySQL_DB="$(cat ${HOMEDIR}/mysql.data|head -n 5|tail -n 1)"
+
+ ewarn "When prompted for a password, please enter your MySQL root password"
+ ewarn ""
+
+ einfo "Creating DSPAM MySQL database \"${DSPAM_MySQL_DB}\""
+ /usr/bin/mysqladmin -u root -p create ${DSPAM_MySQL_DB}
+
+ einfo "Creating DSPAM MySQL tables"
+ /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${CONFIGDIR}/mysql_objects.sql
+ /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${CONFIGDIR}/mysql_virtual_users.sql
+
+ einfo "Creating DSPAM MySQL user \"${DSPAM_MySQL_USER}\""
+ /usr/bin/mysql -u root -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
+ fi
+ if use postgres ; then
+ [[ -f ${CONFIGDIR}/pgsql.data ]] && mv -f ${CONFIGDIR}/pgsql.data ${HOMEDIR}
+ DSPAM_PgSQL_USER="$(cat ${HOMEDIR}/pgsql.data|head -n 3|tail -n 1)"
+ DSPAM_PgSQL_PWD="$(cat ${HOMEDIR}/pgsql.data|head -n 4|tail -n 1)"
+ DSPAM_PgSQL_DB="$(cat ${HOMEDIR}/pgsql.data|head -n 5|tail -n 1)"
+
+ ewarn "When prompted for a password, please enter your PgSQL postgres password"
+ ewarn ""
+
+ einfo "Creating DSPAM PostgreSQL user \"${DSPAM_PgSQL_USER}\""
+ /usr/bin/psql -d template1 -U postgres -c "CREATE USER ${DSPAM_PgSQL_USER} WITH PASSWORD '${DSPAM_PgSQL_PWD}' NOCREATEDB NOCREATEUSER;" 1>/dev/null 2>&1
+
+ einfo "Creating DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\""
+ /usr/bin/psql -d template1 -U postgres -c "CREATE DATABASE ${DSPAM_PgSQL_DB};" 1>/dev/null 2>&1
+
+ einfo "Getting DSPAM PostgreSQL userid for \"${DSPAM_PgSQL_USER}\""
+ DSPAM_PgSQL_USERID=$(/usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -t -c "SELECT usesysid FROM pg_user WHERE usename='${DSPAM_PgSQL_USER}';" | head -n1 | sed "s/^[ ]*\([^ ]*\).*/\1/g")
+ einfo " UserID: ${DSPAM_PgSQL_USERID}"
+
+ einfo "Getting DSPAM PostgreSQL databaseid for \"${DSPAM_PgSQL_DB}\""
+ DSPAM_PgSQL_DBID=$(/usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -t -c "SELECT datdba FROM pg_database WHERE datname='${DSPAM_PgSQL_DB}';" | head -n1 | sed "s/^[ ]*\([^ ]*\).*/\1/g")
+ einfo " DBID: ${DSPAM_PgSQL_DBID}"
+
+ einfo "Changing owner of DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\" to \"${DSPAM_PgSQL_USER}\""
+ /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "UPDATE pg_database SET datdba=${DSPAM_PgSQL_USERID} WHERE datname='${DSPAM_PgSQL_DB}';" 1>/dev/null 2>&1
+
+ einfo "Creating DSPAM PostgreSQL tables"
+ PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${CONFIGDIR}/pgsql_objects.sql 1>/dev/null 2>&1
+ PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${CONFIGDIR}/pgsql_virtual_users.sql 1>/dev/null 2>&1
+
+ einfo "Grant privileges to DSPAM PostgreSQL objects to \"${DSPAM_PgSQL_USER}\""
+ for foo in $(/usr/bin/psql -t -d ${DSPAM_PgSQL_DB} -c "SELECT tablename FROM pg_tables WHERE tablename LIKE 'dspam\%';")
+ do
+ /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "GRANT ALL PRIVILEGES ON TABLE ${foo} TO ${DSPAM_PgSQL_USER};" 1>/dev/null 2>&1
+ done
+ /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE ${DSPAM_PgSQL_DB} TO ${DSPAM_PgSQL_USER};" 1>/dev/null 2>&1
+ /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "GRANT ALL PRIVILEGES ON SCHEMA public TO ${DSPAM_PgSQL_USER};" 1>/dev/null 2>&1
+ fi
+ if use oci8 ; then
+ [[ -f ${CONFIGDIR}/oracle.data ]] && mv -f ${CONFIGDIR}/oracle.data ${HOMEDIR}
+ fi
+
+ echo -ne "\n\n\n\n"
+
+ einfo "If you want to train your DSPAM with some SPAM/HAM data, then download"
+ einfo "the SA-Training-Corpus from DSPAM's website:"
+ einfo
+ einfo " cd /tmp"
+ einfo " wget http://www.nuclearelephant.com/projects/dspam/SA-Corpus.tar.gz"
+ einfo " tar zxvf SA-Corpus.tar.gz"
+ einfo " cd ./SA-Corpus"
+ einfo " ./train.pl user@example.com"
+ einfo
+ einfo "The current ebuild has installed a group called \"globaluser\". If you want"
+ einfo "you could train the \"globaluser\" instead of a valid email address:"
+ einfo " ./train.pl globaluser"
+ einfo
+}
diff --git a/mail-filter/dspam/files/digest-dspam-3.1.1 b/mail-filter/dspam/files/digest-dspam-3.1.1
new file mode 100644
index 000000000000..d5be6906884e
--- /dev/null
+++ b/mail-filter/dspam/files/digest-dspam-3.1.1
@@ -0,0 +1 @@
+MD5 c2e316ca905af86dd73d2abe5ba69b82 dspam-3.1.1.tar.gz 612267
diff --git a/mail-filter/dspam/files/dspam.cron b/mail-filter/dspam/files/dspam.cron
new file mode 100644
index 000000000000..9a89e51beba8
--- /dev/null
+++ b/mail-filter/dspam/files/dspam.cron
@@ -0,0 +1,53 @@
+#!/bin/bash
+# Remove old signatures and unimportant tokens from the DSPAM database
+
+for foo in awk head tail
+do
+ DSPAM_Check_App="$(${foo} --version 2>&1)"
+ if [[ "${DSPAM_Check_App/ *}" == "bash:" ]]
+ then
+ echo "Command ${foo} not found."
+ exit 1
+ fi
+done
+
+DSPAM_HOMEDIR="$(grep ^dspam /etc/passwd|awk -F : '{print $6}')"
+[[ ! -d "${DSPAM_HOMEDIR}" ]] && exit 2
+
+if [[ -f "${DSPAM_HOMEDIR}/mysql.data" ]]
+then
+ [[ ! -f "${DSPAM_HOMEDIR}/config/mysql_purge.sql" ]] && exit 3
+ [[ ! -f "/usr/bin/mysql" ]] && exit 4
+ DSPAM_MySQL_HOST="$(cat ${DSPAM_HOMEDIR}/mysql.data|head -n 1|tail -n 1)"
+ DSPAM_MySQL_PORT="$(cat ${DSPAM_HOMEDIR}/mysql.data|head -n 2|tail -n 1)"
+ DSPAM_MySQL_USER="$(cat ${DSPAM_HOMEDIR}/mysql.data|head -n 3|tail -n 1)"
+ DSPAM_MySQL_PWD="$(cat ${DSPAM_HOMEDIR}/mysql.data|head -n 4|tail -n 1)"
+ DSPAM_MySQL_DB="$(cat ${DSPAM_HOMEDIR}/mysql.data|head -n 5|tail -n 1)"
+ (/usr/bin/mysql -u ${DSPAM_MySQL_USER} -p"${DSPAM_MySQL_PWD}" ${DSPAM_MySQL_DB} < ${DSPAM_HOMEDIR}/config/mysql_purge.sql) 1>/dev/null 2>&1
+ exit $?
+elif [[ -f "${DSPAM_HOMEDIR}/pgsql.data" ]]
+then
+ [[ ! -f "${DSPAM_HOMEDIR}/config/pgsql_purge.sql" ]] && exit 3
+ [[ ! -f "/usr/bin/psql" ]] && exit 4
+ DSPAM_PgSQL_HOST="$(cat ${DSPAM_HOMEDIR}/pgsql.data|head -n 1|tail -n 1)"
+ DSPAM_PgSQL_PORT="$(cat ${DSPAM_HOMEDIR}/pgsql.data|head -n 2|tail -n 1)"
+ DSPAM_PgSQL_USER="$(cat ${DSPAM_HOMEDIR}/pgsql.data|head -n 3|tail -n 1)"
+ DSPAM_PgSQL_PWD="$(cat ${DSPAM_HOMEDIR}/pgsql.data|head -n 4|tail -n 1)"
+ DSPAM_PgSQL_DB="$(cat ${DSPAM_HOMEDIR}/pgsql.data|head -n 5|tail -n 1)"
+ (PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -U ${DSPAM_PgSQL_USER} -d ${DSPAM_PgSQL_DB} -p ${DSPAM_PgSQL_PORT} -h ${DSPAM_PgSQL_HOST} -f ${DSPAM_HOMEDIR}/config/pgsql_purge.sql) 1>/dev/null 2>&1
+ exit $?
+elif [[ -f "${DSPAM_HOMEDIR}/oracle.data" ]]
+then
+ [[ ! -f "${DSPAM_HOMEDIR}/config/oracle_purge.sql" ]] && exit 3
+ [[ ! -f "/usr/bin/sqlplus" ]] && exit 4
+ DSPAM_Oracle_DBLINK="$(cat ${DSPAM_HOMEDIR}/oracle.data|head -n 1|tail -n 1)"
+ DSPAM_Oracle_USER="$(cat ${DSPAM_HOMEDIR}/oracle.data|head -n 2|tail -n 1)"
+ DSPAM_Oracle_PWD="$(cat ${DSPAM_HOMEDIR}/oracle.data|head -n 3|tail -n 1)"
+ DSPAM_Oracle_SCHEMA="$(cat ${DSPAM_HOMEDIR}/oracle.data|head -n 4|tail -n 1)"
+ (/usr/bin/sqlplus -s ${DSPAM_Oracle_USER}/${DSPAM_Oracle_PWD} @${DSPAM_HOMEDIR}/config/ora_purge.sql) 1>/dev/null 2>&1
+ exit $?
+else
+ [[ ! -f "/usr/bin/dspam_clean" ]] && exit 4
+ /usr/bin/dspam_clean -s -p -u 1>/dev/null 2>&1
+ exit $?
+fi
diff --git a/mail-filter/dspam/files/logrotate.dspam b/mail-filter/dspam/files/logrotate.dspam
index 4f0c19033971..89db6f565c70 100644
--- a/mail-filter/dspam/files/logrotate.dspam
+++ b/mail-filter/dspam/files/logrotate.dspam
@@ -1,5 +1,5 @@
/var/log/dspam/sql.errors /var/log/dspam/system.log /var/log/dspam/dspam.debug /var/log/dspam/dspam.messages {
weekly
compress
- create 0644 root mail
+ create 0644 dspam dspam
}