summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlin Năstac <mrness@gentoo.org>2008-06-08 09:36:16 +0000
committerAlin Năstac <mrness@gentoo.org>2008-06-08 09:36:16 +0000
commit68c45dcdaf2ca679bb26232987f01f2c2f260e63 (patch)
treeb66ea98b39247255fceb0a8f95b614146f18e65c /mail-filter
parentVersion bump. (diff)
downloadhistorical-68c45dcdaf2ca679bb26232987f01f2c2f260e63.tar.gz
historical-68c45dcdaf2ca679bb26232987f01f2c2f260e63.tar.bz2
historical-68c45dcdaf2ca679bb26232987f01f2c2f260e63.zip
Remove obsolete revisions.
Package-Manager: portage-2.1.4.4
Diffstat (limited to 'mail-filter')
-rw-r--r--mail-filter/dspam/ChangeLog7
-rw-r--r--mail-filter/dspam/Manifest20
-rw-r--r--mail-filter/dspam/dspam-3.8.0-r10.ebuild532
-rw-r--r--mail-filter/dspam/dspam-3.8.0-r7.ebuild527
-rw-r--r--mail-filter/dspam/dspam-3.8.0-r8.ebuild527
-rw-r--r--mail-filter/dspam/dspam-3.8.0-r9.ebuild528
-rw-r--r--mail-filter/dspam/files/dspam.cron-r1372
-rw-r--r--mail-filter/dspam/files/dspam.cron-r2365
8 files changed, 17 insertions, 2861 deletions
diff --git a/mail-filter/dspam/ChangeLog b/mail-filter/dspam/ChangeLog
index 5458f5ed96bb..99cfdf840726 100644
--- a/mail-filter/dspam/ChangeLog
+++ b/mail-filter/dspam/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for mail-filter/dspam
# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v 1.116 2008/06/05 16:02:27 bluebird Exp $
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v 1.117 2008/06/08 09:36:15 mrness Exp $
+
+ 08 Jun 2008; Alin Năstac <mrness@gentoo.org> -files/dspam.cron-r1,
+ -files/dspam.cron-r2, -dspam-3.8.0-r7.ebuild, -dspam-3.8.0-r8.ebuild,
+ -dspam-3.8.0-r9.ebuild, -dspam-3.8.0-r10.ebuild:
+ Remove obsolete revisions.
05 Jun 2008; Friedrich Oslage <bluebird@gentoo.org>
dspam-3.8.0-r11.ebuild:
diff --git a/mail-filter/dspam/Manifest b/mail-filter/dspam/Manifest
index 9214647e79c0..24fe10924fc3 100644
--- a/mail-filter/dspam/Manifest
+++ b/mail-filter/dspam/Manifest
@@ -1,21 +1,23 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
AUX README.postfix 309 RMD160 34f35ffa4e393ba1791cef2800bc8b4d4f49df5b SHA1 c004a3e7d54dfdd6fae8a654e44d0b9240935739 SHA256 e0928cf2d734e79419c30a4ee829962351ef5a1247ed1d1ddf3b58410e14828b
AUX README.qmail 2317 RMD160 ebdd90be77441540848caf39b6fcde3d332b2b93 SHA1 081b28b6c261644fe3f799e3bbb5aedf59b00b8f SHA256 c70a32eb183401f3d36b8e13c1e298875692b8a9d3f34151ae42b172dd6f064a
-AUX dspam.cron-r1 9557 RMD160 4db3daaa8dd0aa7419b845ad1309d144e5203e7e SHA1 f98b6026e4063b1388c43340075b3992cf60241a SHA256 6510fa5a4d39f5aaa3bd94750bb5d6219339b936119447d56a867ae8641fbbf0
-AUX dspam.cron-r2 9309 RMD160 fc75b868e5e8f8d40a4da4204d5c07fe1a1375fe SHA1 8b7e710f0bc36fa0f9c94e064bc73e6236dd205c SHA256 09258c7dc70655e73644dd6d583d4a29ad8205224c718d706ada8ddd116610e4
AUX dspam.cron-r3 9269 RMD160 8063c0d0b5a7150a4aa9ba98e62795adca154e20 SHA1 6c1657aefc2a2e391a20c19ffc82475f88d39515 SHA256 e6a1a4194818a6ede5065979227b6b092ef2bea26cad6767f41de1a1952c840d
AUX dspam.rc 1025 RMD160 d223977cf390b1e89392462f06b31b0722810fa3 SHA1 6b243ffac8179120ed7ee6f4b24bf01ad3a511f0 SHA256 9726e4b7699ccbb305d5e161baec2010e115731e582f69c3c670ec36bb099d34
AUX logrotate.dspam 166 RMD160 b289f98cdcdda0879884836a2fdb555dfaf0b802 SHA1 c122df67ab5f5d1c26c993f68a20eb566f1706f3 SHA256 43d0e3bee637a36eadf67509798f21399b9b6f6093826299ee2aabd439555cf6
AUX pgsql_createdb.py 4520 RMD160 bcabe6298a0e97c4b3c10c48f98c5d09eb4a063b SHA1 0fe09f67a4f431dd9bf57a3e6c9ef6662f837403 SHA256 dc107ae72a3832b6ebce1066c5e84a0b164bcc01be74bb7dc1ee28c9135e9768
AUX pgsql_purge.py 1236 RMD160 0fcc6154527932ded25397b093d40d113bb44335 SHA1 198add2080c5d229c77c518ff49b372a6f6f2b93 SHA256 3e996ed8ed5fdbdf3a65504ead870c742be7c0d05f4760e3d7d798205b6cdc1b
-DIST dspam-3.8.0-patches-20070930.tar.gz 8356 RMD160 3ea07fac355ecfbbd0569cdcb08b57ce252365e0 SHA1 7cb5f8bc3abae0ceb448f20d16d339f64487de58 SHA256 ee22f7625445d37111aa4d8fa2f7c3cb159b96a86df29a97a01c9086c4e84e0d
-DIST dspam-3.8.0-patches-20071122.tar.gz 13104 RMD160 f5194099e8482a44542c4c7f8709be2379505e8b SHA1 c02463c5112d2cb041365f4d4afdaef8e0c52b11 SHA256 5e8acf2e0eecb04d96315c48abc24f5190e6cee25f743048e600d7cf8068ab8a
DIST dspam-3.8.0-patches-20071231.tar.gz 15159 RMD160 7c26a94a52832221954b7cf894c7651b0b0c6258 SHA1 fc3b29894cd5b53beb2b4b7e777d6fce714b2744 SHA256 d56d86bf245c06a1fc175c1e9e75429cc5b0900d2f9a3a346209c707e0f69754
DIST dspam-3.8.0.tar.gz 726160 RMD160 e7831e2415e30e819dd9cbc0ba3f269e113e2fb9 SHA1 d1de7ee2134522adaf52f49167accecf1589fa96 SHA256 84a227934a7aee73516bdb82c33ee7b359e955c8cd95a1544a9a13069f79bfc7
DIST dspam_sa_trainer.tar.gz 1230 RMD160 c3d0fca7169d23ecf9d44c850ee255b42d97d818 SHA1 71a002f26a888bdfe47759cf1f780cd6478dacac SHA256 8fb6b1ebe592acf00a028737ef8e174544af166768b987d29048b2319bc5a215
-EBUILD dspam-3.8.0-r10.ebuild 19846 RMD160 44dc0af80d0cf0588d7ae7449f33db22a2755a1f SHA1 bf75925ba75892fab4108ac46bc1b79e015c87d1 SHA256 10bc689943582a35c64e3851d99cd3c2a00b9df7b0efedd78a8cba593862a277
EBUILD dspam-3.8.0-r11.ebuild 19766 RMD160 2dc77fae5dbbe421fde3ee04f8211bd894270b5e SHA1 565eab492c9e4165937b60da724c6bc52f985b1a SHA256 3892f3e7f9a3d1b9f815a10745eaad08fd3b75486cf8cdf674c2d6a93cb7c651
-EBUILD dspam-3.8.0-r7.ebuild 19714 RMD160 e31890ddc7f6a1af14b9175cbbdb84c780a4b255 SHA1 6b3e318c1db17ad6218af232691591ab28fc8ce3 SHA256 9eddb5a8db767f98c3c33e500339a86e191674840c5692a57384d0f32620e4c3
-EBUILD dspam-3.8.0-r8.ebuild 19716 RMD160 6ded2adf731ad414912c4fed564eed8b9985fa48 SHA1 7b66e2d760fcab5d03624389e1b2f00a36ad4732 SHA256 c36c194d91e71f0712557f744cc5d1c8c5b3b50422e28b585f64ce41c7d789b8
-EBUILD dspam-3.8.0-r9.ebuild 19755 RMD160 384fb322072e4e18d45b80f20379ef9bc23b0794 SHA1 01607cebb6622bd11871a5847ec7fcfa1c9f0873 SHA256 6b30147eb9573a2acf5440eb818197ac324a96678cac5762ef77a555e05aef38
-MISC ChangeLog 20477 RMD160 cd88ac974342baabcc7e08686c47b46c471cf5a5 SHA1 e23cc950f3c8c18bae137bee3eea600e41d35c9e SHA256 4222cd0fe25beff37989414ad2098abc7e11feea5d919867543adcb44fef5eac
+MISC ChangeLog 20698 RMD160 e4513a9c4018b87e2c35cd9e5a2719c18ac1b153 SHA1 0858ca2e14a994a33ee07d0fc7ee25ac062e3637 SHA256 98f6658d3d0422e644bdc90f5c0dd703f5a38242de7cc3cb023ed4b6c40e8682
MISC metadata.xml 335 RMD160 acb18f015dcada8300ffce56be0c4a285ce2a215 SHA1 87ddabb196434e9e9363ba4b5b5596b78aa463f1 SHA256 23816215482cfc089c2e3fe9ae75547c364ad01fbb2a98886ad91d28f5971e17
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.9 (GNU/Linux)
+
+iEYEARECAAYFAkhLqBQACgkQ+fWpoTWIA9E3WQCfeEeYTE2VRQ4QD4604Nt6b09c
+xAoAnRlliinBMnY4Rf4GnpSI12jVsp73
+=bhc3
+-----END PGP SIGNATURE-----
diff --git a/mail-filter/dspam/dspam-3.8.0-r10.ebuild b/mail-filter/dspam/dspam-3.8.0-r10.ebuild
deleted file mode 100644
index dae74d99dce4..000000000000
--- a/mail-filter/dspam/dspam-3.8.0-r10.ebuild
+++ /dev/null
@@ -1,532 +0,0 @@
-# Copyright 1999-2008 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.8.0-r10.ebuild,v 1.3 2008/05/21 16:03:01 dev-zero Exp $
-
-WANT_AUTOCONF="latest"
-WANT_AUTOMAKE="latest"
-
-inherit eutils autotools flag-o-matic multilib
-
-DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter"
-HOMEPAGE="http://dspam.nuclearelephant.com/"
-SRC_URI="http://dspam.nuclearelephant.com/sources/${P}.tar.gz
- mirror://gentoo/${P}-patches-20071231.tar.gz
- http://dspam.nuclearelephant.com/sources/extras/dspam_sa_trainer.tar.gz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~ppc ~sparc ~x86"
-IUSE="clamav daemon debug ldap mysql postgres sqlite syslog \
- large-domain virtual-users user-homedirs"
-
-COMMON_DEPEND="clamav? ( >=app-antivirus/clamav-0.90.2 )
- ldap? ( >=net-nds/openldap-2.2 )
- mysql? ( virtual/mysql )
- sqlite? ( =dev-db/sqlite-3* )"
-DEPEND="${COMMON_DEPEND}
- postgres? ( >=virtual/postgresql-base-8 )"
-RDEPEND="${COMMON_DEPEND}
- postgres? ( || ( dev-python/psycopg >=virtual/postgresql-server-8 ) )
- sys-process/cronbase
- virtual/logger"
-
-# some FHS-like structure
-DSPAM_HOMEDIR="/var/spool/dspam"
-DSPAM_CONFDIR="/etc/mail/dspam"
-DSPAM_LOGDIR="/var/log/dspam"
-DSPAM_MODE=2511
-
-pkg_setup() {
- # Delete these lines some time after -r6 removal
- if has_version "<=mail-filter/dspam-3.8.0-r6" &&
- built_with_use "<=mail-filter/dspam-3.8.0-r6" sqlite &&
- grep -q "^StorageDriver.*libsqlite_drv.so" "${ROOT}${DSPAM_CONFDIR}"/dspam.conf; then
- eerror "Sqlite2 support has been removed. Please upgrade your database to sqlite3"
- eerror "and select libsqlite3_drv.so in dspam.conf before proceeding with update."
- die "sqlite-2 no longer supported"
- fi
-
- local egid euid
- # Need a UID and GID >= 1000, for being able to use suexec in apache
- for euid in $(seq 1000 5000 ) ; do
- [[ -z $(egetent passwd ${euid}) ]] && break
- done
- for egid in $(seq 1000 5000 ) ; do
- [[ -z $(egetent group ${egid}) ]] && break
- done
-
- enewgroup dspam ${egid}
- enewuser dspam ${euid} -1 "${DSPAM_HOMEDIR}" dspam,mail
-}
-
-src_unpack() {
- unpack ${A}
- cd "${S}"
-
- EPATCH_SUFFIX="patch"
- epatch "${WORKDIR}"/patches
-
- # Fix Lazy bindings
- append-flags $(bindnow-flags)
-
- AT_M4DIR="${S}/m4"
- eautoreconf
-}
-
-src_compile() {
- local myconf=""
-
- if use mysql || use postgres; then
- myconf="${myconf} $(use_enable virtual-users) --enable-preferences-extension"
- if use virtual-users; then
- myconf="${myconf} --disable-homedir"
- use user-homedirs && ewarn "user-homedirs support has been disabled (not compatible with --enable-virtual-users)"
- else
- myconf="${myconf} $(use_enable user-homedirs homedir)"
- fi
- else
- myconf="${myconf} --disable-virtual-users --disable-preferences-extension \
- $(use_enable user-homedirs homedir)"
- use virtual-users && ewarn "virtual-users support has been disabled (available only for mysql and postgres storage drivers)"
- fi
-
- if ! use syslog; then
- myconf="${myconf} --with-logfile=${DSPAM_LOGDIR}/dspam.log"
- fi
-
- local STORAGE="hash_drv"
- # select storage driver
- if use sqlite ; then
- STORAGE="${STORAGE},sqlite3_drv"
- fi
- if use mysql; then
- STORAGE="${STORAGE},mysql_drv"
- myconf="${myconf} --with-mysql-includes=/usr/include/mysql"
- myconf="${myconf} --with-mysql-libraries=/usr/$(get_libdir)/mysql"
- fi
- if use postgres ; then
- STORAGE="${STORAGE},pgsql_drv"
- myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql"
- myconf="${myconf} --with-pgsql-libraries=/usr/$(get_libdir)/postgresql"
- fi
-
- econf --with-storage-driver=${STORAGE} \
- --with-dspam-home="${DSPAM_HOMEDIR}" \
- --sysconfdir="${DSPAM_CONFDIR}" \
- $(use_enable daemon) \
- $(use_enable ldap) \
- $(use_enable clamav) \
- $(use_enable large-domain large-scale) \
- $(use_enable !large-domain domain-scale) \
- $(use_enable syslog) \
- $(use_enable debug) \
- $(use_enable debug bnr-debug) \
- $(use_enable debug verbose-debug) \
- --enable-long-usernames \
- --with-dspam-group=dspam \
- --with-dspam-home-group=dspam \
- --with-dspam-mode=${DSPAM_MODE} \
- --with-logdir="${DSPAM_LOGDIR}" \
- ${myconf} || die "econf failed"
- emake || die "emake failed"
-}
-
-src_install () {
- diropts -m0770 -o dspam -g dspam
- dodir "${DSPAM_CONFDIR}"
- insinto "${DSPAM_CONFDIR}"
- insopts -m640 -o dspam -g dspam
- doins src/dspam.conf
- dosym /etc/mail/dspam /etc/dspam
-
- # make install
- emake DESTDIR="${D}" install || die "emake install failed"
-
- # necessary for dovecot-dspam
- insopts -m644
- insinto /usr/include/dspam && doins src/pref.h
-
- diropts -m0755 -o dspam -g dspam
- dodir /var/run/dspam
-
- # create logdir (used only when syslog support has been disabled or build with --enable-debug)
- if ! use syslog || use debug ; then
- diropts -m0770 -o dspam -g dspam
- dodir "${DSPAM_LOGDIR}"
- diropts -m0755
- insinto /etc/logrotate.d
- newins "${FILESDIR}/logrotate.dspam" dspam || die "failed to install logrotate.d file"
- fi
-
- if use daemon; then
- # We use sockets for the daemon instead of tcp port 24
- sed -e 's:^#*\(ServerDomainSocketPath[\t ]\{1,\}\).*:\1\"/var/run/dspam/dspam.sock\":gI' \
- -e 's:^#*\(ServerPID[\t ]\{1,\}\).*:\1/var/run/dspam/dspam.pid:gI' \
- -e 's:^#*\(ClientHost[\t ]\{1,\}\)/.*:\1\"/var/run/dspam/dspam.sock\":gI' \
- -i "${D}/${DSPAM_CONFDIR}/dspam.conf"
-
- newinitd "${FILESDIR}/dspam.rc" dspam || die "failed to install init script"
-
- fowners root:dspam /usr/bin/dspamc &&
- fperms u=rx,g=xs,o=x /usr/bin/dspamc ||
- die "failed to alter dspamc owner:group or mode"
- fi
-
- # database related configuration and scripts
- local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" DSPAM_DB_DATA=()
- if use sqlite; then
- insinto "${DSPAM_CONFDIR}"
- newins src/tools.sqlite_drv/purge-3.sql sqlite3_purge.sql || die "failed to install sqlite3_purge.sql script"
- fi
- if use mysql; then
- DSPAM_DB_DATA[0]="/var/run/mysqld/mysqld.sock"
- DSPAM_DB_DATA[1]=""
- DSPAM_DB_DATA[2]="dspam"
- DSPAM_DB_DATA[3]="${PASSWORD}"
- DSPAM_DB_DATA[4]="dspam"
- DSPAM_DB_DATA[5]="false"
-
- # Activate mysql database configuration
- sed -e "s:^#*\(MySQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \
- -e "s:^#*\(MySQLPort[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \
- -e "s:^#*\(MySQLUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \
- -e "s:^#*\(MySQLPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI" \
- -e "s:^#*\(MySQLDb[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[4]}:gI" \
- -e "s:^#*\(MySQLCompress[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[5]}:gI" \
- -i "${D}/${DSPAM_CONFDIR}/dspam.conf"
-
- insinto "${DSPAM_CONFDIR}"
- newins src/tools.mysql_drv/mysql_objects-space.sql mysql_objects-space.sql &&
- newins src/tools.mysql_drv/mysql_objects-speed.sql mysql_objects-speed.sql &&
- newins src/tools.mysql_drv/mysql_objects-4.1.sql mysql_objects-4.1.sql &&
- newins src/tools.mysql_drv/purge.sql mysql_purge.sql &&
- newins src/tools.mysql_drv/purge-4.1.sql mysql_purge-4.1.sql ||
- die "failed to install mysql*.sql scripts"
- if use virtual-users ; then
- newins src/tools.mysql_drv/virtual_users.sql mysql_virtual_users.sql &&
- newins src/tools.mysql_drv/virtual_user_aliases.sql mysql_virtual_user_aliases.sql ||
- die "failed to install mysql_virtual_user*.sql scripts"
- fi
- fi
- if use postgres ; then
- DSPAM_DB_DATA[0]="127.0.0.1"
- DSPAM_DB_DATA[1]="5432"
- DSPAM_DB_DATA[2]="dspam"
- DSPAM_DB_DATA[3]="${PASSWORD}"
- DSPAM_DB_DATA[4]="dspam"
-
- # Activate pgsql database configuration
- sed -e "s:^#*\(PgSQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \
- -e "s:^#*\(PgSQLPort[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \
- -e "s:^#*\(PgSQLUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \
- -e "s:^#*\(PgSQLPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI" \
- -e "s:^#*\(PgSQLDb[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[4]}:gI" \
- -e "s:^#*\(PgSQLConnectionCache[\t ]*.\):\1:gI" \
- -i "${D}/${DSPAM_CONFDIR}"/dspam.conf
-
- insinto "${DSPAM_CONFDIR}"
- newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql &&
- newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql ||
- die "failed to install pgsql*.sql scripts"
- if use virtual-users ; then
- newins src/tools.pgsql_drv/virtual_users.sql pgsql_virtual_users.sql ||
- die "failed to install pgsql_virtual_users.sql scripts"
- fi
-
- # Install psycopg scripts needed when postgresql is not installed
- exeinto "${DSPAM_CONFDIR}"
- doexe "${FILESDIR}"/pgsql_{createdb,purge}.py || die "failed to install psycopg scripts"
- fi
-
- # Set default storage
- local DEFAULT_STORAGE
- if use sqlite ; then
- DEFAULT_STORAGE=sqlite3
- elif use mysql ; then
- DEFAULT_STORAGE=mysql
- elif use postgres ; then
- DEFAULT_STORAGE=pgsql
- fi
- if [[ -z "${DEFAULT_STORAGE}" ]]; then
- # When only one storage driver is compiled, it is linked statically with dspam
- # thus you should not set the StorageDriver at all
- # Also, hash_drv requires certain tokenizer and PValue (see bug #185718)
- sed -e "s:^\(StorageDriver[\t ].*\)$:#\1:" \
- -e "s:^Tokenizer .*$:Tokenizer sbph:" \
- -e "/^#PValue/d" \
- -e "s:^PValue .*$:PValue markov:" \
- -i "${D}/${DSPAM_CONFDIR}"/dspam.conf
- else
- # Set the storage driver and use purge configuration for SQL-based installations
- sed -e "s:^\(Purge.*\):###\1:g" \
- -e "s:^#\(Purge.*\):\1:g" \
- -e "s:^###\(Purge.*\):#\1:g" \
- -e "s:^\(StorageDriver[\t ].*\)libhash_drv.so:\1lib${DEFAULT_STORAGE}_drv.so:" \
- -i "${D}/${DSPAM_CONFDIR}"/dspam.conf
- fi
-
- # installs the notification messages
- # -> The documentation is wrong! The files need to be in ./txt
- echo "Scanned and tagged as SPAM with DSPAM ${PV} by Your ISP.com">"${T}"/msgtag.spam
- echo "Scanned and tagged as non-SPAM with DSPAM ${PV} by Your ISP.com">"${T}"/msgtag.nonspam
- insinto "${DSPAM_CONFDIR}"/txt
- doins "${S}"/txt/*.txt
- doins "${T}"/msgtag.*
-
- # Create the opt-in / opt-out directories
- diropts -m0770 -o dspam -g dspam
- dodir "${DSPAM_HOMEDIR}"
- keepdir "${DSPAM_HOMEDIR}"/opt-in
- keepdir "${DSPAM_HOMEDIR}"/opt-out
- diropts -m0755
-
- # dspam cron job
- exeinto /etc/cron.daily
- newexe "${FILESDIR}/dspam.cron-r2" dspam.cron || die "failed to install cron script"
-
- # documentation
- dodoc CHANGELOG README* RELEASE.NOTES UPGRADING
- docinto doc
- dodoc doc/*.txt
- docinto gentoo
- dodoc "${FILESDIR}"/README.{postfix,qmail}
- docinto sa_train
- dodoc "${WORKDIR}"/dspam_sa_trainer/*
- doman man/dspam*
-}
-
-pkg_preinst() {
- # Delete these lines some time after -r6 removal
- if has_version "<=mail-filter/dspam-3.8.0-r6" ; then
- # Remove obsolete *.data files
- local f
- for f in "${ROOT}${DSPAM_CONFDIR}"/{mysql,pgsql}.data ; do
- f=${f/\/\//\/}
- if [[ -f "${f}" ]]; then
- rm "${f}" &&
- elog "Obsolete ${f} has been removed" ||
- eerror "Failed to remove ${f}"
- fi
- done
- fi
-}
-
-pkg_postinst() {
- ewarn "The hash_drv storage backend has the following requirements:"
- ewarn " - PValue must be set to 'markov'; Do not use this pvalue with any other storage backend!"
- ewarn " - Tokenizer must be either 'sbph' or 'osb'"
- ewarn "See markov.txt for more info."
-
- if use mysql || use postgres; then
- elog
- elog "To setup DSPAM to run out-of-the-box on your system with a MySQL"
- elog "or PostgreSQL database, run:"
- elog "emerge --config =${PF}"
- fi
-
- if use daemon; then
- elog
- elog "If you want to run DSPAM in the new daemon mode remember"
- elog "to make the DSPAM daemon start during boot:"
- elog " rc-update add dspam default"
- elog
- elog "To use the DSPAM daemon mode, the used storage driver must be thread-safe."
- fi
-
- elog
- elog "See http://dspamwiki.expass.de/Installation for more info"
-}
-
-# Edits interactively one or more parameters from "${ROOT}${DSPAM_CONFDIR}/dspam.conf"
-# Usage: edit_dspam_params param_name1 [param_name2 ..]
-edit_dspam_params() {
- local PARAMETER OLD_VALUE VALUE
- for PARAMETER in $@ ; do
- OLD_VALUE=$(awk "BEGIN { IGNORECASE=1; } \$1==\"${PARAMETER}\" { print \$2; exit; }" "${ROOT}${DSPAM_CONFDIR}/dspam.conf")
- [[ $? == 0 ]] || return 1
- if [[ "${PARAMETER}" == *"Pass" ]]; then
- read -r -p "${PARAMETER} (default ${OLD_VALUE:-none}; enter random for generating a new random password): " VALUE
- [[ "${VALUE}" == "random" ]] && VALUE="${RANDOM}${RANDOM}${RANDOM}${RANDOM}"
- else
- read -r -p "${PARAMETER} (default ${OLD_VALUE:-none}): " VALUE
- fi
-
- if [[ -z "${VALUE}" ]] ; then
- VALUE=${OLD_VALUE}
- else
- sed -e "s:^#*${PARAMETER}\([\t ].*\)\?\$:${PARAMETER} ${VALUE}:gI" \
- -i "${ROOT}${DSPAM_CONFDIR}/dspam.conf"
- [[ $? == 0 ]] || return 2
- fi
- eval $PARAMETER=\"${VALUE}\"
- done
- return 0
-}
-
-# Selects the storage driver in "${ROOT}${DSPAM_CONFDIR}/dspam.conf"
-# usage: set_storage_driver { hash | sqlite3 | mysql | pgsql }
-set_storage_driver() {
- sed -e "s:^[#\t ]*\(StorageDriver[\t ].*\)lib[a-z1-9]\+_drv.so:\1lib${1}_drv.so:" \
- -i "${ROOT}${DSPAM_CONFDIR}"/dspam.conf &&
- einfo "Storage driver lib${1}_drv.so has been selected"
-}
-
-pkg_config () {
- local AVAIL_BACKENDS=( hash )
- use sqlite && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} sqlite )
- use mysql && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} mysql )
- use postgres && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} postgres )
- local USE_BACKEND
- read -p "Which backend do you want to configure? (available backends are ${AVAIL_BACKENDS[*]}): " USE_BACKEND
- if [[ " ${AVAIL_BACKENDS[*]} " != *" ${USE_BACKEND} "* ]]; then
- eerror "The '${USE_BACKEND}' backend is not available."
- return 1
- fi
-
- case "${USE_BACKEND}" in
-
- hash)
- einfo "hash driver will automatically create the necessary databases"
- set_storage_driver hash
- ;;
-
- sqlite)
- einfo "sqlite driver will automatically create the necessary databases"
- set_storage_driver sqlite3
- ;;
-
- mysql)
- local MySQLServer MySQLPort MySQLUser MySQLPass MySQLDb MySQLCompress
- edit_dspam_params MySQLServer MySQLPort MySQLUser MySQLPass MySQLDb MySQLCompress || return $?
- if [[ -z "${MySQLServer}" || -z "${MySQLUser}" || -z "${MySQLPass}" || -z "${MySQLDb}" ]]; then
- eerror "Following parameters are required: MySQLServer MySQLUser MySQLPass MySQLDb"
- return 1
- fi
-
- local MySQL_DB_Type MySQL_Virtuser_Type
- einfo " Please select what kind of database you like to create:"
- einfo " [0] Don't create the database, I will do it myself"
- einfo " [1] Database will be hosted on a mysql-4.1 server or above"
- einfo " [2] Space optimized database on a mysql-4.0 server or below"
- einfo " [3] Speed optimized database on a mysql-4.0 server or below"
- einfo
- while read -n 1 -s -p " Press 0, 1, 2 or 3 on the keyboard to select database " MySQL_DB_Type; do
- if [[ "${MySQL_DB_Type}" == "0" ]] ; then
- echo
- set_storage_driver mysql
- return 0
- fi
- [[ "${MySQL_DB_Type}" == "1" || "${MySQL_DB_Type}" == "2" || "${MySQL_DB_Type}" == "3" ]] && echo && break
- done
- if use virtual-users ; then
- einfo " Please select what kind of virtual_uids table you like to use:"
- einfo " [1] Virtual users added automatically (use it if this server is the primary MX)"
- einfo " [2] Virtual users added manually (use it if this server is a secondary MX)"
- einfo
- while read -n 1 -s -p " Press 1 or 2 on the keyboard to select table type " MySQL_Virtuser_Type; do
- [[ "${MySQL_Virtuser_Type}" == "1" || "${MySQL_Virtuser_Type}" == "2" ]] && echo && break
- done
- fi
-
- local MYSQL_ROOT_USER
- read -r -p "Your administrative MySQL account (default root): " MYSQL_ROOT_USER
- if [[ -z "${MYSQL_ROOT_USER}" ]]; then
- MYSQL_ROOT_USER="root"
- fi
- einfo "When prompted for a password, please enter your MySQL ${MYSQL_ROOT_USER} password"
-
- local MYSQL_CMD_LINE="/usr/bin/mysql -u ${MYSQL_ROOT_USER} -p"
- [[ "${MySQLServer}" != "/"* ]] && MYSQL_CMD_LINE="${MYSQL_CMD_LINE} -h ${MySQLServer}"
- [[ -n "${MySQLPort}" ]] && MYSQL_CMD_LINE="${MYSQL_CMD_LINE} -P ${MySQLPort}"
- {
- echo "CREATE DATABASE ${MySQLDb};"
- echo "USE ${MySQLDb};"
- case ${MySQL_DB_Type} in
- 1) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_objects-4.1.sql ;;
- 2) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_objects-space.sql ;;
- 3) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_objects-speed.sql ;;
- esac
- if use virtual-users ; then
- case ${MySQL_Virtuser_Type} in
- 1) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_virtual_users.sql ;;
- 2) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_virtual_user_aliases.sql ;;
- esac
- fi
- echo "GRANT SELECT,INSERT,UPDATE,DELETE ON ${MySQLDb}.* TO '${MySQLUser}'@'%' IDENTIFIED BY '${MySQLPass}';"
- echo "FLUSH PRIVILEGES;"
- } | ${MYSQL_CMD_LINE}
- [[ ${PIPESTATUS[1]} == 0 ]] || return ${PIPESTATUS[1]}
-
- einfo "MySQL database created successfully"
- set_storage_driver mysql
- ;;
-
- postgres)
- local PgSQLServer PgSQLPort PgSQLUser PgSQLPass PgSQLDb
- edit_dspam_params PgSQLServer PgSQLPort PgSQLUser PgSQLPass PgSQLDb || return $?
- if [[ -z "${PgSQLServer}" || -z "${PgSQLUser}" || -z "${PgSQLPass}" || -z "${PgSQLDb}" ]]; then
- eerror "Following parameters are required: PgSQLServer PgSQLUser PgSQLPass PgSQLDb"
- return 1
- fi
-
- local PgSQL_DB_Create
- einfo " Do you want PgSQL database be automatically created for you?"
- while read -n 1 -s -p " Press y or n " PgSQL_DB_Create; do
- if [[ "${PgSQL_DB_Create}" == "n" || "${PgSQL_DB_Create}" == "N" ]] ; then
- echo
- set_storage_driver pgsql
- return 0
- fi
- [[ "${PgSQL_DB_Create}" == "y" || "${PgSQL_DB_Create}" == "Y" ]] && echo && break
- done
-
- local PGSQL_ROOT_USER
- read -r -p "Your administrative PgSQL account (default postgres): " PGSQL_ROOT_USER
- if [[ -z "${PGSQL_ROOT_USER}" ]]; then
- PGSQL_ROOT_USER="postgres"
- fi
- einfo "When prompted for a password, please enter your PgSQL ${PGSQL_ROOT_USER} password"
-
- if [[ -x /usr/bin/psql ]]; then
- # Create database using psql
- local PGSQL_CMD_LINE="/usr/bin/psql -h ${PgSQLServer}"
- [[ -n "${PgSQLPort}" ]] && PGSQL_CMD_LINE="${PGSQL_CMD_LINE} -p ${PgSQLPort}"
-
- {
- echo "\\set ON_ERROR_STOP = on;"
- echo "CREATE USER ${PgSQLUser} WITH PASSWORD '${PgSQLPass}' NOCREATEDB NOCREATEUSER;"
- echo "CREATE DATABASE ${PgSQLDb};"
- echo "GRANT ALL PRIVILEGES ON DATABASE ${PgSQLDb} TO ${PgSQLUser};"
- echo "GRANT ALL PRIVILEGES ON SCHEMA public TO ${PgSQLUser};"
- echo "UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='${PgSQLUser}') WHERE datname='${PgSQLDb}';"
- echo "\\c ${PgSQLDb};"
- echo "CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS '\$libdir/plpgsql', 'plpgsql_call_handler' LANGUAGE c;"
- echo "CREATE FUNCTION plpgsql_validator(oid) RETURNS void AS '\$libdir/plpgsql', 'plpgsql_validator' LANGUAGE c;"
- echo "CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler VALIDATOR plpgsql_validator;"
- } | ${PGSQL_CMD_LINE} -d template1 -U ${PGSQL_ROOT_USER}
- [[ ${PIPESTATUS[1]} == 0 ]] || return ${PIPESTATUS[1]}
-
- {
- echo "\\set ON_ERROR_STOP = on;"
- cat "${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql
- use virtual-users && cat "${ROOT}${DSPAM_CONFDIR}"/pgsql_virtual_users.sql
- } | PGUSER="${PgSQLUser}" PGPASSWORD="${PgSQLPass}" ${PGSQL_CMD_LINE} -d "${PgSQLDb}" -U ${PgSQLUser}
- [[ ${PIPESTATUS[1]} == 0 ]] || return ${PIPESTATUS[1]}
- else
- # Create database using psycopg script
- if use virtual-users ; then
- DSPAM_PgSQLPass="${PgSQLPass}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_createdb.py "${PgSQLServer}" "${PgSQLPort}" "${PGSQL_ROOT_USER}" \
- "${PgSQLUser}" "${PgSQLDb}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql "${ROOT}${DSPAM_CONFDIR}"/pgsql_virtual_users.sql
- else
- DSPAM_PgSQLPass="${PgSQLPass}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_createdb.py "${PgSQLServer}" "${PgSQLPort}" "${PGSQL_ROOT_USER}" \
- "${PgSQLUser}" "${PgSQLDb}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql
- fi
- [[ $? == 0 ]] || return $?
- fi
-
- einfo "PgSQL database created successfully"
- set_storage_driver pgsql
- ;;
-
- esac
-}
diff --git a/mail-filter/dspam/dspam-3.8.0-r7.ebuild b/mail-filter/dspam/dspam-3.8.0-r7.ebuild
deleted file mode 100644
index 2b54b900463e..000000000000
--- a/mail-filter/dspam/dspam-3.8.0-r7.ebuild
+++ /dev/null
@@ -1,527 +0,0 @@
-# Copyright 1999-2008 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.8.0-r7.ebuild,v 1.8 2008/05/21 16:03:01 dev-zero Exp $
-
-WANT_AUTOCONF="latest"
-WANT_AUTOMAKE="latest"
-
-inherit eutils autotools flag-o-matic multilib
-
-DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter"
-HOMEPAGE="http://dspam.nuclearelephant.com/"
-SRC_URI="http://dspam.nuclearelephant.com/sources/${P}.tar.gz
- mirror://gentoo/${P}-patches-20070930.tar.gz
- http://dspam.nuclearelephant.com/sources/extras/dspam_sa_trainer.tar.gz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~ppc sparc x86"
-IUSE="clamav daemon debug ldap mysql postgres sqlite syslog \
- large-domain virtual-users user-homedirs"
-
-COMMON_DEPEND="clamav? ( >=app-antivirus/clamav-0.90.2 )
- ldap? ( >=net-nds/openldap-2.2 )
- mysql? ( virtual/mysql )
- sqlite? ( =dev-db/sqlite-3* )"
-DEPEND="${COMMON_DEPEND}
- postgres? ( >=virtual/postgresql-base-8 )"
-RDEPEND="${COMMON_DEPEND}
- postgres? ( || ( dev-python/psycopg >=virtual/postgresql-server-8 ) )
- sys-process/cronbase
- virtual/logger"
-
-# some FHS-like structure
-DSPAM_HOMEDIR="/var/spool/dspam"
-DSPAM_CONFDIR="/etc/mail/dspam"
-DSPAM_LOGDIR="/var/log/dspam"
-DSPAM_MODE=2511
-
-pkg_setup() {
- # Delete these lines some time after -r6 removal
- if has_version "<=mail-filter/dspam-3.8.0-r6" &&
- built_with_use "<=mail-filter/dspam-3.8.0-r6" sqlite &&
- grep -q "^StorageDriver.*libsqlite_drv.so" "${ROOT}${DSPAM_CONFDIR}"/dspam.conf; then
- eerror "Sqlite2 support has been removed. Please upgrade your database to sqlite3"
- eerror "and select libsqlite3_drv.so in dspam.conf before proceeding with update."
- die "sqlite-2 no longer supported"
- fi
-
- local egid euid
- # Need a UID and GID >= 1000, for being able to use suexec in apache
- for euid in $(seq 1000 5000 ) ; do
- [[ -z $(egetent passwd ${euid}) ]] && break
- done
- for egid in $(seq 1000 5000 ) ; do
- [[ -z $(egetent group ${egid}) ]] && break
- done
-
- enewgroup dspam ${egid}
- enewuser dspam ${euid} -1 "${DSPAM_HOMEDIR}" dspam,mail
-}
-
-src_unpack() {
- unpack ${A}
- cd "${S}"
-
- EPATCH_SUFFIX="patch"
- epatch "${WORKDIR}"/patches
-
- # Fix Lazy bindings
- append-flags $(bindnow-flags)
-
- AT_M4DIR="${S}/m4"
- eautoreconf
-}
-
-src_compile() {
- local myconf=""
-
- if use mysql || use postgres; then
- myconf="${myconf} $(use_enable virtual-users) --enable-preferences-extension"
- if use virtual-users; then
- myconf="${myconf} --disable-homedir"
- use user-homedirs && ewarn "user-homedirs support has been disabled (not compatible with --enable-virtual-users)"
- else
- myconf="${myconf} $(use_enable user-homedirs homedir)"
- fi
- else
- myconf="${myconf} --disable-virtual-users --disable-preferences-extension \
- $(use_enable user-homedirs homedir)"
- use virtual-users && ewarn "virtual-users support has been disabled (available only for mysql and postgres storage drivers)"
- fi
-
- local STORAGE="hash_drv"
- # select storage driver
- if use sqlite ; then
- STORAGE="${STORAGE},sqlite3_drv"
- fi
- if use mysql; then
- STORAGE="${STORAGE},mysql_drv"
- myconf="${myconf} --with-mysql-includes=/usr/include/mysql"
- myconf="${myconf} --with-mysql-libraries=/usr/$(get_libdir)/mysql"
- fi
- if use postgres ; then
- STORAGE="${STORAGE},pgsql_drv"
- myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql"
- myconf="${myconf} --with-pgsql-libraries=/usr/$(get_libdir)/postgresql"
- fi
-
- econf --with-storage-driver=${STORAGE} \
- --with-dspam-home="${DSPAM_HOMEDIR}" \
- --sysconfdir="${DSPAM_CONFDIR}" \
- $(use_enable daemon) \
- $(use_enable ldap) \
- $(use_enable clamav) \
- $(use_enable large-domain large-scale) \
- $(use_enable !large-domain domain-scale) \
- $(use_enable syslog) \
- $(use_enable debug) \
- $(use_enable debug bnr-debug) \
- --enable-long-usernames \
- --with-dspam-group=dspam \
- --with-dspam-home-group=dspam \
- --with-dspam-mode=${DSPAM_MODE} \
- --with-logdir="${DSPAM_LOGDIR}" \
- ${myconf} || die "econf failed"
- emake || die "emake failed"
-}
-
-src_install () {
- diropts -m0770 -o dspam -g dspam
- dodir "${DSPAM_CONFDIR}"
- insinto "${DSPAM_CONFDIR}"
- insopts -m640 -o dspam -g dspam
- doins src/dspam.conf
- dosym /etc/mail/dspam /etc/dspam
-
- # make install
- emake DESTDIR="${D}" install || die "emake install failed"
-
- # necessary for dovecot-dspam
- insopts -m644
- insinto /usr/include/dspam && doins src/pref.h
-
- diropts -m0755 -o dspam -g dspam
- dodir /var/run/dspam
-
- # create logdir (used only when syslog support has been disabled or build with --enable-debug)
- if ! use syslog || use debug ; then
- diropts -m0770 -o dspam -g dspam
- dodir "${DSPAM_LOGDIR}"
- diropts -m0755
- insinto /etc/logrotate.d
- newins "${FILESDIR}/logrotate.dspam" dspam || die "failed to install logrotate.d file"
- fi
-
- if use daemon; then
- # We use sockets for the daemon instead of tcp port 24
- sed -e 's:^#*\(ServerDomainSocketPath[\t ]\{1,\}\).*:\1\"/var/run/dspam/dspam.sock\":gI' \
- -e 's:^#*\(ServerPID[\t ]\{1,\}\).*:\1/var/run/dspam/dspam.pid:gI' \
- -e 's:^#*\(ClientHost[\t ]\{1,\}\)/.*:\1\"/var/run/dspam/dspam.sock\":gI' \
- -i "${D}/${DSPAM_CONFDIR}/dspam.conf"
-
- newinitd "${FILESDIR}/dspam.rc" dspam || die "failed to install init script"
-
- fowners root:dspam /usr/bin/dspamc &&
- fperms u=rx,g=xs,o=x /usr/bin/dspamc ||
- die "failed to alter dspamc owner:group or mode"
- fi
-
- # database related configuration and scripts
- local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" DSPAM_DB_DATA=()
- if use sqlite; then
- insinto "${DSPAM_CONFDIR}"
- newins src/tools.sqlite_drv/purge-3.sql sqlite3_purge.sql || die "failed to install sqlite3_purge.sql script"
- fi
- if use mysql; then
- DSPAM_DB_DATA[0]="/var/run/mysqld/mysqld.sock"
- DSPAM_DB_DATA[1]=""
- DSPAM_DB_DATA[2]="dspam"
- DSPAM_DB_DATA[3]="${PASSWORD}"
- DSPAM_DB_DATA[4]="dspam"
- DSPAM_DB_DATA[5]="false"
-
- # Activate mysql database configuration
- sed -e "s:^#*\(MySQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \
- -e "s:^#*\(MySQLPort[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \
- -e "s:^#*\(MySQLUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \
- -e "s:^#*\(MySQLPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI" \
- -e "s:^#*\(MySQLDb[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[4]}:gI" \
- -e "s:^#*\(MySQLCompress[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[5]}:gI" \
- -i "${D}/${DSPAM_CONFDIR}/dspam.conf"
-
- insinto "${DSPAM_CONFDIR}"
- newins src/tools.mysql_drv/mysql_objects-space.sql mysql_objects-space.sql &&
- newins src/tools.mysql_drv/mysql_objects-speed.sql mysql_objects-speed.sql &&
- newins src/tools.mysql_drv/mysql_objects-4.1.sql mysql_objects-4.1.sql &&
- newins src/tools.mysql_drv/purge.sql mysql_purge.sql &&
- newins src/tools.mysql_drv/purge-4.1.sql mysql_purge-4.1.sql ||
- die "failed to install mysql*.sql scripts"
- if use virtual-users ; then
- newins src/tools.mysql_drv/virtual_users.sql mysql_virtual_users.sql &&
- newins src/tools.mysql_drv/virtual_user_aliases.sql mysql_virtual_user_aliases.sql ||
- die "failed to install mysql_virtual_user*.sql scripts"
- fi
- fi
- if use postgres ; then
- DSPAM_DB_DATA[0]="127.0.0.1"
- DSPAM_DB_DATA[1]="5432"
- DSPAM_DB_DATA[2]="dspam"
- DSPAM_DB_DATA[3]="${PASSWORD}"
- DSPAM_DB_DATA[4]="dspam"
-
- # Activate pgsql database configuration
- sed -e "s:^#*\(PgSQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \
- -e "s:^#*\(PgSQLPort[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \
- -e "s:^#*\(PgSQLUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \
- -e "s:^#*\(PgSQLPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI" \
- -e "s:^#*\(PgSQLDb[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[4]}:gI" \
- -e "s:^#*\(PgSQLConnectionCache[\t ]*.\):\1:gI" \
- -i "${D}/${DSPAM_CONFDIR}"/dspam.conf
-
- insinto "${DSPAM_CONFDIR}"
- newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql &&
- newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql ||
- die "failed to install pgsql*.sql scripts"
- if use virtual-users ; then
- newins src/tools.pgsql_drv/virtual_users.sql pgsql_virtual_users.sql ||
- die "failed to install pgsql_virtual_users.sql scripts"
- fi
-
- # Install psycopg scripts needed when postgresql is not installed
- exeinto "${DSPAM_CONFDIR}"
- doexe "${FILESDIR}"/pgsql_{createdb,purge}.py || die "failed to install psycopg scripts"
- fi
-
- # Set default storage
- local DEFAULT_STORAGE
- if use sqlite ; then
- DEFAULT_STORAGE=sqlite3
- elif use mysql ; then
- DEFAULT_STORAGE=mysql
- elif use postgres ; then
- DEFAULT_STORAGE=pgsql
- fi
- if [[ -z "${DEFAULT_STORAGE}" ]]; then
- # When only one storage driver is compiled, it is linked statically with dspam
- # thus you should not set the StorageDriver at all
- # Also, hash_drv requires certain tokenizer and PValue (see bug #185718)
- sed -e "s:^\(StorageDriver[\t ].*\)$:#\1:" \
- -e "s:^Tokenizer .*$:Tokenizer sbph:" \
- -e "/^#PValue/d" \
- -e "s:^PValue .*$:PValue markov:" \
- -i "${D}/${DSPAM_CONFDIR}"/dspam.conf
- else
- # Set the storage driver and use purge configuration for SQL-based installations
- sed -e "s:^\(Purge.*\):###\1:g" \
- -e "s:^#\(Purge.*\):\1:g" \
- -e "s:^###\(Purge.*\):#\1:g" \
- -e "s:^\(StorageDriver[\t ].*\)libhash_drv.so:\1lib${DEFAULT_STORAGE}_drv.so:" \
- -i "${D}/${DSPAM_CONFDIR}"/dspam.conf
- fi
-
- # installs the notification messages
- # -> The documentation is wrong! The files need to be in ./txt
- echo "Scanned and tagged as SPAM with DSPAM ${PV} by Your ISP.com">"${T}"/msgtag.spam
- echo "Scanned and tagged as non-SPAM with DSPAM ${PV} by Your ISP.com">"${T}"/msgtag.nonspam
- insinto "${DSPAM_CONFDIR}"/txt
- doins "${S}"/txt/*.txt
- doins "${T}"/msgtag.*
-
- # Create the opt-in / opt-out directories
- diropts -m0770 -o dspam -g dspam
- dodir "${DSPAM_HOMEDIR}"
- keepdir "${DSPAM_HOMEDIR}"/opt-in
- keepdir "${DSPAM_HOMEDIR}"/opt-out
- diropts -m0755
-
- # dspam cron job
- exeinto /etc/cron.daily
- newexe "${FILESDIR}/dspam.cron-r1" dspam.cron || die "failed to install cron script"
-
- # documentation
- dodoc CHANGELOG README* RELEASE.NOTES UPGRADING
- docinto doc
- dodoc doc/*.txt
- docinto gentoo
- dodoc "${FILESDIR}"/README.{postfix,qmail}
- docinto sa_train
- dodoc "${WORKDIR}"/dspam_sa_trainer/*
- doman man/dspam*
-}
-
-pkg_preinst() {
- # Delete these lines some time after -r6 removal
- if has_version "<=mail-filter/dspam-3.8.0-r6" ; then
- # Remove obsolete *.data files
- local f
- for f in "${ROOT}${DSPAM_CONFDIR}"/{mysql,pgsql}.data ; do
- f=${f/\/\//\/}
- if [[ -f "${f}" ]]; then
- rm "${f}" &&
- elog "Obsolete ${f} has been removed" ||
- eerror "Failed to remove ${f}"
- fi
- done
- fi
-}
-
-pkg_postinst() {
- ewarn "The hash_drv storage backend has the following requirements:"
- ewarn " - PValue must be set to 'markov'; Do not use this pvalue with any other storage backend!"
- ewarn " - Tokenizer must be either 'sbph' or 'osb'"
- ewarn "See markov.txt for more info."
-
- if use mysql || use postgres; then
- elog
- elog "To setup DSPAM to run out-of-the-box on your system with a MySQL"
- elog "or PostgreSQL database, run:"
- elog "emerge --config =${PF}"
- fi
-
- if use daemon; then
- elog
- elog "If you want to run DSPAM in the new daemon mode remember"
- elog "to make the DSPAM daemon start during boot:"
- elog " rc-update add dspam default"
- elog
- elog "To use the DSPAM daemon mode, the used storage driver must be thread-safe."
- fi
-
- elog
- elog "See http://dspamwiki.expass.de/Installation for more info"
-}
-
-# Edits interactively one or more parameters from "${ROOT}${DSPAM_CONFDIR}/dspam.conf"
-# Usage: edit_dspam_params param_name1 [param_name2 ..]
-edit_dspam_params() {
- local PARAMETER OLD_VALUE VALUE
- for PARAMETER in $@ ; do
- OLD_VALUE=$(awk "BEGIN { IGNORECASE=1; } \$1==\"${PARAMETER}\" { print \$2; exit; }" "${ROOT}${DSPAM_CONFDIR}/dspam.conf")
- [[ $? == 0 ]] || return 1
- if [[ "${PARAMETER}" == *"Pass" ]]; then
- read -r -p "${PARAMETER} (default ${OLD_VALUE:-none}; enter random for generating a new random password): " VALUE
- [[ "${VALUE}" == "random" ]] && VALUE="${RANDOM}${RANDOM}${RANDOM}${RANDOM}"
- else
- read -r -p "${PARAMETER} (default ${OLD_VALUE:-none}): " VALUE
- fi
-
- if [[ -z "${VALUE}" ]] ; then
- VALUE=${OLD_VALUE}
- else
- sed -e "s:^#*${PARAMETER}\([\t ].*\)\?\$:${PARAMETER} ${VALUE}:gI" \
- -i "${ROOT}${DSPAM_CONFDIR}/dspam.conf"
- [[ $? == 0 ]] || return 2
- fi
- eval $PARAMETER=\"${VALUE}\"
- done
- return 0
-}
-
-# Selects the storage driver in "${ROOT}${DSPAM_CONFDIR}/dspam.conf"
-# usage: set_storage_driver { hash | sqlite3 | mysql | pgsql }
-set_storage_driver() {
- sed -e "s:^[#\t ]*\(StorageDriver[\t ].*\)lib[a-z1-9]\+_drv.so:\1lib${1}_drv.so:" \
- -i "${ROOT}${DSPAM_CONFDIR}"/dspam.conf &&
- einfo "Storage driver lib${1}_drv.so has been selected"
-}
-
-pkg_config () {
- local AVAIL_BACKENDS=( hash )
- use sqlite && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} sqlite )
- use mysql && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} mysql )
- use postgres && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} postgres )
- local USE_BACKEND
- read -p "Which backend do you want to configure? (available backends are ${AVAIL_BACKENDS[*]}): " USE_BACKEND
- if [[ " ${AVAIL_BACKENDS[*]} " != *" ${USE_BACKEND} "* ]]; then
- eerror "The '${USE_BACKEND}' backend is not available."
- return 1
- fi
-
- case "${USE_BACKEND}" in
-
- hash)
- einfo "hash driver will automatically create the necessary databases"
- set_storage_driver hash
- ;;
-
- sqlite)
- einfo "sqlite driver will automatically create the necessary databases"
- set_storage_driver sqlite3
- ;;
-
- mysql)
- local MySQLServer MySQLPort MySQLUser MySQLPass MySQLDb MySQLCompress
- edit_dspam_params MySQLServer MySQLPort MySQLUser MySQLPass MySQLDb MySQLCompress || return $?
- if [[ -z "${MySQLServer}" || -z "${MySQLUser}" || -z "${MySQLPass}" || -z "${MySQLDb}" ]]; then
- eerror "Following parameters are required: MySQLServer MySQLUser MySQLPass MySQLDb"
- return 1
- fi
-
- local MySQL_DB_Type MySQL_Virtuser_Type
- einfo " Please select what kind of database you like to create:"
- einfo " [0] Don't create the database, I will do it myself"
- einfo " [1] Database will be hosted on a mysql-4.1 server or above"
- einfo " [2] Space optimized database on a mysql-4.0 server or below"
- einfo " [3] Speed optimized database on a mysql-4.0 server or below"
- einfo
- while read -n 1 -s -p " Press 0, 1, 2 or 3 on the keyboard to select database " MySQL_DB_Type; do
- if [[ "${MySQL_DB_Type}" == "0" ]] ; then
- echo
- set_storage_driver mysql
- return 0
- fi
- [[ "${MySQL_DB_Type}" == "1" || "${MySQL_DB_Type}" == "2" || "${MySQL_DB_Type}" == "3" ]] && echo && break
- done
- if use virtual-users ; then
- einfo " Please select what kind of virtual_uids table you like to use:"
- einfo " [1] Virtual users added automatically (use it if this server is the primary MX)"
- einfo " [2] Virtual users added manually (use it if this server is a secondary MX)"
- einfo
- while read -n 1 -s -p " Press 1 or 2 on the keyboard to select table type " MySQL_Virtuser_Type; do
- [[ "${MySQL_Virtuser_Type}" == "1" || "${MySQL_Virtuser_Type}" == "2" ]] && echo && break
- done
- fi
-
- local MYSQL_ROOT_USER
- read -r -p "Your administrative MySQL account (default root): " MYSQL_ROOT_USER
- if [[ -z "${MYSQL_ROOT_USER}" ]]; then
- MYSQL_ROOT_USER="root"
- fi
- einfo "When prompted for a password, please enter your MySQL ${MYSQL_ROOT_USER} password"
-
- local MYSQL_CMD_LINE="/usr/bin/mysql -u ${MYSQL_ROOT_USER} -p"
- [[ "${MySQLServer}" != "/"* ]] && MYSQL_CMD_LINE="${MYSQL_CMD_LINE} -h ${MySQLServer}"
- [[ -n "${MySQLPort}" ]] && MYSQL_CMD_LINE="${MYSQL_CMD_LINE} -P ${MySQLPort}"
- {
- echo "CREATE DATABASE ${MySQLDb};"
- echo "USE ${MySQLDb};"
- case ${MySQL_DB_Type} in
- 1) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_objects-4.1.sql ;;
- 2) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_objects-space.sql ;;
- 3) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_objects-speed.sql ;;
- esac
- if use virtual-users ; then
- case ${MySQL_Virtuser_Type} in
- 1) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_virtual_users.sql ;;
- 2) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_virtual_user_aliases.sql ;;
- esac
- fi
- echo "GRANT SELECT,INSERT,UPDATE,DELETE ON ${MySQLDb}.* TO '${MySQLUser}'@'%' IDENTIFIED BY '${MySQLPass}';"
- echo "FLUSH PRIVILEGES;"
- } | ${MYSQL_CMD_LINE}
- [[ ${PIPESTATUS[1]} == 0 ]] || return ${PIPESTATUS[1]}
-
- einfo "MySQL database created successfully"
- set_storage_driver mysql
- ;;
-
- postgres)
- local PgSQLServer PgSQLPort PgSQLUser PgSQLPass PgSQLDb
- edit_dspam_params PgSQLServer PgSQLPort PgSQLUser PgSQLPass PgSQLDb || return $?
- if [[ -z "${PgSQLServer}" || -z "${PgSQLUser}" || -z "${PgSQLPass}" || -z "${PgSQLDb}" ]]; then
- eerror "Following parameters are required: PgSQLServer PgSQLUser PgSQLPass PgSQLDb"
- return 1
- fi
-
- local PgSQL_DB_Create
- einfo " Do you want PgSQL database be automatically created for you?"
- while read -n 1 -s -p " Press y or n " PgSQL_DB_Create; do
- if [[ "${PgSQL_DB_Create}" == "n" || "${PgSQL_DB_Create}" == "N" ]] ; then
- echo
- set_storage_driver pgsql
- return 0
- fi
- [[ "${PgSQL_DB_Create}" == "y" || "${PgSQL_DB_Create}" == "Y" ]] && echo && break
- done
-
- local PGSQL_ROOT_USER
- read -r -p "Your administrative PgSQL account (default postgres): " PGSQL_ROOT_USER
- if [[ -z "${PGSQL_ROOT_USER}" ]]; then
- PGSQL_ROOT_USER="postgres"
- fi
- einfo "When prompted for a password, please enter your PgSQL ${PGSQL_ROOT_USER} password"
-
- if [[ -x /usr/bin/psql ]]; then
- # Create database using psql
- local PGSQL_CMD_LINE="/usr/bin/psql -h ${PgSQLServer}"
- [[ -n "${PgSQLPort}" ]] && PGSQL_CMD_LINE="${PGSQL_CMD_LINE} -p ${PgSQLPort}"
-
- {
- echo "\\set ON_ERROR_STOP = on;"
- echo "CREATE USER ${PgSQLUser} WITH PASSWORD '${PgSQLPass}' NOCREATEDB NOCREATEUSER;"
- echo "CREATE DATABASE ${PgSQLDb};"
- echo "GRANT ALL PRIVILEGES ON DATABASE ${PgSQLDb} TO ${PgSQLUser};"
- echo "GRANT ALL PRIVILEGES ON SCHEMA public TO ${PgSQLUser};"
- echo "UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='${PgSQLUser}') WHERE datname='${PgSQLDb}';"
- echo "\\c ${PgSQLDb};"
- echo "CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS '\$libdir/plpgsql', 'plpgsql_call_handler' LANGUAGE c;"
- echo "CREATE FUNCTION plpgsql_validator(oid) RETURNS void AS '\$libdir/plpgsql', 'plpgsql_validator' LANGUAGE c;"
- echo "CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler VALIDATOR plpgsql_validator;"
- } | ${PGSQL_CMD_LINE} -d template1 -U ${PGSQL_ROOT_USER}
- [[ ${PIPESTATUS[1]} == 0 ]] || return ${PIPESTATUS[1]}
-
- {
- echo "\\set ON_ERROR_STOP = on;"
- cat "${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql
- use virtual-users && cat "${ROOT}${DSPAM_CONFDIR}"/pgsql_virtual_users.sql
- } | PGUSER="${PgSQLUser}" PGPASSWORD="${PgSQLPass}" ${PGSQL_CMD_LINE} -d "${PgSQLDb}" -U ${PgSQLUser}
- [[ ${PIPESTATUS[1]} == 0 ]] || return ${PIPESTATUS[1]}
- else
- # Create database using psycopg script
- if use virtual-users ; then
- DSPAM_PgSQLPass="${PgSQLPass}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_createdb.py "${PgSQLServer}" "${PgSQLPort}" "${PGSQL_ROOT_USER}" \
- "${PgSQLUser}" "${PgSQLDb}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql "${ROOT}${DSPAM_CONFDIR}"/pgsql_virtual_users.sql
- else
- DSPAM_PgSQLPass="${PgSQLPass}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_createdb.py "${PgSQLServer}" "${PgSQLPort}" "${PGSQL_ROOT_USER}" \
- "${PgSQLUser}" "${PgSQLDb}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql
- fi
- [[ $? == 0 ]] || return $?
- fi
-
- einfo "PgSQL database created successfully"
- set_storage_driver pgsql
- ;;
-
- esac
-}
diff --git a/mail-filter/dspam/dspam-3.8.0-r8.ebuild b/mail-filter/dspam/dspam-3.8.0-r8.ebuild
deleted file mode 100644
index 9b2260dd4959..000000000000
--- a/mail-filter/dspam/dspam-3.8.0-r8.ebuild
+++ /dev/null
@@ -1,527 +0,0 @@
-# Copyright 1999-2008 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.8.0-r8.ebuild,v 1.3 2008/05/21 16:03:01 dev-zero Exp $
-
-WANT_AUTOCONF="latest"
-WANT_AUTOMAKE="latest"
-
-inherit eutils autotools flag-o-matic multilib
-
-DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter"
-HOMEPAGE="http://dspam.nuclearelephant.com/"
-SRC_URI="http://dspam.nuclearelephant.com/sources/${P}.tar.gz
- mirror://gentoo/${P}-patches-20071122.tar.gz
- http://dspam.nuclearelephant.com/sources/extras/dspam_sa_trainer.tar.gz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~ppc ~sparc ~x86"
-IUSE="clamav daemon debug ldap mysql postgres sqlite syslog \
- large-domain virtual-users user-homedirs"
-
-COMMON_DEPEND="clamav? ( >=app-antivirus/clamav-0.90.2 )
- ldap? ( >=net-nds/openldap-2.2 )
- mysql? ( virtual/mysql )
- sqlite? ( =dev-db/sqlite-3* )"
-DEPEND="${COMMON_DEPEND}
- postgres? ( >=virtual/postgresql-base-8 )"
-RDEPEND="${COMMON_DEPEND}
- postgres? ( || ( dev-python/psycopg >=virtual/postgresql-server-8 ) )
- sys-process/cronbase
- virtual/logger"
-
-# some FHS-like structure
-DSPAM_HOMEDIR="/var/spool/dspam"
-DSPAM_CONFDIR="/etc/mail/dspam"
-DSPAM_LOGDIR="/var/log/dspam"
-DSPAM_MODE=2511
-
-pkg_setup() {
- # Delete these lines some time after -r6 removal
- if has_version "<=mail-filter/dspam-3.8.0-r6" &&
- built_with_use "<=mail-filter/dspam-3.8.0-r6" sqlite &&
- grep -q "^StorageDriver.*libsqlite_drv.so" "${ROOT}${DSPAM_CONFDIR}"/dspam.conf; then
- eerror "Sqlite2 support has been removed. Please upgrade your database to sqlite3"
- eerror "and select libsqlite3_drv.so in dspam.conf before proceeding with update."
- die "sqlite-2 no longer supported"
- fi
-
- local egid euid
- # Need a UID and GID >= 1000, for being able to use suexec in apache
- for euid in $(seq 1000 5000 ) ; do
- [[ -z $(egetent passwd ${euid}) ]] && break
- done
- for egid in $(seq 1000 5000 ) ; do
- [[ -z $(egetent group ${egid}) ]] && break
- done
-
- enewgroup dspam ${egid}
- enewuser dspam ${euid} -1 "${DSPAM_HOMEDIR}" dspam,mail
-}
-
-src_unpack() {
- unpack ${A}
- cd "${S}"
-
- EPATCH_SUFFIX="patch"
- epatch "${WORKDIR}"/patches
-
- # Fix Lazy bindings
- append-flags $(bindnow-flags)
-
- AT_M4DIR="${S}/m4"
- eautoreconf
-}
-
-src_compile() {
- local myconf=""
-
- if use mysql || use postgres; then
- myconf="${myconf} $(use_enable virtual-users) --enable-preferences-extension"
- if use virtual-users; then
- myconf="${myconf} --disable-homedir"
- use user-homedirs && ewarn "user-homedirs support has been disabled (not compatible with --enable-virtual-users)"
- else
- myconf="${myconf} $(use_enable user-homedirs homedir)"
- fi
- else
- myconf="${myconf} --disable-virtual-users --disable-preferences-extension \
- $(use_enable user-homedirs homedir)"
- use virtual-users && ewarn "virtual-users support has been disabled (available only for mysql and postgres storage drivers)"
- fi
-
- local STORAGE="hash_drv"
- # select storage driver
- if use sqlite ; then
- STORAGE="${STORAGE},sqlite3_drv"
- fi
- if use mysql; then
- STORAGE="${STORAGE},mysql_drv"
- myconf="${myconf} --with-mysql-includes=/usr/include/mysql"
- myconf="${myconf} --with-mysql-libraries=/usr/$(get_libdir)/mysql"
- fi
- if use postgres ; then
- STORAGE="${STORAGE},pgsql_drv"
- myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql"
- myconf="${myconf} --with-pgsql-libraries=/usr/$(get_libdir)/postgresql"
- fi
-
- econf --with-storage-driver=${STORAGE} \
- --with-dspam-home="${DSPAM_HOMEDIR}" \
- --sysconfdir="${DSPAM_CONFDIR}" \
- $(use_enable daemon) \
- $(use_enable ldap) \
- $(use_enable clamav) \
- $(use_enable large-domain large-scale) \
- $(use_enable !large-domain domain-scale) \
- $(use_enable syslog) \
- $(use_enable debug) \
- $(use_enable debug bnr-debug) \
- --enable-long-usernames \
- --with-dspam-group=dspam \
- --with-dspam-home-group=dspam \
- --with-dspam-mode=${DSPAM_MODE} \
- --with-logdir="${DSPAM_LOGDIR}" \
- ${myconf} || die "econf failed"
- emake || die "emake failed"
-}
-
-src_install () {
- diropts -m0770 -o dspam -g dspam
- dodir "${DSPAM_CONFDIR}"
- insinto "${DSPAM_CONFDIR}"
- insopts -m640 -o dspam -g dspam
- doins src/dspam.conf
- dosym /etc/mail/dspam /etc/dspam
-
- # make install
- emake DESTDIR="${D}" install || die "emake install failed"
-
- # necessary for dovecot-dspam
- insopts -m644
- insinto /usr/include/dspam && doins src/pref.h
-
- diropts -m0755 -o dspam -g dspam
- dodir /var/run/dspam
-
- # create logdir (used only when syslog support has been disabled or build with --enable-debug)
- if ! use syslog || use debug ; then
- diropts -m0770 -o dspam -g dspam
- dodir "${DSPAM_LOGDIR}"
- diropts -m0755
- insinto /etc/logrotate.d
- newins "${FILESDIR}/logrotate.dspam" dspam || die "failed to install logrotate.d file"
- fi
-
- if use daemon; then
- # We use sockets for the daemon instead of tcp port 24
- sed -e 's:^#*\(ServerDomainSocketPath[\t ]\{1,\}\).*:\1\"/var/run/dspam/dspam.sock\":gI' \
- -e 's:^#*\(ServerPID[\t ]\{1,\}\).*:\1/var/run/dspam/dspam.pid:gI' \
- -e 's:^#*\(ClientHost[\t ]\{1,\}\)/.*:\1\"/var/run/dspam/dspam.sock\":gI' \
- -i "${D}/${DSPAM_CONFDIR}/dspam.conf"
-
- newinitd "${FILESDIR}/dspam.rc" dspam || die "failed to install init script"
-
- fowners root:dspam /usr/bin/dspamc &&
- fperms u=rx,g=xs,o=x /usr/bin/dspamc ||
- die "failed to alter dspamc owner:group or mode"
- fi
-
- # database related configuration and scripts
- local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" DSPAM_DB_DATA=()
- if use sqlite; then
- insinto "${DSPAM_CONFDIR}"
- newins src/tools.sqlite_drv/purge-3.sql sqlite3_purge.sql || die "failed to install sqlite3_purge.sql script"
- fi
- if use mysql; then
- DSPAM_DB_DATA[0]="/var/run/mysqld/mysqld.sock"
- DSPAM_DB_DATA[1]=""
- DSPAM_DB_DATA[2]="dspam"
- DSPAM_DB_DATA[3]="${PASSWORD}"
- DSPAM_DB_DATA[4]="dspam"
- DSPAM_DB_DATA[5]="false"
-
- # Activate mysql database configuration
- sed -e "s:^#*\(MySQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \
- -e "s:^#*\(MySQLPort[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \
- -e "s:^#*\(MySQLUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \
- -e "s:^#*\(MySQLPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI" \
- -e "s:^#*\(MySQLDb[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[4]}:gI" \
- -e "s:^#*\(MySQLCompress[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[5]}:gI" \
- -i "${D}/${DSPAM_CONFDIR}/dspam.conf"
-
- insinto "${DSPAM_CONFDIR}"
- newins src/tools.mysql_drv/mysql_objects-space.sql mysql_objects-space.sql &&
- newins src/tools.mysql_drv/mysql_objects-speed.sql mysql_objects-speed.sql &&
- newins src/tools.mysql_drv/mysql_objects-4.1.sql mysql_objects-4.1.sql &&
- newins src/tools.mysql_drv/purge.sql mysql_purge.sql &&
- newins src/tools.mysql_drv/purge-4.1.sql mysql_purge-4.1.sql ||
- die "failed to install mysql*.sql scripts"
- if use virtual-users ; then
- newins src/tools.mysql_drv/virtual_users.sql mysql_virtual_users.sql &&
- newins src/tools.mysql_drv/virtual_user_aliases.sql mysql_virtual_user_aliases.sql ||
- die "failed to install mysql_virtual_user*.sql scripts"
- fi
- fi
- if use postgres ; then
- DSPAM_DB_DATA[0]="127.0.0.1"
- DSPAM_DB_DATA[1]="5432"
- DSPAM_DB_DATA[2]="dspam"
- DSPAM_DB_DATA[3]="${PASSWORD}"
- DSPAM_DB_DATA[4]="dspam"
-
- # Activate pgsql database configuration
- sed -e "s:^#*\(PgSQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \
- -e "s:^#*\(PgSQLPort[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \
- -e "s:^#*\(PgSQLUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \
- -e "s:^#*\(PgSQLPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI" \
- -e "s:^#*\(PgSQLDb[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[4]}:gI" \
- -e "s:^#*\(PgSQLConnectionCache[\t ]*.\):\1:gI" \
- -i "${D}/${DSPAM_CONFDIR}"/dspam.conf
-
- insinto "${DSPAM_CONFDIR}"
- newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql &&
- newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql ||
- die "failed to install pgsql*.sql scripts"
- if use virtual-users ; then
- newins src/tools.pgsql_drv/virtual_users.sql pgsql_virtual_users.sql ||
- die "failed to install pgsql_virtual_users.sql scripts"
- fi
-
- # Install psycopg scripts needed when postgresql is not installed
- exeinto "${DSPAM_CONFDIR}"
- doexe "${FILESDIR}"/pgsql_{createdb,purge}.py || die "failed to install psycopg scripts"
- fi
-
- # Set default storage
- local DEFAULT_STORAGE
- if use sqlite ; then
- DEFAULT_STORAGE=sqlite3
- elif use mysql ; then
- DEFAULT_STORAGE=mysql
- elif use postgres ; then
- DEFAULT_STORAGE=pgsql
- fi
- if [[ -z "${DEFAULT_STORAGE}" ]]; then
- # When only one storage driver is compiled, it is linked statically with dspam
- # thus you should not set the StorageDriver at all
- # Also, hash_drv requires certain tokenizer and PValue (see bug #185718)
- sed -e "s:^\(StorageDriver[\t ].*\)$:#\1:" \
- -e "s:^Tokenizer .*$:Tokenizer sbph:" \
- -e "/^#PValue/d" \
- -e "s:^PValue .*$:PValue markov:" \
- -i "${D}/${DSPAM_CONFDIR}"/dspam.conf
- else
- # Set the storage driver and use purge configuration for SQL-based installations
- sed -e "s:^\(Purge.*\):###\1:g" \
- -e "s:^#\(Purge.*\):\1:g" \
- -e "s:^###\(Purge.*\):#\1:g" \
- -e "s:^\(StorageDriver[\t ].*\)libhash_drv.so:\1lib${DEFAULT_STORAGE}_drv.so:" \
- -i "${D}/${DSPAM_CONFDIR}"/dspam.conf
- fi
-
- # installs the notification messages
- # -> The documentation is wrong! The files need to be in ./txt
- echo "Scanned and tagged as SPAM with DSPAM ${PV} by Your ISP.com">"${T}"/msgtag.spam
- echo "Scanned and tagged as non-SPAM with DSPAM ${PV} by Your ISP.com">"${T}"/msgtag.nonspam
- insinto "${DSPAM_CONFDIR}"/txt
- doins "${S}"/txt/*.txt
- doins "${T}"/msgtag.*
-
- # Create the opt-in / opt-out directories
- diropts -m0770 -o dspam -g dspam
- dodir "${DSPAM_HOMEDIR}"
- keepdir "${DSPAM_HOMEDIR}"/opt-in
- keepdir "${DSPAM_HOMEDIR}"/opt-out
- diropts -m0755
-
- # dspam cron job
- exeinto /etc/cron.daily
- newexe "${FILESDIR}/dspam.cron-r1" dspam.cron || die "failed to install cron script"
-
- # documentation
- dodoc CHANGELOG README* RELEASE.NOTES UPGRADING
- docinto doc
- dodoc doc/*.txt
- docinto gentoo
- dodoc "${FILESDIR}"/README.{postfix,qmail}
- docinto sa_train
- dodoc "${WORKDIR}"/dspam_sa_trainer/*
- doman man/dspam*
-}
-
-pkg_preinst() {
- # Delete these lines some time after -r6 removal
- if has_version "<=mail-filter/dspam-3.8.0-r6" ; then
- # Remove obsolete *.data files
- local f
- for f in "${ROOT}${DSPAM_CONFDIR}"/{mysql,pgsql}.data ; do
- f=${f/\/\//\/}
- if [[ -f "${f}" ]]; then
- rm "${f}" &&
- elog "Obsolete ${f} has been removed" ||
- eerror "Failed to remove ${f}"
- fi
- done
- fi
-}
-
-pkg_postinst() {
- ewarn "The hash_drv storage backend has the following requirements:"
- ewarn " - PValue must be set to 'markov'; Do not use this pvalue with any other storage backend!"
- ewarn " - Tokenizer must be either 'sbph' or 'osb'"
- ewarn "See markov.txt for more info."
-
- if use mysql || use postgres; then
- elog
- elog "To setup DSPAM to run out-of-the-box on your system with a MySQL"
- elog "or PostgreSQL database, run:"
- elog "emerge --config =${PF}"
- fi
-
- if use daemon; then
- elog
- elog "If you want to run DSPAM in the new daemon mode remember"
- elog "to make the DSPAM daemon start during boot:"
- elog " rc-update add dspam default"
- elog
- elog "To use the DSPAM daemon mode, the used storage driver must be thread-safe."
- fi
-
- elog
- elog "See http://dspamwiki.expass.de/Installation for more info"
-}
-
-# Edits interactively one or more parameters from "${ROOT}${DSPAM_CONFDIR}/dspam.conf"
-# Usage: edit_dspam_params param_name1 [param_name2 ..]
-edit_dspam_params() {
- local PARAMETER OLD_VALUE VALUE
- for PARAMETER in $@ ; do
- OLD_VALUE=$(awk "BEGIN { IGNORECASE=1; } \$1==\"${PARAMETER}\" { print \$2; exit; }" "${ROOT}${DSPAM_CONFDIR}/dspam.conf")
- [[ $? == 0 ]] || return 1
- if [[ "${PARAMETER}" == *"Pass" ]]; then
- read -r -p "${PARAMETER} (default ${OLD_VALUE:-none}; enter random for generating a new random password): " VALUE
- [[ "${VALUE}" == "random" ]] && VALUE="${RANDOM}${RANDOM}${RANDOM}${RANDOM}"
- else
- read -r -p "${PARAMETER} (default ${OLD_VALUE:-none}): " VALUE
- fi
-
- if [[ -z "${VALUE}" ]] ; then
- VALUE=${OLD_VALUE}
- else
- sed -e "s:^#*${PARAMETER}\([\t ].*\)\?\$:${PARAMETER} ${VALUE}:gI" \
- -i "${ROOT}${DSPAM_CONFDIR}/dspam.conf"
- [[ $? == 0 ]] || return 2
- fi
- eval $PARAMETER=\"${VALUE}\"
- done
- return 0
-}
-
-# Selects the storage driver in "${ROOT}${DSPAM_CONFDIR}/dspam.conf"
-# usage: set_storage_driver { hash | sqlite3 | mysql | pgsql }
-set_storage_driver() {
- sed -e "s:^[#\t ]*\(StorageDriver[\t ].*\)lib[a-z1-9]\+_drv.so:\1lib${1}_drv.so:" \
- -i "${ROOT}${DSPAM_CONFDIR}"/dspam.conf &&
- einfo "Storage driver lib${1}_drv.so has been selected"
-}
-
-pkg_config () {
- local AVAIL_BACKENDS=( hash )
- use sqlite && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} sqlite )
- use mysql && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} mysql )
- use postgres && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} postgres )
- local USE_BACKEND
- read -p "Which backend do you want to configure? (available backends are ${AVAIL_BACKENDS[*]}): " USE_BACKEND
- if [[ " ${AVAIL_BACKENDS[*]} " != *" ${USE_BACKEND} "* ]]; then
- eerror "The '${USE_BACKEND}' backend is not available."
- return 1
- fi
-
- case "${USE_BACKEND}" in
-
- hash)
- einfo "hash driver will automatically create the necessary databases"
- set_storage_driver hash
- ;;
-
- sqlite)
- einfo "sqlite driver will automatically create the necessary databases"
- set_storage_driver sqlite3
- ;;
-
- mysql)
- local MySQLServer MySQLPort MySQLUser MySQLPass MySQLDb MySQLCompress
- edit_dspam_params MySQLServer MySQLPort MySQLUser MySQLPass MySQLDb MySQLCompress || return $?
- if [[ -z "${MySQLServer}" || -z "${MySQLUser}" || -z "${MySQLPass}" || -z "${MySQLDb}" ]]; then
- eerror "Following parameters are required: MySQLServer MySQLUser MySQLPass MySQLDb"
- return 1
- fi
-
- local MySQL_DB_Type MySQL_Virtuser_Type
- einfo " Please select what kind of database you like to create:"
- einfo " [0] Don't create the database, I will do it myself"
- einfo " [1] Database will be hosted on a mysql-4.1 server or above"
- einfo " [2] Space optimized database on a mysql-4.0 server or below"
- einfo " [3] Speed optimized database on a mysql-4.0 server or below"
- einfo
- while read -n 1 -s -p " Press 0, 1, 2 or 3 on the keyboard to select database " MySQL_DB_Type; do
- if [[ "${MySQL_DB_Type}" == "0" ]] ; then
- echo
- set_storage_driver mysql
- return 0
- fi
- [[ "${MySQL_DB_Type}" == "1" || "${MySQL_DB_Type}" == "2" || "${MySQL_DB_Type}" == "3" ]] && echo && break
- done
- if use virtual-users ; then
- einfo " Please select what kind of virtual_uids table you like to use:"
- einfo " [1] Virtual users added automatically (use it if this server is the primary MX)"
- einfo " [2] Virtual users added manually (use it if this server is a secondary MX)"
- einfo
- while read -n 1 -s -p " Press 1 or 2 on the keyboard to select table type " MySQL_Virtuser_Type; do
- [[ "${MySQL_Virtuser_Type}" == "1" || "${MySQL_Virtuser_Type}" == "2" ]] && echo && break
- done
- fi
-
- local MYSQL_ROOT_USER
- read -r -p "Your administrative MySQL account (default root): " MYSQL_ROOT_USER
- if [[ -z "${MYSQL_ROOT_USER}" ]]; then
- MYSQL_ROOT_USER="root"
- fi
- einfo "When prompted for a password, please enter your MySQL ${MYSQL_ROOT_USER} password"
-
- local MYSQL_CMD_LINE="/usr/bin/mysql -u ${MYSQL_ROOT_USER} -p"
- [[ "${MySQLServer}" != "/"* ]] && MYSQL_CMD_LINE="${MYSQL_CMD_LINE} -h ${MySQLServer}"
- [[ -n "${MySQLPort}" ]] && MYSQL_CMD_LINE="${MYSQL_CMD_LINE} -P ${MySQLPort}"
- {
- echo "CREATE DATABASE ${MySQLDb};"
- echo "USE ${MySQLDb};"
- case ${MySQL_DB_Type} in
- 1) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_objects-4.1.sql ;;
- 2) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_objects-space.sql ;;
- 3) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_objects-speed.sql ;;
- esac
- if use virtual-users ; then
- case ${MySQL_Virtuser_Type} in
- 1) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_virtual_users.sql ;;
- 2) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_virtual_user_aliases.sql ;;
- esac
- fi
- echo "GRANT SELECT,INSERT,UPDATE,DELETE ON ${MySQLDb}.* TO '${MySQLUser}'@'%' IDENTIFIED BY '${MySQLPass}';"
- echo "FLUSH PRIVILEGES;"
- } | ${MYSQL_CMD_LINE}
- [[ ${PIPESTATUS[1]} == 0 ]] || return ${PIPESTATUS[1]}
-
- einfo "MySQL database created successfully"
- set_storage_driver mysql
- ;;
-
- postgres)
- local PgSQLServer PgSQLPort PgSQLUser PgSQLPass PgSQLDb
- edit_dspam_params PgSQLServer PgSQLPort PgSQLUser PgSQLPass PgSQLDb || return $?
- if [[ -z "${PgSQLServer}" || -z "${PgSQLUser}" || -z "${PgSQLPass}" || -z "${PgSQLDb}" ]]; then
- eerror "Following parameters are required: PgSQLServer PgSQLUser PgSQLPass PgSQLDb"
- return 1
- fi
-
- local PgSQL_DB_Create
- einfo " Do you want PgSQL database be automatically created for you?"
- while read -n 1 -s -p " Press y or n " PgSQL_DB_Create; do
- if [[ "${PgSQL_DB_Create}" == "n" || "${PgSQL_DB_Create}" == "N" ]] ; then
- echo
- set_storage_driver pgsql
- return 0
- fi
- [[ "${PgSQL_DB_Create}" == "y" || "${PgSQL_DB_Create}" == "Y" ]] && echo && break
- done
-
- local PGSQL_ROOT_USER
- read -r -p "Your administrative PgSQL account (default postgres): " PGSQL_ROOT_USER
- if [[ -z "${PGSQL_ROOT_USER}" ]]; then
- PGSQL_ROOT_USER="postgres"
- fi
- einfo "When prompted for a password, please enter your PgSQL ${PGSQL_ROOT_USER} password"
-
- if [[ -x /usr/bin/psql ]]; then
- # Create database using psql
- local PGSQL_CMD_LINE="/usr/bin/psql -h ${PgSQLServer}"
- [[ -n "${PgSQLPort}" ]] && PGSQL_CMD_LINE="${PGSQL_CMD_LINE} -p ${PgSQLPort}"
-
- {
- echo "\\set ON_ERROR_STOP = on;"
- echo "CREATE USER ${PgSQLUser} WITH PASSWORD '${PgSQLPass}' NOCREATEDB NOCREATEUSER;"
- echo "CREATE DATABASE ${PgSQLDb};"
- echo "GRANT ALL PRIVILEGES ON DATABASE ${PgSQLDb} TO ${PgSQLUser};"
- echo "GRANT ALL PRIVILEGES ON SCHEMA public TO ${PgSQLUser};"
- echo "UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='${PgSQLUser}') WHERE datname='${PgSQLDb}';"
- echo "\\c ${PgSQLDb};"
- echo "CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS '\$libdir/plpgsql', 'plpgsql_call_handler' LANGUAGE c;"
- echo "CREATE FUNCTION plpgsql_validator(oid) RETURNS void AS '\$libdir/plpgsql', 'plpgsql_validator' LANGUAGE c;"
- echo "CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler VALIDATOR plpgsql_validator;"
- } | ${PGSQL_CMD_LINE} -d template1 -U ${PGSQL_ROOT_USER}
- [[ ${PIPESTATUS[1]} == 0 ]] || return ${PIPESTATUS[1]}
-
- {
- echo "\\set ON_ERROR_STOP = on;"
- cat "${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql
- use virtual-users && cat "${ROOT}${DSPAM_CONFDIR}"/pgsql_virtual_users.sql
- } | PGUSER="${PgSQLUser}" PGPASSWORD="${PgSQLPass}" ${PGSQL_CMD_LINE} -d "${PgSQLDb}" -U ${PgSQLUser}
- [[ ${PIPESTATUS[1]} == 0 ]] || return ${PIPESTATUS[1]}
- else
- # Create database using psycopg script
- if use virtual-users ; then
- DSPAM_PgSQLPass="${PgSQLPass}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_createdb.py "${PgSQLServer}" "${PgSQLPort}" "${PGSQL_ROOT_USER}" \
- "${PgSQLUser}" "${PgSQLDb}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql "${ROOT}${DSPAM_CONFDIR}"/pgsql_virtual_users.sql
- else
- DSPAM_PgSQLPass="${PgSQLPass}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_createdb.py "${PgSQLServer}" "${PgSQLPort}" "${PGSQL_ROOT_USER}" \
- "${PgSQLUser}" "${PgSQLDb}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql
- fi
- [[ $? == 0 ]] || return $?
- fi
-
- einfo "PgSQL database created successfully"
- set_storage_driver pgsql
- ;;
-
- esac
-}
diff --git a/mail-filter/dspam/dspam-3.8.0-r9.ebuild b/mail-filter/dspam/dspam-3.8.0-r9.ebuild
deleted file mode 100644
index 3bca176ab371..000000000000
--- a/mail-filter/dspam/dspam-3.8.0-r9.ebuild
+++ /dev/null
@@ -1,528 +0,0 @@
-# Copyright 1999-2008 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.8.0-r9.ebuild,v 1.5 2008/05/21 16:03:01 dev-zero Exp $
-
-WANT_AUTOCONF="latest"
-WANT_AUTOMAKE="latest"
-
-inherit eutils autotools flag-o-matic multilib
-
-DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter"
-HOMEPAGE="http://dspam.nuclearelephant.com/"
-SRC_URI="http://dspam.nuclearelephant.com/sources/${P}.tar.gz
- mirror://gentoo/${P}-patches-20071231.tar.gz
- http://dspam.nuclearelephant.com/sources/extras/dspam_sa_trainer.tar.gz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~ppc ~sparc ~x86"
-IUSE="clamav daemon debug ldap mysql postgres sqlite syslog \
- large-domain virtual-users user-homedirs"
-
-COMMON_DEPEND="clamav? ( >=app-antivirus/clamav-0.90.2 )
- ldap? ( >=net-nds/openldap-2.2 )
- mysql? ( virtual/mysql )
- sqlite? ( =dev-db/sqlite-3* )"
-DEPEND="${COMMON_DEPEND}
- postgres? ( >=virtual/postgresql-base-8 )"
-RDEPEND="${COMMON_DEPEND}
- postgres? ( || ( dev-python/psycopg >=virtual/postgresql-server-8 ) )
- sys-process/cronbase
- virtual/logger"
-
-# some FHS-like structure
-DSPAM_HOMEDIR="/var/spool/dspam"
-DSPAM_CONFDIR="/etc/mail/dspam"
-DSPAM_LOGDIR="/var/log/dspam"
-DSPAM_MODE=2511
-
-pkg_setup() {
- # Delete these lines some time after -r6 removal
- if has_version "<=mail-filter/dspam-3.8.0-r6" &&
- built_with_use "<=mail-filter/dspam-3.8.0-r6" sqlite &&
- grep -q "^StorageDriver.*libsqlite_drv.so" "${ROOT}${DSPAM_CONFDIR}"/dspam.conf; then
- eerror "Sqlite2 support has been removed. Please upgrade your database to sqlite3"
- eerror "and select libsqlite3_drv.so in dspam.conf before proceeding with update."
- die "sqlite-2 no longer supported"
- fi
-
- local egid euid
- # Need a UID and GID >= 1000, for being able to use suexec in apache
- for euid in $(seq 1000 5000 ) ; do
- [[ -z $(egetent passwd ${euid}) ]] && break
- done
- for egid in $(seq 1000 5000 ) ; do
- [[ -z $(egetent group ${egid}) ]] && break
- done
-
- enewgroup dspam ${egid}
- enewuser dspam ${euid} -1 "${DSPAM_HOMEDIR}" dspam,mail
-}
-
-src_unpack() {
- unpack ${A}
- cd "${S}"
-
- EPATCH_SUFFIX="patch"
- epatch "${WORKDIR}"/patches
-
- # Fix Lazy bindings
- append-flags $(bindnow-flags)
-
- AT_M4DIR="${S}/m4"
- eautoreconf
-}
-
-src_compile() {
- local myconf=""
-
- if use mysql || use postgres; then
- myconf="${myconf} $(use_enable virtual-users) --enable-preferences-extension"
- if use virtual-users; then
- myconf="${myconf} --disable-homedir"
- use user-homedirs && ewarn "user-homedirs support has been disabled (not compatible with --enable-virtual-users)"
- else
- myconf="${myconf} $(use_enable user-homedirs homedir)"
- fi
- else
- myconf="${myconf} --disable-virtual-users --disable-preferences-extension \
- $(use_enable user-homedirs homedir)"
- use virtual-users && ewarn "virtual-users support has been disabled (available only for mysql and postgres storage drivers)"
- fi
-
- local STORAGE="hash_drv"
- # select storage driver
- if use sqlite ; then
- STORAGE="${STORAGE},sqlite3_drv"
- fi
- if use mysql; then
- STORAGE="${STORAGE},mysql_drv"
- myconf="${myconf} --with-mysql-includes=/usr/include/mysql"
- myconf="${myconf} --with-mysql-libraries=/usr/$(get_libdir)/mysql"
- fi
- if use postgres ; then
- STORAGE="${STORAGE},pgsql_drv"
- myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql"
- myconf="${myconf} --with-pgsql-libraries=/usr/$(get_libdir)/postgresql"
- fi
-
- econf --with-storage-driver=${STORAGE} \
- --with-dspam-home="${DSPAM_HOMEDIR}" \
- --sysconfdir="${DSPAM_CONFDIR}" \
- $(use_enable daemon) \
- $(use_enable ldap) \
- $(use_enable clamav) \
- $(use_enable large-domain large-scale) \
- $(use_enable !large-domain domain-scale) \
- $(use_enable syslog) \
- $(use_enable debug) \
- $(use_enable debug bnr-debug) \
- $(use_enable debug verbose-debug) \
- --enable-long-usernames \
- --with-dspam-group=dspam \
- --with-dspam-home-group=dspam \
- --with-dspam-mode=${DSPAM_MODE} \
- --with-logdir="${DSPAM_LOGDIR}" \
- ${myconf} || die "econf failed"
- emake || die "emake failed"
-}
-
-src_install () {
- diropts -m0770 -o dspam -g dspam
- dodir "${DSPAM_CONFDIR}"
- insinto "${DSPAM_CONFDIR}"
- insopts -m640 -o dspam -g dspam
- doins src/dspam.conf
- dosym /etc/mail/dspam /etc/dspam
-
- # make install
- emake DESTDIR="${D}" install || die "emake install failed"
-
- # necessary for dovecot-dspam
- insopts -m644
- insinto /usr/include/dspam && doins src/pref.h
-
- diropts -m0755 -o dspam -g dspam
- dodir /var/run/dspam
-
- # create logdir (used only when syslog support has been disabled or build with --enable-debug)
- if ! use syslog || use debug ; then
- diropts -m0770 -o dspam -g dspam
- dodir "${DSPAM_LOGDIR}"
- diropts -m0755
- insinto /etc/logrotate.d
- newins "${FILESDIR}/logrotate.dspam" dspam || die "failed to install logrotate.d file"
- fi
-
- if use daemon; then
- # We use sockets for the daemon instead of tcp port 24
- sed -e 's:^#*\(ServerDomainSocketPath[\t ]\{1,\}\).*:\1\"/var/run/dspam/dspam.sock\":gI' \
- -e 's:^#*\(ServerPID[\t ]\{1,\}\).*:\1/var/run/dspam/dspam.pid:gI' \
- -e 's:^#*\(ClientHost[\t ]\{1,\}\)/.*:\1\"/var/run/dspam/dspam.sock\":gI' \
- -i "${D}/${DSPAM_CONFDIR}/dspam.conf"
-
- newinitd "${FILESDIR}/dspam.rc" dspam || die "failed to install init script"
-
- fowners root:dspam /usr/bin/dspamc &&
- fperms u=rx,g=xs,o=x /usr/bin/dspamc ||
- die "failed to alter dspamc owner:group or mode"
- fi
-
- # database related configuration and scripts
- local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" DSPAM_DB_DATA=()
- if use sqlite; then
- insinto "${DSPAM_CONFDIR}"
- newins src/tools.sqlite_drv/purge-3.sql sqlite3_purge.sql || die "failed to install sqlite3_purge.sql script"
- fi
- if use mysql; then
- DSPAM_DB_DATA[0]="/var/run/mysqld/mysqld.sock"
- DSPAM_DB_DATA[1]=""
- DSPAM_DB_DATA[2]="dspam"
- DSPAM_DB_DATA[3]="${PASSWORD}"
- DSPAM_DB_DATA[4]="dspam"
- DSPAM_DB_DATA[5]="false"
-
- # Activate mysql database configuration
- sed -e "s:^#*\(MySQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \
- -e "s:^#*\(MySQLPort[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \
- -e "s:^#*\(MySQLUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \
- -e "s:^#*\(MySQLPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI" \
- -e "s:^#*\(MySQLDb[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[4]}:gI" \
- -e "s:^#*\(MySQLCompress[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[5]}:gI" \
- -i "${D}/${DSPAM_CONFDIR}/dspam.conf"
-
- insinto "${DSPAM_CONFDIR}"
- newins src/tools.mysql_drv/mysql_objects-space.sql mysql_objects-space.sql &&
- newins src/tools.mysql_drv/mysql_objects-speed.sql mysql_objects-speed.sql &&
- newins src/tools.mysql_drv/mysql_objects-4.1.sql mysql_objects-4.1.sql &&
- newins src/tools.mysql_drv/purge.sql mysql_purge.sql &&
- newins src/tools.mysql_drv/purge-4.1.sql mysql_purge-4.1.sql ||
- die "failed to install mysql*.sql scripts"
- if use virtual-users ; then
- newins src/tools.mysql_drv/virtual_users.sql mysql_virtual_users.sql &&
- newins src/tools.mysql_drv/virtual_user_aliases.sql mysql_virtual_user_aliases.sql ||
- die "failed to install mysql_virtual_user*.sql scripts"
- fi
- fi
- if use postgres ; then
- DSPAM_DB_DATA[0]="127.0.0.1"
- DSPAM_DB_DATA[1]="5432"
- DSPAM_DB_DATA[2]="dspam"
- DSPAM_DB_DATA[3]="${PASSWORD}"
- DSPAM_DB_DATA[4]="dspam"
-
- # Activate pgsql database configuration
- sed -e "s:^#*\(PgSQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \
- -e "s:^#*\(PgSQLPort[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \
- -e "s:^#*\(PgSQLUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \
- -e "s:^#*\(PgSQLPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI" \
- -e "s:^#*\(PgSQLDb[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[4]}:gI" \
- -e "s:^#*\(PgSQLConnectionCache[\t ]*.\):\1:gI" \
- -i "${D}/${DSPAM_CONFDIR}"/dspam.conf
-
- insinto "${DSPAM_CONFDIR}"
- newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql &&
- newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql ||
- die "failed to install pgsql*.sql scripts"
- if use virtual-users ; then
- newins src/tools.pgsql_drv/virtual_users.sql pgsql_virtual_users.sql ||
- die "failed to install pgsql_virtual_users.sql scripts"
- fi
-
- # Install psycopg scripts needed when postgresql is not installed
- exeinto "${DSPAM_CONFDIR}"
- doexe "${FILESDIR}"/pgsql_{createdb,purge}.py || die "failed to install psycopg scripts"
- fi
-
- # Set default storage
- local DEFAULT_STORAGE
- if use sqlite ; then
- DEFAULT_STORAGE=sqlite3
- elif use mysql ; then
- DEFAULT_STORAGE=mysql
- elif use postgres ; then
- DEFAULT_STORAGE=pgsql
- fi
- if [[ -z "${DEFAULT_STORAGE}" ]]; then
- # When only one storage driver is compiled, it is linked statically with dspam
- # thus you should not set the StorageDriver at all
- # Also, hash_drv requires certain tokenizer and PValue (see bug #185718)
- sed -e "s:^\(StorageDriver[\t ].*\)$:#\1:" \
- -e "s:^Tokenizer .*$:Tokenizer sbph:" \
- -e "/^#PValue/d" \
- -e "s:^PValue .*$:PValue markov:" \
- -i "${D}/${DSPAM_CONFDIR}"/dspam.conf
- else
- # Set the storage driver and use purge configuration for SQL-based installations
- sed -e "s:^\(Purge.*\):###\1:g" \
- -e "s:^#\(Purge.*\):\1:g" \
- -e "s:^###\(Purge.*\):#\1:g" \
- -e "s:^\(StorageDriver[\t ].*\)libhash_drv.so:\1lib${DEFAULT_STORAGE}_drv.so:" \
- -i "${D}/${DSPAM_CONFDIR}"/dspam.conf
- fi
-
- # installs the notification messages
- # -> The documentation is wrong! The files need to be in ./txt
- echo "Scanned and tagged as SPAM with DSPAM ${PV} by Your ISP.com">"${T}"/msgtag.spam
- echo "Scanned and tagged as non-SPAM with DSPAM ${PV} by Your ISP.com">"${T}"/msgtag.nonspam
- insinto "${DSPAM_CONFDIR}"/txt
- doins "${S}"/txt/*.txt
- doins "${T}"/msgtag.*
-
- # Create the opt-in / opt-out directories
- diropts -m0770 -o dspam -g dspam
- dodir "${DSPAM_HOMEDIR}"
- keepdir "${DSPAM_HOMEDIR}"/opt-in
- keepdir "${DSPAM_HOMEDIR}"/opt-out
- diropts -m0755
-
- # dspam cron job
- exeinto /etc/cron.daily
- newexe "${FILESDIR}/dspam.cron-r1" dspam.cron || die "failed to install cron script"
-
- # documentation
- dodoc CHANGELOG README* RELEASE.NOTES UPGRADING
- docinto doc
- dodoc doc/*.txt
- docinto gentoo
- dodoc "${FILESDIR}"/README.{postfix,qmail}
- docinto sa_train
- dodoc "${WORKDIR}"/dspam_sa_trainer/*
- doman man/dspam*
-}
-
-pkg_preinst() {
- # Delete these lines some time after -r6 removal
- if has_version "<=mail-filter/dspam-3.8.0-r6" ; then
- # Remove obsolete *.data files
- local f
- for f in "${ROOT}${DSPAM_CONFDIR}"/{mysql,pgsql}.data ; do
- f=${f/\/\//\/}
- if [[ -f "${f}" ]]; then
- rm "${f}" &&
- elog "Obsolete ${f} has been removed" ||
- eerror "Failed to remove ${f}"
- fi
- done
- fi
-}
-
-pkg_postinst() {
- ewarn "The hash_drv storage backend has the following requirements:"
- ewarn " - PValue must be set to 'markov'; Do not use this pvalue with any other storage backend!"
- ewarn " - Tokenizer must be either 'sbph' or 'osb'"
- ewarn "See markov.txt for more info."
-
- if use mysql || use postgres; then
- elog
- elog "To setup DSPAM to run out-of-the-box on your system with a MySQL"
- elog "or PostgreSQL database, run:"
- elog "emerge --config =${PF}"
- fi
-
- if use daemon; then
- elog
- elog "If you want to run DSPAM in the new daemon mode remember"
- elog "to make the DSPAM daemon start during boot:"
- elog " rc-update add dspam default"
- elog
- elog "To use the DSPAM daemon mode, the used storage driver must be thread-safe."
- fi
-
- elog
- elog "See http://dspamwiki.expass.de/Installation for more info"
-}
-
-# Edits interactively one or more parameters from "${ROOT}${DSPAM_CONFDIR}/dspam.conf"
-# Usage: edit_dspam_params param_name1 [param_name2 ..]
-edit_dspam_params() {
- local PARAMETER OLD_VALUE VALUE
- for PARAMETER in $@ ; do
- OLD_VALUE=$(awk "BEGIN { IGNORECASE=1; } \$1==\"${PARAMETER}\" { print \$2; exit; }" "${ROOT}${DSPAM_CONFDIR}/dspam.conf")
- [[ $? == 0 ]] || return 1
- if [[ "${PARAMETER}" == *"Pass" ]]; then
- read -r -p "${PARAMETER} (default ${OLD_VALUE:-none}; enter random for generating a new random password): " VALUE
- [[ "${VALUE}" == "random" ]] && VALUE="${RANDOM}${RANDOM}${RANDOM}${RANDOM}"
- else
- read -r -p "${PARAMETER} (default ${OLD_VALUE:-none}): " VALUE
- fi
-
- if [[ -z "${VALUE}" ]] ; then
- VALUE=${OLD_VALUE}
- else
- sed -e "s:^#*${PARAMETER}\([\t ].*\)\?\$:${PARAMETER} ${VALUE}:gI" \
- -i "${ROOT}${DSPAM_CONFDIR}/dspam.conf"
- [[ $? == 0 ]] || return 2
- fi
- eval $PARAMETER=\"${VALUE}\"
- done
- return 0
-}
-
-# Selects the storage driver in "${ROOT}${DSPAM_CONFDIR}/dspam.conf"
-# usage: set_storage_driver { hash | sqlite3 | mysql | pgsql }
-set_storage_driver() {
- sed -e "s:^[#\t ]*\(StorageDriver[\t ].*\)lib[a-z1-9]\+_drv.so:\1lib${1}_drv.so:" \
- -i "${ROOT}${DSPAM_CONFDIR}"/dspam.conf &&
- einfo "Storage driver lib${1}_drv.so has been selected"
-}
-
-pkg_config () {
- local AVAIL_BACKENDS=( hash )
- use sqlite && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} sqlite )
- use mysql && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} mysql )
- use postgres && AVAIL_BACKENDS=( ${AVAIL_BACKENDS[*]} postgres )
- local USE_BACKEND
- read -p "Which backend do you want to configure? (available backends are ${AVAIL_BACKENDS[*]}): " USE_BACKEND
- if [[ " ${AVAIL_BACKENDS[*]} " != *" ${USE_BACKEND} "* ]]; then
- eerror "The '${USE_BACKEND}' backend is not available."
- return 1
- fi
-
- case "${USE_BACKEND}" in
-
- hash)
- einfo "hash driver will automatically create the necessary databases"
- set_storage_driver hash
- ;;
-
- sqlite)
- einfo "sqlite driver will automatically create the necessary databases"
- set_storage_driver sqlite3
- ;;
-
- mysql)
- local MySQLServer MySQLPort MySQLUser MySQLPass MySQLDb MySQLCompress
- edit_dspam_params MySQLServer MySQLPort MySQLUser MySQLPass MySQLDb MySQLCompress || return $?
- if [[ -z "${MySQLServer}" || -z "${MySQLUser}" || -z "${MySQLPass}" || -z "${MySQLDb}" ]]; then
- eerror "Following parameters are required: MySQLServer MySQLUser MySQLPass MySQLDb"
- return 1
- fi
-
- local MySQL_DB_Type MySQL_Virtuser_Type
- einfo " Please select what kind of database you like to create:"
- einfo " [0] Don't create the database, I will do it myself"
- einfo " [1] Database will be hosted on a mysql-4.1 server or above"
- einfo " [2] Space optimized database on a mysql-4.0 server or below"
- einfo " [3] Speed optimized database on a mysql-4.0 server or below"
- einfo
- while read -n 1 -s -p " Press 0, 1, 2 or 3 on the keyboard to select database " MySQL_DB_Type; do
- if [[ "${MySQL_DB_Type}" == "0" ]] ; then
- echo
- set_storage_driver mysql
- return 0
- fi
- [[ "${MySQL_DB_Type}" == "1" || "${MySQL_DB_Type}" == "2" || "${MySQL_DB_Type}" == "3" ]] && echo && break
- done
- if use virtual-users ; then
- einfo " Please select what kind of virtual_uids table you like to use:"
- einfo " [1] Virtual users added automatically (use it if this server is the primary MX)"
- einfo " [2] Virtual users added manually (use it if this server is a secondary MX)"
- einfo
- while read -n 1 -s -p " Press 1 or 2 on the keyboard to select table type " MySQL_Virtuser_Type; do
- [[ "${MySQL_Virtuser_Type}" == "1" || "${MySQL_Virtuser_Type}" == "2" ]] && echo && break
- done
- fi
-
- local MYSQL_ROOT_USER
- read -r -p "Your administrative MySQL account (default root): " MYSQL_ROOT_USER
- if [[ -z "${MYSQL_ROOT_USER}" ]]; then
- MYSQL_ROOT_USER="root"
- fi
- einfo "When prompted for a password, please enter your MySQL ${MYSQL_ROOT_USER} password"
-
- local MYSQL_CMD_LINE="/usr/bin/mysql -u ${MYSQL_ROOT_USER} -p"
- [[ "${MySQLServer}" != "/"* ]] && MYSQL_CMD_LINE="${MYSQL_CMD_LINE} -h ${MySQLServer}"
- [[ -n "${MySQLPort}" ]] && MYSQL_CMD_LINE="${MYSQL_CMD_LINE} -P ${MySQLPort}"
- {
- echo "CREATE DATABASE ${MySQLDb};"
- echo "USE ${MySQLDb};"
- case ${MySQL_DB_Type} in
- 1) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_objects-4.1.sql ;;
- 2) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_objects-space.sql ;;
- 3) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_objects-speed.sql ;;
- esac
- if use virtual-users ; then
- case ${MySQL_Virtuser_Type} in
- 1) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_virtual_users.sql ;;
- 2) cat "${ROOT}${DSPAM_CONFDIR}"/mysql_virtual_user_aliases.sql ;;
- esac
- fi
- echo "GRANT SELECT,INSERT,UPDATE,DELETE ON ${MySQLDb}.* TO '${MySQLUser}'@'%' IDENTIFIED BY '${MySQLPass}';"
- echo "FLUSH PRIVILEGES;"
- } | ${MYSQL_CMD_LINE}
- [[ ${PIPESTATUS[1]} == 0 ]] || return ${PIPESTATUS[1]}
-
- einfo "MySQL database created successfully"
- set_storage_driver mysql
- ;;
-
- postgres)
- local PgSQLServer PgSQLPort PgSQLUser PgSQLPass PgSQLDb
- edit_dspam_params PgSQLServer PgSQLPort PgSQLUser PgSQLPass PgSQLDb || return $?
- if [[ -z "${PgSQLServer}" || -z "${PgSQLUser}" || -z "${PgSQLPass}" || -z "${PgSQLDb}" ]]; then
- eerror "Following parameters are required: PgSQLServer PgSQLUser PgSQLPass PgSQLDb"
- return 1
- fi
-
- local PgSQL_DB_Create
- einfo " Do you want PgSQL database be automatically created for you?"
- while read -n 1 -s -p " Press y or n " PgSQL_DB_Create; do
- if [[ "${PgSQL_DB_Create}" == "n" || "${PgSQL_DB_Create}" == "N" ]] ; then
- echo
- set_storage_driver pgsql
- return 0
- fi
- [[ "${PgSQL_DB_Create}" == "y" || "${PgSQL_DB_Create}" == "Y" ]] && echo && break
- done
-
- local PGSQL_ROOT_USER
- read -r -p "Your administrative PgSQL account (default postgres): " PGSQL_ROOT_USER
- if [[ -z "${PGSQL_ROOT_USER}" ]]; then
- PGSQL_ROOT_USER="postgres"
- fi
- einfo "When prompted for a password, please enter your PgSQL ${PGSQL_ROOT_USER} password"
-
- if [[ -x /usr/bin/psql ]]; then
- # Create database using psql
- local PGSQL_CMD_LINE="/usr/bin/psql -h ${PgSQLServer}"
- [[ -n "${PgSQLPort}" ]] && PGSQL_CMD_LINE="${PGSQL_CMD_LINE} -p ${PgSQLPort}"
-
- {
- echo "\\set ON_ERROR_STOP = on;"
- echo "CREATE USER ${PgSQLUser} WITH PASSWORD '${PgSQLPass}' NOCREATEDB NOCREATEUSER;"
- echo "CREATE DATABASE ${PgSQLDb};"
- echo "GRANT ALL PRIVILEGES ON DATABASE ${PgSQLDb} TO ${PgSQLUser};"
- echo "GRANT ALL PRIVILEGES ON SCHEMA public TO ${PgSQLUser};"
- echo "UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='${PgSQLUser}') WHERE datname='${PgSQLDb}';"
- echo "\\c ${PgSQLDb};"
- echo "CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS '\$libdir/plpgsql', 'plpgsql_call_handler' LANGUAGE c;"
- echo "CREATE FUNCTION plpgsql_validator(oid) RETURNS void AS '\$libdir/plpgsql', 'plpgsql_validator' LANGUAGE c;"
- echo "CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler VALIDATOR plpgsql_validator;"
- } | ${PGSQL_CMD_LINE} -d template1 -U ${PGSQL_ROOT_USER}
- [[ ${PIPESTATUS[1]} == 0 ]] || return ${PIPESTATUS[1]}
-
- {
- echo "\\set ON_ERROR_STOP = on;"
- cat "${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql
- use virtual-users && cat "${ROOT}${DSPAM_CONFDIR}"/pgsql_virtual_users.sql
- } | PGUSER="${PgSQLUser}" PGPASSWORD="${PgSQLPass}" ${PGSQL_CMD_LINE} -d "${PgSQLDb}" -U ${PgSQLUser}
- [[ ${PIPESTATUS[1]} == 0 ]] || return ${PIPESTATUS[1]}
- else
- # Create database using psycopg script
- if use virtual-users ; then
- DSPAM_PgSQLPass="${PgSQLPass}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_createdb.py "${PgSQLServer}" "${PgSQLPort}" "${PGSQL_ROOT_USER}" \
- "${PgSQLUser}" "${PgSQLDb}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql "${ROOT}${DSPAM_CONFDIR}"/pgsql_virtual_users.sql
- else
- DSPAM_PgSQLPass="${PgSQLPass}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_createdb.py "${PgSQLServer}" "${PgSQLPort}" "${PGSQL_ROOT_USER}" \
- "${PgSQLUser}" "${PgSQLDb}" "${ROOT}${DSPAM_CONFDIR}"/pgsql_objects.sql
- fi
- [[ $? == 0 ]] || return $?
- fi
-
- einfo "PgSQL database created successfully"
- set_storage_driver pgsql
- ;;
-
- esac
-}
diff --git a/mail-filter/dspam/files/dspam.cron-r1 b/mail-filter/dspam/files/dspam.cron-r1
deleted file mode 100644
index 53186b6db4d9..000000000000
--- a/mail-filter/dspam/files/dspam.cron-r1
+++ /dev/null
@@ -1,372 +0,0 @@
-#!/bin/sh
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-#
-# Remove old signatures and unimportant tokens from the DSPAM database.
-# Purge old log entries in user logs.
-#
-
-#
-# Parse optional command line parameters
-#
-for foo in $@
-do
- case "${foo}" in
- --logdays=*) LOGROTATE_AGE="${foo#--logdays=}";;
- --sigdays=*) SIGNATURE_AGE="${foo#--sigdays=}";;
- --without-sql-purge) USE_SQL_PURGE=false;;
- *)
- echo "usage: $0 [--logdays=no_of_days] [--sigdays=no_of_days] [--without-sql-purge]"
- exit 1
- ;;
- esac
-done
-
-#
-# Parameters
-#
-[ -z "${LOGROTATE_AGE}" ] && LOGROTATE_AGE=30 # Delete log entries older than $LOGROTATE_AGE days
-[ -z "${SIGNATURE_AGE}" ] && SIGNATURE_AGE=30 # Delete signatures older than $SIGNATURE_AGE days
-[ -z "${USE_SQL_PURGE}" ] && USE_SQL_PURGE=true # Run sql purge scripts
-
-#
-# Function to run dspam_clean
-#
-run_dspam_clean() {
- if [ ! -e "/usr/bin/dspam_clean" ]
- then
- echo "Can not run DSPAM clean application:"
- echo " /usr/bin/dspam_clean does not exist"
- return 1
- else
- /usr/bin/dspam_clean -s${SIGNATURE_AGE} -p${SIGNATURE_AGE} -u${SIGNATURE_AGE},${SIGNATURE_AGE},${SIGNATURE_AGE},${SIGNATURE_AGE} >/dev/null 2>&1
- return $?
- fi
-}
-
-
-#
-# Function to check if we have all needed tools
-#
-check_for_tools() {
- local myrc=0
- for foo in awk cut sed getent
- do
- if ! which ${foo} >/dev/null 2>&1
- then
- echo "Command ${foo} not found!"
- myrc=1
- fi
- done
- return ${myrc}
-}
-
-
-#
-# Function to read dspam.conf parameters
-#
-read_dspam_params() {
- local PARAMETER VALUE
- for PARAMETER in $@ ; do
- VALUE=$(awk "BEGIN { IGNORECASE=1; } \$1==\"${PARAMETER}\" { print \$2; exit; }" "${DSPAM_CONFIGDIR}/dspam.conf")
- [[ $? == 0 ]] || return 1
- eval ${PARAMETER}=\"${VALUE}\"
- done
- return 0
-}
-
-
-#
-# Function to clean DSPAM MySQL data
-#
-clean_mysql_drv() {
- #
- # MySQL
- #
- if ${USE_SQL_PURGE} && \
- read_dspam_params MySQLServer MySQLPort MySQLUser MySQLPass MySQLDb MySQLCompress && \
- [ -n "${MySQLServer}" -a -n "${MySQLUser}" -a -n "${MySQLDb}" ]
- then
- if [ ! -e "/usr/bin/mysql_config" ]
- then
- echo "Can not run MySQL purge script:"
- echo " /usr/bin/mysql_config does not exist"
- return 1
- fi
- DSPAM_MySQL_PURGE_SQL=
- DSPAM_MySQL_VER=$(/usr/bin/mysql_config --version | sed "s:[^0-9.]*::g")
- DSPAM_MySQL_MAJOR=$(echo "${DSPAM_MySQL_VER}" | cut -d. -f1)
- DSPAM_MySQL_MINOR=$(echo "${DSPAM_MySQL_VER}" | cut -d. -f2)
- DSPAM_MySQL_MICRO=$(echo "${DSPAM_MySQL_VER}" | cut -d. -f3)
- DSPAM_MySQL_INT=$(($DSPAM_MySQL_MAJOR * 65536 + $DSPAM_MySQL_MINOR * 256 + $DSPAM_MySQL_MICRO))
-
- # For MySQL >= 4.1 use the new purge script
- if [ "${DSPAM_MySQL_INT}" -ge "262400" ]
- then
- if [ -f "${DSPAM_CONFIGDIR}/config/mysql_purge-4.1-optimized.sql" -o -f "${DSPAM_CONFIGDIR}/mysql_purge-4.1-optimized.sql" ]
- then
- # See: http://securitydot.net/txt/id/32/type/articles/
- [ -f "${DSPAM_CONFIGDIR}/config/mysql_purge-4.1-optimized.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/config/mysql_purge-4.1-optimized.sql"
- [ -f "${DSPAM_CONFIGDIR}/mysql_purge-4.1-optimized.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/mysql_purge-4.1-optimized.sql"
- else
- [ -f "${DSPAM_CONFIGDIR}/config/mysql_purge-4.1.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/config/mysql_purge-4.1.sql"
- [ -f "${DSPAM_CONFIGDIR}/mysql_purge-4.1.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/mysql_purge-4.1.sql"
- fi
- else
- [ -f "${DSPAM_CONFIGDIR}/config/mysql_purge.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/config/mysql_purge.sql"
- [ -f "${DSPAM_CONFIGDIR}/mysql_purge.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/mysql_purge.sql"
- fi
-
- if [ -z "${DSPAM_MySQL_PURGE_SQL}" ]
- then
- echo "Can not run MySQL purge script:"
- echo " No mysql_purge SQL script found"
- return 1
- fi
-
- if [ ! -e "/usr/bin/mysql" ]
- then
- echo "Can not run MySQL purge script:"
- echo " /usr/bin/mysql does not exist"
- return 1
- fi
-
- # Construct mysql command line
- DSPAM_MySQL_CMD="/usr/bin/mysql --silent --user=${MySQLUser}"
- [ -S "${MySQLServer}" ] &&
- DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --socket=${MySQLServer}" ||
- DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --host=${MySQLServer}"
- [ -n "${MySQLPort}" ] &&
- DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --port=${MySQLPort}"
- [ "${MySQLCompress}" == "true" ] &&
- DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --compress"
-
- # Run the MySQL purge script
- MYSQL_PWD="${MySQLPass}" ${DSPAM_MySQL_CMD} ${MySQLDb} < ${DSPAM_MySQL_PURGE_SQL} >/dev/null
- _RC=$?
- if [ ${_RC} != 0 ]
- then
- echo "MySQL purge script returned error code ${_RC}"
- fi
-
- return 0
- fi
-}
-
-
-#
-# Function to clean DSPAM PostgreSQL data
-#
-clean_pgsql_drv() {
- #
- # PostgreSQL
- #
- if ${USE_SQL_PURGE} && \
- read_dspam_params PgSQLServer PgSQLPort PgSQLUser PgSQLPass PgSQLDb && \
- [ -n "${PgSQLServer}" -a -n "${PgSQLUser}" -a -n "${PgSQLDb}" ]
- then
- DSPAM_PgSQL_PURGE_SQL=""
- [ -f "${DSPAM_CONFIGDIR}/config/pgsql_purge.sql" ] && DSPAM_PgSQL_PURGE_SQL="${DSPAM_CONFIGDIR}/config/pgsql_purge.sql"
- [ -f "${DSPAM_CONFIGDIR}/pgsql_purge.sql" ] && DSPAM_PgSQL_PURGE_SQL="${DSPAM_CONFIGDIR}/pgsql_purge.sql"
-
- if [ -z "${DSPAM_PgSQL_PURGE_SQL}" ]
- then
- echo "Can not run PostgreSQL purge script:"
- echo " No pgsql_purge SQL script found"
- return 1
- fi
-
- if [ -e "/usr/bin/psql" ]
- then
- # Construct psql command line
- DSPAM_PgSQL_CMD="/usr/bin/psql -q -U ${PgSQLUser} -h ${PgSQLServer} -d ${PgSQLDb}"
- [ -n "${PgSQLPort}" ] &&
- DSPAM_PgSQL_CMD="${DSPAM_PgSQL_CMD} -p ${PgSQLPort}"
-
- # Run the PostgreSQL purge script
- PGUSER="${PgSQLUser}" PGPASSWORD="${PgSQLPass}" ${DSPAM_PgSQL_CMD} -f "${DSPAM_PgSQL_PURGE_SQL}" >/dev/null
- else
- # Run the pgsql_purge.py script
- PGUSER="${PgSQLUser}" PGPASSWORD="${PgSQLPass}" "${DSPAM_CONFIGDIR}/pgsql_purge.py" "${PgSQLServer}" "${PgSQLPort}" "${PgSQLDb}" "${DSPAM_PgSQL_PURGE_SQL}"
- fi
-
- _RC=$?
- if [ ${_RC} != 0 ]
- then
- echo "PostgreSQL purge script returned error code ${_RC}"
- fi
-
- return 0
- fi
-}
-
-
-#
-# Function to clean DSPAM Hash data
-#
-clean_hash_drv() {
- #
- # Hash
- #
- if [ -d "${DSPAM_HOMEDIR}/data" ]
- then
- find ${DSPAM_HOMEDIR}/data/ -maxdepth 4 -mindepth 1 -type f -name "*.css" | while read name
- do
- /usr/bin/cssclean "${name}" 1>/dev/null 2>&1
- done
- find ${DSPAM_HOMEDIR}/data/ -maxdepth 4 -mindepth 1 -type d -name "*.sig" | while read name
- do
- find "${name}" -maxdepth 1 -mindepth 1 -type f -mtime +${SIGNATURE_AGE} -name "*.sig" -exec /bin/rm "{}" ";"
- done
- return 0
- else
- return 1
- fi
-}
-
-
-#
-# Function to clean DSPAM SQLite3 data
-#
-clean_sqlite3_drv() {
- #
- # SQLite3
- #
- if ${USE_SQL_PURGE}
- then
- DSPAM_SQLite3_PURGE_SQL=""
- [ -f "${DSPAM_CONFIGDIR}/config/sqlite3_purge.sql" ] && DSPAM_SQLite3_PURGE_SQL="${DSPAM_CONFIGDIR}/config/sqlite3_purge.sql"
- [ -f "${DSPAM_CONFIGDIR}/sqlite3_purge.sql" ] && DSPAM_SQLite3_PURGE_SQL="${DSPAM_CONFIGDIR}/sqlite3_purge.sql"
-
- if [ -z "${DSPAM_SQLite3_PURGE_SQL}" ]
- then
- echo "Can not run SQLite3 purge script:"
- echo " No sqlite_purge SQL script found"
- return 1
- fi
-
- if [ ! -e "/usr/bin/sqlite3" ]
- then
- echo "Can not run SQLite3 purge script:"
- echo " /usr/bin/sqlite3 does not exist"
- return 1
- fi
-
- # Run the SQLite3 purge script
- find "${DSPAM_HOMEDIR}" -name "*.sdb" -print | while read name
- do
- /usr/bin/sqlite3 "$name" < "${DSPAM_SQLite3_PURGE_SQL}" >/dev/null
- done 1>/dev/null 2>&1
-
- return 0
- fi
-
-}
-
-
-#
-# Acquire lock file and start processing
-#
-DSPAM_CRON_LOCKFILE="/var/run/$(basename $0 .sh).pid"
-if ( set -o noclobber; echo "$$" > "${DSPAM_CRON_LOCKFILE}") 2> /dev/null; then
-
- trap 'rm -f "${DSPAM_CRON_LOCKFILE}"; exit $?' INT TERM EXIT
-
- #
- # Check for needed tools
- #
- if ! check_for_tools
- then
- # We have not all needed tools installed. Run just the dspam_clean part.
- run_dspam_clean
- exit $?
- fi
-
- #
- # Try to get DSPAM config directory
- #
- DSPAM_CONFIGDIR=$(getent passwd dspam | awk -F : '{print $6}')
- if [ ! -f "${DSPAM_CONFIGDIR}/dspam.conf" ]
- then
- # Something is wrong in passwd! Check if /etc/mail/dspam exists instead.
- if [ -f /etc/mail/dspam/dspam.conf ]
- then
- DSPAM_CONFIGDIR="/etc/mail/dspam"
- fi
- fi
- if [ ! -d "${DSPAM_CONFIGDIR}" ]
- then
- echo "Configuration directory not found!"
- exit 2
- fi
-
- #
- # Try to get DSPAM data home directory
- #
- if read_dspam_params Home && [ -d "${Home}" ]
- then
- DSPAM_HOMEDIR=${Home}
- else
- # Something is wrong in dspam.conf! Check if /var/spool/dspam exists instead.
- if [ -d /var/spool/dspam ]
- then
- DSPAM_HOMEDIR="/var/spool/dspam"
- fi
- fi
- if [ ! -d "${DSPAM_HOMEDIR}" ]
- then
- echo "Home directory not found! Please fix your dspam.conf."
- exit 2
- fi
-
- #
- # User log purging
- #
- if [ -d "${DSPAM_CONFIGDIR}/data" ]
- then
- dspam_logrotate -a ${LOGROTATE_AGE} -d "${DSPAM_CONFIGDIR}/data" >/dev/null # 2>&1
- fi
-
- if [ ! -e "/usr/bin/dspam" ]
- then
- echo "Can not run DSPAM application:"
- echo " /usr/bin/dspam does not exist"
- return 1
- fi
-
- #
- # Process all available storage drivers
- #
- for foo in $(/usr/bin/dspam --version 2>&1 | sed -n "s:,: :g;s:^.*\-\-with\-storage\-driver=\([^\'\]*\).*:\1:gIp")
- do
- case "${foo}" in
- hash_drv)
- clean_hash_drv
- ;;
- mysql_drv)
- clean_mysql_drv
- ;;
- pgsql_drv)
- clean_pgsql_drv
- ;;
- sqlite3_drv)
- clean_sqlite3_drv
- ;;
- *)
- echo "Unknown storage ${foo} driver"
- ;;
- esac
- done
-
- #
- # Run the dspam_clean command
- #
- run_dspam_clean
-
-
- #
- # Release lock
- #
- /bin/rm -f "${DSPAM_CRON_LOCKFILE}"
- trap - INT TERM EXIT
-fi
diff --git a/mail-filter/dspam/files/dspam.cron-r2 b/mail-filter/dspam/files/dspam.cron-r2
deleted file mode 100644
index 2039b0316497..000000000000
--- a/mail-filter/dspam/files/dspam.cron-r2
+++ /dev/null
@@ -1,365 +0,0 @@
-#!/bin/sh
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-#
-# Remove old signatures and unimportant tokens from the DSPAM database.
-# Purge old log entries in user logs.
-#
-
-#
-# Parse optional command line parameters
-#
-for foo in $@
-do
- case "${foo}" in
- --logdays=*) LOGROTATE_AGE="${foo#--logdays=}";;
- --sigdays=*) SIGNATURE_AGE="${foo#--sigdays=}";;
- --without-sql-purge) USE_SQL_PURGE=false;;
- *)
- echo "usage: $0 [--logdays=no_of_days] [--sigdays=no_of_days] [--without-sql-purge]"
- exit 1
- ;;
- esac
-done
-
-#
-# Parameters
-#
-[ -z "${LOGROTATE_AGE}" ] && LOGROTATE_AGE=30 # Delete log entries older than $LOGROTATE_AGE days
-[ -z "${SIGNATURE_AGE}" ] && SIGNATURE_AGE=30 # Delete signatures older than $SIGNATURE_AGE days
-[ -z "${USE_SQL_PURGE}" ] && USE_SQL_PURGE=true # Run sql purge scripts
-
-#
-# Function to run dspam_clean
-#
-run_dspam_clean() {
- if [ ! -e "/usr/bin/dspam_clean" ]
- then
- echo "Can not run DSPAM clean application:"
- echo " /usr/bin/dspam_clean does not exist"
- return 1
- else
- /usr/bin/dspam_clean -s${SIGNATURE_AGE} -p${SIGNATURE_AGE} -u${SIGNATURE_AGE},${SIGNATURE_AGE},${SIGNATURE_AGE},${SIGNATURE_AGE} >/dev/null 2>&1
- return $?
- fi
-}
-
-
-#
-# Function to check if we have all needed tools
-#
-check_for_tools() {
- local myrc=0
- for foo in awk cut sed
- do
- if ! which ${foo} >/dev/null 2>&1
- then
- echo "Command ${foo} not found!"
- myrc=1
- fi
- done
- return ${myrc}
-}
-
-
-#
-# Function to read dspam.conf parameters
-#
-read_dspam_params() {
- local PARAMETER VALUE
- for PARAMETER in $@ ; do
- VALUE=$(awk "BEGIN { IGNORECASE=1; } \$1==\"${PARAMETER}\" { print \$2; exit; }" "${DSPAM_CONFIGDIR}/dspam.conf")
- [[ $? == 0 ]] || return 1
- eval ${PARAMETER}=\"${VALUE}\"
- done
- return 0
-}
-
-
-#
-# Function to clean DSPAM MySQL data
-#
-clean_mysql_drv() {
- #
- # MySQL
- #
- if ${USE_SQL_PURGE} && \
- read_dspam_params MySQLServer MySQLPort MySQLUser MySQLPass MySQLDb MySQLCompress && \
- [ -n "${MySQLServer}" -a -n "${MySQLUser}" -a -n "${MySQLDb}" ]
- then
- if [ ! -e "/usr/bin/mysql_config" ]
- then
- echo "Can not run MySQL purge script:"
- echo " /usr/bin/mysql_config does not exist"
- return 1
- fi
- DSPAM_MySQL_PURGE_SQL=
- DSPAM_MySQL_VER=$(/usr/bin/mysql_config --version | sed "s:[^0-9.]*::g")
- DSPAM_MySQL_MAJOR=$(echo "${DSPAM_MySQL_VER}" | cut -d. -f1)
- DSPAM_MySQL_MINOR=$(echo "${DSPAM_MySQL_VER}" | cut -d. -f2)
- DSPAM_MySQL_MICRO=$(echo "${DSPAM_MySQL_VER}" | cut -d. -f3)
- DSPAM_MySQL_INT=$(($DSPAM_MySQL_MAJOR * 65536 + $DSPAM_MySQL_MINOR * 256 + $DSPAM_MySQL_MICRO))
-
- # For MySQL >= 4.1 use the new purge script
- if [ "${DSPAM_MySQL_INT}" -ge "262400" ]
- then
- if [ -f "${DSPAM_CONFIGDIR}/config/mysql_purge-4.1-optimized.sql" -o -f "${DSPAM_CONFIGDIR}/mysql_purge-4.1-optimized.sql" ]
- then
- # See: http://securitydot.net/txt/id/32/type/articles/
- [ -f "${DSPAM_CONFIGDIR}/config/mysql_purge-4.1-optimized.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/config/mysql_purge-4.1-optimized.sql"
- [ -f "${DSPAM_CONFIGDIR}/mysql_purge-4.1-optimized.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/mysql_purge-4.1-optimized.sql"
- else
- [ -f "${DSPAM_CONFIGDIR}/config/mysql_purge-4.1.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/config/mysql_purge-4.1.sql"
- [ -f "${DSPAM_CONFIGDIR}/mysql_purge-4.1.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/mysql_purge-4.1.sql"
- fi
- else
- [ -f "${DSPAM_CONFIGDIR}/config/mysql_purge.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/config/mysql_purge.sql"
- [ -f "${DSPAM_CONFIGDIR}/mysql_purge.sql" ] && DSPAM_MySQL_PURGE_SQL="${DSPAM_CONFIGDIR}/mysql_purge.sql"
- fi
-
- if [ -z "${DSPAM_MySQL_PURGE_SQL}" ]
- then
- echo "Can not run MySQL purge script:"
- echo " No mysql_purge SQL script found"
- return 1
- fi
-
- if [ ! -e "/usr/bin/mysql" ]
- then
- echo "Can not run MySQL purge script:"
- echo " /usr/bin/mysql does not exist"
- return 1
- fi
-
- # Construct mysql command line
- DSPAM_MySQL_CMD="/usr/bin/mysql --silent --user=${MySQLUser}"
- [ -S "${MySQLServer}" ] &&
- DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --socket=${MySQLServer}" ||
- DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --host=${MySQLServer}"
- [ -n "${MySQLPort}" ] &&
- DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --port=${MySQLPort}"
- [ "${MySQLCompress}" == "true" ] &&
- DSPAM_MySQL_CMD="${DSPAM_MySQL_CMD} --compress"
-
- # Run the MySQL purge script
- MYSQL_PWD="${MySQLPass}" ${DSPAM_MySQL_CMD} ${MySQLDb} < ${DSPAM_MySQL_PURGE_SQL} >/dev/null
- _RC=$?
- if [ ${_RC} != 0 ]
- then
- echo "MySQL purge script returned error code ${_RC}"
- fi
-
- return 0
- fi
-}
-
-
-#
-# Function to clean DSPAM PostgreSQL data
-#
-clean_pgsql_drv() {
- #
- # PostgreSQL
- #
- if ${USE_SQL_PURGE} && \
- read_dspam_params PgSQLServer PgSQLPort PgSQLUser PgSQLPass PgSQLDb && \
- [ -n "${PgSQLServer}" -a -n "${PgSQLUser}" -a -n "${PgSQLDb}" ]
- then
- DSPAM_PgSQL_PURGE_SQL=""
- [ -f "${DSPAM_CONFIGDIR}/config/pgsql_purge.sql" ] && DSPAM_PgSQL_PURGE_SQL="${DSPAM_CONFIGDIR}/config/pgsql_purge.sql"
- [ -f "${DSPAM_CONFIGDIR}/pgsql_purge.sql" ] && DSPAM_PgSQL_PURGE_SQL="${DSPAM_CONFIGDIR}/pgsql_purge.sql"
-
- if [ -z "${DSPAM_PgSQL_PURGE_SQL}" ]
- then
- echo "Can not run PostgreSQL purge script:"
- echo " No pgsql_purge SQL script found"
- return 1
- fi
-
- if [ -e "/usr/bin/psql" ]
- then
- # Construct psql command line
- DSPAM_PgSQL_CMD="/usr/bin/psql -q -U ${PgSQLUser} -h ${PgSQLServer} -d ${PgSQLDb}"
- [ -n "${PgSQLPort}" ] &&
- DSPAM_PgSQL_CMD="${DSPAM_PgSQL_CMD} -p ${PgSQLPort}"
-
- # Run the PostgreSQL purge script
- PGUSER="${PgSQLUser}" PGPASSWORD="${PgSQLPass}" ${DSPAM_PgSQL_CMD} -f "${DSPAM_PgSQL_PURGE_SQL}" >/dev/null
- else
- # Run the pgsql_purge.py script
- PGUSER="${PgSQLUser}" PGPASSWORD="${PgSQLPass}" "${DSPAM_CONFIGDIR}/pgsql_purge.py" "${PgSQLServer}" "${PgSQLPort}" "${PgSQLDb}" "${DSPAM_PgSQL_PURGE_SQL}"
- fi
-
- _RC=$?
- if [ ${_RC} != 0 ]
- then
- echo "PostgreSQL purge script returned error code ${_RC}"
- fi
-
- return 0
- fi
-}
-
-
-#
-# Function to clean DSPAM Hash data
-#
-clean_hash_drv() {
- #
- # Hash
- #
- if [ -d "${DSPAM_HOMEDIR}/data" ]
- then
- find ${DSPAM_HOMEDIR}/data/ -maxdepth 4 -mindepth 1 -type f -name "*.css" | while read name
- do
- /usr/bin/cssclean "${name}" 1>/dev/null 2>&1
- done
- find ${DSPAM_HOMEDIR}/data/ -maxdepth 4 -mindepth 1 -type d -name "*.sig" | while read name
- do
- find "${name}" -maxdepth 1 -mindepth 1 -type f -mtime +${SIGNATURE_AGE} -name "*.sig" -exec /bin/rm "{}" ";"
- done
- return 0
- else
- return 1
- fi
-}
-
-
-#
-# Function to clean DSPAM SQLite3 data
-#
-clean_sqlite3_drv() {
- #
- # SQLite3
- #
- if ${USE_SQL_PURGE}
- then
- DSPAM_SQLite3_PURGE_SQL=""
- [ -f "${DSPAM_CONFIGDIR}/config/sqlite3_purge.sql" ] && DSPAM_SQLite3_PURGE_SQL="${DSPAM_CONFIGDIR}/config/sqlite3_purge.sql"
- [ -f "${DSPAM_CONFIGDIR}/sqlite3_purge.sql" ] && DSPAM_SQLite3_PURGE_SQL="${DSPAM_CONFIGDIR}/sqlite3_purge.sql"
-
- if [ -z "${DSPAM_SQLite3_PURGE_SQL}" ]
- then
- echo "Can not run SQLite3 purge script:"
- echo " No sqlite_purge SQL script found"
- return 1
- fi
-
- if [ ! -e "/usr/bin/sqlite3" ]
- then
- echo "Can not run SQLite3 purge script:"
- echo " /usr/bin/sqlite3 does not exist"
- return 1
- fi
-
- # Run the SQLite3 purge script
- find "${DSPAM_HOMEDIR}" -name "*.sdb" -print | while read name
- do
- /usr/bin/sqlite3 "$name" < "${DSPAM_SQLite3_PURGE_SQL}" >/dev/null
- done 1>/dev/null 2>&1
-
- return 0
- fi
-
-}
-
-
-#
-# Acquire lock file and start processing
-#
-DSPAM_CRON_LOCKFILE="/var/run/$(basename $0 .sh).pid"
-if ( set -o noclobber; echo "$$" > "${DSPAM_CRON_LOCKFILE}") 2> /dev/null; then
-
- trap 'rm -f "${DSPAM_CRON_LOCKFILE}"; exit $?' INT TERM EXIT
-
- #
- # Check for needed tools
- #
- if ! check_for_tools
- then
- # We have not all needed tools installed. Run just the dspam_clean part.
- run_dspam_clean
- exit $?
- fi
-
- #
- # Try to get DSPAM config directory
- #
- if [ -f /etc/mail/dspam/dspam.conf ]
- then
- DSPAM_CONFIGDIR="/etc/mail/dspam"
- else
- echo "Configuration directory not found!"
- exit 2
- fi
-
- #
- # Try to get DSPAM data home directory
- #
- if read_dspam_params Home && [ -d "${Home}" ]
- then
- DSPAM_HOMEDIR=${Home}
- else
- # Something is wrong in dspam.conf! Check if /var/spool/dspam exists instead.
- if [ -d /var/spool/dspam ]
- then
- DSPAM_HOMEDIR="/var/spool/dspam"
- fi
- fi
- if [ ! -d "${DSPAM_HOMEDIR}" ]
- then
- echo "Home directory not found! Please fix your dspam.conf."
- exit 2
- fi
-
- #
- # User log purging
- #
- if [ -d "${DSPAM_HOMEDIR}/data" ]
- then
- dspam_logrotate -a ${LOGROTATE_AGE} -d "${DSPAM_HOMEDIR}/data" >/dev/null # 2>&1
- fi
-
- if [ ! -e "/usr/bin/dspam" ]
- then
- echo "Can not run DSPAM application:"
- echo " /usr/bin/dspam does not exist"
- return 1
- fi
-
- #
- # Process all available storage drivers
- #
- for foo in $(/usr/bin/dspam --version 2>&1 | sed -n "s:,: :g;s:^.*\-\-with\-storage\-driver=\([^\'\]*\).*:\1:gIp")
- do
- case "${foo}" in
- hash_drv)
- clean_hash_drv
- ;;
- mysql_drv)
- clean_mysql_drv
- ;;
- pgsql_drv)
- clean_pgsql_drv
- ;;
- sqlite3_drv)
- clean_sqlite3_drv
- ;;
- *)
- echo "Unknown storage ${foo} driver"
- ;;
- esac
- done
-
- #
- # Run the dspam_clean command
- #
- run_dspam_clean
-
-
- #
- # Release lock
- #
- /bin/rm -f "${DSPAM_CRON_LOCKFILE}"
- trap - INT TERM EXIT
-fi