diff options
Diffstat (limited to 'mail-filter')
18 files changed, 19 insertions, 3328 deletions
diff --git a/mail-filter/dspam/ChangeLog b/mail-filter/dspam/ChangeLog index 13faad3fa4a4..dce2b2f7a856 100644 --- a/mail-filter/dspam/ChangeLog +++ b/mail-filter/dspam/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for mail-filter/dspam # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v 1.56 2005/06/17 14:03:36 st_lim Exp $ +# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v 1.57 2005/08/08 07:23:22 st_lim Exp $ + +*dspam-3.4.9 (08 Aug 2005) + + 08 Aug 2005; Lim Swee Tat <st_lim@gentoo.org> -dspam-3.4.0.ebuild, + -dspam-3.4.0-r1.ebuild, -dspam-3.4.1.ebuild, -dspam-3.4.2.ebuild, + -dspam-3.4.5.ebuild, -dspam-3.4.6.ebuild, +dspam-3.4.9.ebuild: + Version bump. 17 Jun 2005; Lim Swee Tat <st_lim@gentoo.org> ChangeLog: Version bump long overdue. diff --git a/mail-filter/dspam/Manifest b/mail-filter/dspam/Manifest index 27e4bb77ad3c..7ce89f1a5a0a 100644 --- a/mail-filter/dspam/Manifest +++ b/mail-filter/dspam/Manifest @@ -1,39 +1,15 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -MD5 db7f255ebe6d6cdc73e1f9c65029975a ChangeLog 10784 +MD5 334508a4d270ecdb2b94a074c6cd635e ChangeLog 11031 +MD5 174815badb87b1327398c6d0e5f236ee dspam-3.4.9.ebuild 19648 MD5 ba82ba9c82d1fc2a39e107b672c55c69 dspam-3.2.7.ebuild 15561 -MD5 05eff187807fdda7f5a7a9d344333769 dspam-3.4.0-r1.ebuild 19671 -MD5 4ac73e8fe5f8b63df0231d7c64608956 dspam-3.4.0.ebuild 16316 -MD5 178947af8521eddd0c2fd579c314596a dspam-3.4.1.ebuild 19605 -MD5 5f095e0566b05d8657450764fb54d173 dspam-3.4.2.ebuild 19605 -MD5 9ae0fe2c3b386025094b70f0673c8322 dspam-3.4.5.ebuild 19649 -MD5 67be45892fb63ffce11ffd57db64eba7 dspam-3.4.6.ebuild 19650 MD5 7dab4d4f38c0ff375151cb290d4821a7 dspam-3.4.8.ebuild 19650 -MD5 53fa7ac719a55e42f5558b3f367be77e dspam-3.4_rc2.ebuild 16374 -MD5 82cc2a81e351669279b735fbd67f910e dspam-3.4_rc3.ebuild 16376 -MD5 c12a54112c6fec3530a7b1a368d04ac8 files/README.postfix 309 +MD5 dbfbe5a3bbe3347938107f5f5bd2197e metadata.xml 308 MD5 e0469b961385fda4305602dc2519d319 files/README.qmail 2317 -MD5 cd1bdb75fd86304f9453741a910cb8a2 files/crontab.db4 196 +MD5 34841f2d2c9d6e057b9839bbe354e34a files/dspam.cron 3478 +MD5 bf443ca4bd218fa9d4b8975bf450c347 files/digest-dspam-3.4.9 129 MD5 f2f86e8f7ab440c8537f40fa18a0ee43 files/crontab.mysql 118 +MD5 2163ca41de383f09f4d754e2d35cb158 files/logrotate.dspam 156 +MD5 e2850ede85e459ab5479b7d2e79eeb5a files/dspam.rc 1025 MD5 7735956f416bd58bfcbeee99af43bea0 files/digest-dspam-3.2.7 63 -MD5 086d49ad3a5e289bd80de810b1f52b7f files/digest-dspam-3.4.0 129 -MD5 086d49ad3a5e289bd80de810b1f52b7f files/digest-dspam-3.4.0-r1 129 -MD5 52a1a027d9b3a0428a7c44b352b5b16b files/digest-dspam-3.4.1 129 -MD5 d7f45a9b93690f95d2339d736bcb6929 files/digest-dspam-3.4.2 129 -MD5 a2e94925800e8e5edb48c06f95db578c files/digest-dspam-3.4.5 129 -MD5 212862934a393b1b6e73f4f7f596bb3a files/digest-dspam-3.4.6 129 +MD5 cd1bdb75fd86304f9453741a910cb8a2 files/crontab.db4 196 +MD5 c12a54112c6fec3530a7b1a368d04ac8 files/README.postfix 309 MD5 fc1ec0be04a47c78e40e3f277e626ba9 files/digest-dspam-3.4.8 129 -MD5 38b4d6fe59c97cd8157debd9384db8ac files/digest-dspam-3.4_rc2 131 -MD5 b09e3fad7343b70d40f8ff7ddeca0e81 files/digest-dspam-3.4_rc3 131 -MD5 34841f2d2c9d6e057b9839bbe354e34a files/dspam.cron 3478 -MD5 e2850ede85e459ab5479b7d2e79eeb5a files/dspam.rc 1025 -MD5 2163ca41de383f09f4d754e2d35cb158 files/logrotate.dspam 156 -MD5 dbfbe5a3bbe3347938107f5f5bd2197e metadata.xml 308 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.1 (GNU/Linux) - -iD8DBQFCz0GiI1lqEGTUzyQRAhjpAKCn5CNm2nFQ+CR1Ku0IKejM4732igCg3JQ2 -9u8gjsOUyaQbLfgL2rsT51c= -=Q2dO ------END PGP SIGNATURE----- diff --git a/mail-filter/dspam/dspam-3.4.0-r1.ebuild b/mail-filter/dspam/dspam-3.4.0-r1.ebuild deleted file mode 100644 index a3c1965a8c13..000000000000 --- a/mail-filter/dspam/dspam-3.4.0-r1.ebuild +++ /dev/null @@ -1,504 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.4.0-r1.ebuild,v 1.4 2005/07/09 03:16:34 swegener Exp $ - -inherit eutils - -DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter" -SRC_URI="http://dspam.nuclearelephant.com/sources/${P}.tar.gz - http://dspam.nuclearelephant.com/sources/extras/dspam_sa_trainer.tar.gz" -HOMEPAGE="http://dspam.nuclearelephant.com/" -LICENSE="GPL-2" - -IUSE="cyrus debug exim mysql maildrop neural oci8 postgres procmail sqlite sqlite3 large-domain virtual-users" -DEPEND="exim? ( >=mail-mta/exim-4.34 ) - mysql? ( >=dev-db/mysql-3.23 ) || ( >=sys-libs/db-4.0 ) - maildrop? ( >=mail-filter/maildrop-1.5.3 ) - sqlite? ( <dev-db/sqlite-3 ) - sqlite3? ( >=dev-db/sqlite-3 ) - postgres? ( >=dev-db/postgresql-7.4.3 ) - procmail? ( >=mail-filter/procmail-3.22 ) - x86? ( cyrus? ( >=net-mail/cyrus-imapd-2.1.15 ) ) - >=sys-libs/db-4.0 - " -RDEPEND="sys-process/cronbase - app-admin/logrotate" -KEYWORDS="~x86 ~ppc ~alpha" -SLOT="0" - -# some FHS-like structure -HOMEDIR="/etc/mail/dspam" -DATADIR="/var/spool/dspam" -LOGDIR="/var/log/dspam" - -pkg_setup() { - local multiple_dbs="0" - local supported_dbs="mysql postgres oci8 sqlite sqlite3" - for foo in ${supported_dbs}; do - if use ${foo}; then - let multiple_dbs="((multiple_dbs + 1 ))" - einfo " ${foo} database support in your USE flags." - fi - done - if [ "${multiple_dbs}" -ge "2" ]; then - echo - ewarn "You have multiple database backends active in your USE flags." - ewarn "Will default to MySQL as your dspam database backend." - ewarn "If you want to build with another database backend; hit Control-C now." - ewarn "Change your USE flag -mysql and emerge again." - echo - has_version ">=sys-apps/portage-2.0.50" && ( - einfo "It would be best practice to add the set of USE flags that you use for this" - einfo "package to the file: /etc/portage/package.use. Example:" - einfo "\`echo \"mail-filter/dspam -mysql postgres -oci8 -sqlite\" >> /etc/portage/package.use\`" - einfo "to build dspam with Postgres database as your dspam backend." - ) - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - elif [ "${multiple_dbs}" -eq "0" ]; then - echo - ewarn "You need to select at least one database backend in your USE flags." - ewarn "Please enable one of the following USE flags:" - ewarn " ${supported_dbs}" - echo - die "Database support missing" - fi - has_version ">sys-kernel/linux-headers-2.6" || ( - einfo "To use the new DSPAM deamon mode, you need to emerge" - einfo ">sys-kernel/linux-headers-2.6 and rebuild glibc to support NPTL" - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - ) - id dspam 2>/dev/null || enewgroup dspam 26 - id dspam 2>/dev/null || enewuser dspam 26 /bin/bash ${HOMEDIR} dspam -} - -src_compile() { - local myconf - - myconf="${myconf} --enable-long-username" - use large-domain && myconf="${myconf} --enable-large-scale" ||\ - myconf="${myconf} --enable-domain-scale" - - myconf="${myconf} --with-dspam-mode=4755" - myconf="${myconf} --with-dspam-owner=dspam" - myconf="${myconf} --with-dspam-group=dspam" - myconf="${myconf} --sysconfdir=${HOMEDIR}" - myconf="${myconf} --with-logdir=${LOGDIR}" - use virtual-users || myconf="${myconf} --with-dspam-home=${HOMEDIR}" - - # enables support for debugging (touch /etc/dspam/.debug to turn on) - # optional: even MORE debugging output, use with extreme caution! - use debug && myconf="${myconf} --enable-debug --enable-verbose-debug" - - # select storage driver - if use mysql; then - myconf="${myconf} --with-storage-driver=mysql_drv" - myconf="${myconf} --with-mysql-includes=/usr/include/mysql" - myconf="${myconf} --with-mysql-libraries=/usr/lib/mysql" - myconf="${myconf} --enable-preferences-extension" - - if has_version ">sys-kernel/linux-headers-2.6"; then - myconf="${myconf} --enable-daemon" - fi - - use virtual-users && myconf="${myconf} --enable-virtual-users" - # an experimental feature available with MySQL and PgSQL backend - use neural && myconf="${myconf} --enable-neural-networking" - elif use postgres ; then - myconf="${myconf} --with-storage-driver=pgsql_drv" - myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql" - myconf="${myconf} --with-pgsql-libraries=/usr/lib/postgresql" - myconf="${myconf} --enable-preferences-extension" - - if has_version ">sys-kernel/linux-headers-2.6"; then - myconf="${myconf} --enable-daemon" - fi - - use virtual-users && myconf="${myconf} --enable-virtual-users" - # an experimental feature available with MySQL and PgSQL backend - use neural && myconf="${myconf} --enable-neural-networking" - elif use oci8 ; then - myconf="${myconf} --with-storage-driver=ora_drv" - myconf="${myconf} --with-oracle-home=${ORACLE_HOME}" - myconf="${myconf} --enable-virtual-users" - - # I am in no way a Oracle specialist. If someone knows - # how to query the version of Oracle, then let me know. - if (expr ${ORACLE_HOME/*\/} : 10 1>/dev/null 2>&1); then - myconf="${myconf} --with-oracle-version=10" - fi - elif use sqlite3 ; then - myconf="${myconf} --with-storage-driver=sqlite3_drv" - myconf="${myconf} --enable-virtual-users" - elif use sqlite ; then - myconf="${myconf} --with-storage-driver=sqlite_drv" - myconf="${myconf} --enable-virtual-users" - else - myconf="${myconf} --with-storage-driver=libdb4_drv" - fi - - econf ${myconf} || die - emake || die - -} - -src_install () { - - # Fix issues with older dspam configuration - CONFIG_PROTECT="${CONFIG_PROTECT} ${DATADIR} /var/run/dspam" - CONFIG_PROTECT_MASK="${CONFIG_PROTECTMASK/${HOMEDIR}/}" - CONFIG_PROTECT_MASK="${CONFIG_PROTECTMASK/${DATADIR}/}" - - # open up perms on /etc/mail/dspam - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR} - keepdir ${HOMEDIR} - - # keeps dspam data in /var - diropts -m0775 -o dspam -g dspam - dodir ${DATADIR} - keepdir ${DATADIR} - - # keeps dspam log in /var/log - diropts -m0775 -o dspam -g dspam - dodir ${LOGDIR} - keepdir ${LOGDIR} - touch ${T}/empty.file - newins ${T}/empty.file system.log - dosym ${LOGDIR}/system.log ${HOMEDIR}/system.log - - # ${HOMEDIR}/data is a symlink to ${DATADIR} - dosym ${DATADIR} ${HOMEDIR}/data - - # make install - sed -e 's/rm -f ..mandir.\(.*\)/rm -f ${D}${mandir}\1/g' \ - -e 's/ln -s ..mandir.\(.*\) ..mandir.\(.*3\)/ln -s ${mandir}\1.gz ${D}${mandir}\2.gz/g' \ - -i Makefile - make DESTDIR=${D} install || die - chmod 4755 ${D}/usr/bin/dspam - chmod 4755 ${D}/usr/bin/dspam_stats - - # documentation - dodoc CHANGELOG LICENSE README* RELEASE.NOTES UPGRADING - dodoc ${FILESDIR}/README.postfix ${FILESDIR}/README.qmail - if use mysql; then - dodoc src/tools.mysql_drv/README - elif use postgres ; then - dodoc src/tools.pgsql_drv/README - elif use oci8 ; then - dodoc src/tools.ora_drv/README - elif use sqlite || sqlite3 ; then - dodoc src/tools.sqlite_drv/README - fi - doman man/dspam* - dodoc ${DISTDIR}/dspam_sa_trainer.tar.gz - - # build some initial configuration data - [ -f ${HOMEDIR}/dspam.conf ] \ - && cp ${HOMEDIR}/dspam.conf ${T}/dspam.conf \ - || cp src/dspam.conf ${T}/dspam.conf - - if use cyrus; then - sed -i 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/lib/cyrus/deliver %u\":gI' ${T}/dspam.conf - sed -i 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/lib/cyrus/deliver\":gI' ${T}/dspam.conf - elif use exim; then - sed -i 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/exim -oMr spam-scanned %u\":gI' ${T}/dspam.conf - sed -i 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/exim -oMr spam-scanned %u\":gI' ${T}/dspam.conf - elif use maildrop; then - sed -i 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/maildrop -d %u\":gI' ${T}/dspam.conf - sed -i 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/maildrop\":gI' ${T}/dspam.conf - elif use procmail; then - sed -i 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/procmail -d %u\":gI' ${T}/dspam.conf - sed -i 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/procmail":gI' ${T}/dspam.conf - else - sed -i 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/sendmail\":gI' ${T}/dspam.conf - sed -i 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/sendmail\":gI' ${T}/dspam.conf - fi - if use mysql || use postgres; then - if has_version ">sys-kernel/linux-headers-2.6"; then - # keeps dspam socket for deamon in /var/run/dspam - diropts -m0775 -o dspam -g dspam - dodir /var/run/dspam - keepdir /var/run/dspam - - # We use sockets for the deamon instead of tcp port 24 - sed -i 's:^#*\(ServerDomainSocketPath[\t ]\{1,\}\).*:\1\"/var/run/dspam/dspam.sock\":gI' ${T}/dspam.conf - sed -i 's:^#*\(ServerPID[\t ]\{1,\}\).*:\1/var/run/dspam/dspam.pid:gI' ${T}/dspam.conf - - # dspam init script - exeinto /etc/init.d - exeopts -m0755 -o root -g root - newexe ${FILESDIR}/dspam.rc dspam - fi - fi - - # generate random password - local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" - - # database related configuration and scripts - if use mysql; then - # Use existing configuration if possible - if [[ -f ${ROOT}${HOMEDIR}/mysql.data ]]; then - DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${HOMEDIR}/mysql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - 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]="true" - fi - - # Modify configuration and create mysql.data file - 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" \ - ${T}/dspam.conf - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${T}/mysql.data - done - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/mysql.data - 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/virtual-users.sql mysql_virtual-users.sql - newins src/tools.mysql_drv/neural.sql mysql_neural.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 - - elif use postgres ; then - # Use existing configuration if possible - if [ -f ${ROOT}${HOMEDIR}/pgsql.data ]; then - DSPAM_DB_DATA=( $(cat "${ROOT}${HOMEDIR}/pgsql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - 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" - fi - - # Modify configuration and create pgsql.data file - 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 ${T}/dspam.conf - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${T}/pgsql.data - done - - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/pgsql.data - newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql - newins src/tools.pgsql_drv/virtual-users.sql pgsql_virtual-users.sql - newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql - - elif use oci8 ; then - # Use existing configuration if possible - if [ -f ${ROOT}${HOMEDIR}/oracle.data ]; then - DSPAM_DB_DATA=( $(cat "${ROOT}${HOMEDIR}/oracle.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - DSPAM_DB_DATA[0]="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=PROD)))" - DSPAM_DB_DATA[1]="dspam" - DSPAM_DB_DATA[2]="${PASSWORD}" - DSPAM_DB_DATA[3]="dspam" - fi - - # Modify configuration and create oracle.data file - sed -e "s:^#*\(OraServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \ - -e "s:^\(OraUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \ - -e "s:^\(OraPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \ - -e "s:^\(OraSchema[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI"\ - -i ${T}/dspam.conf - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${T}/oracle.data - done - - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/oracle.data - newins src/tools.ora_drv/oral_objects.sql ora_objects.sql - newins src/tools.ora_drv/virtual-users.sql ora_virtual-users.sql - newins src/tools.ora_drv/purge.sql ora_purge.sql - elif use sqlite || sqlite3 ; then - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - newins src/tools.sqlite_drv/purge.sql sqlite_purge.sql - fi - - sed -i "s:^\(Purge.*\):###\1:g" ${T}/dspam.conf - sed -i "s:^#\(Purge.*\):\1:g" ${T}/dspam.conf - sed -i "s:^###\(Purge.*\):#\1:g" ${T}/dspam.conf - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/dspam.conf - - # installs the notification messages - # -> The documentation is wrong! The files need to be in ./txt - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR}/txt - keepdir ${HOMEDIR}/txt - insinto ${HOMEDIR}/txt - insopts -m644 -o dspam -g dspam - doins ${S}/txt/*.txt - - # Create the opt-in / opt-out directories - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR}/opt-in - keepdir ${HOMEDIR}/opt-in - dodir ${HOMEDIR}/opt-out - keepdir ${HOMEDIR}/opt-out - - # logrotation scripts - diropts -m0755 -o dspam -g dspam - dodir /etc/logrotate.d - keepdir /etc/logrotate.d - insinto /etc/logrotate.d - insopts -m0755 -o dspam -g dspam - newins ${FILESDIR}/logrotate.dspam dspam - - # dspam cron job - diropts -m0755 -o dspam -g dspam - dodir /etc/cron.daily - keepdir /etc/cron.daily - exeinto /etc/cron.daily - exeopts -m0755 -o dspam -g dspam - doexe ${FILESDIR}/dspam.cron - - # dspam enviroment - echo -ne "CONFIG_PROTECT=\"${DATADIR} /var/run/dspam\"\n\n" > ${T}/40dspam - doenvd ${T}/40dspam || die -} - -pkg_postinst() { - env-update - if use mysql || use postgres || use oci8; then - echo - einfo "To setup DSPAM to run out-of-the-box on your system with a MySQL," - einfo "PostgreSQL or Oracle database, run:" - einfo "ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config" - fi - if use mysql || use postgres; then - if has_version ">sys-kernel/linux-headers-2.6"; then - einfo "If you want to run DSPAM in the new deamon mode. Remember" - einfo "to make the DSPAM daemon start durig boot:" - einfo " rc-update add dspam default" - fi - fi - if use exim ; then - echo - einfo "To use dspam in conjunction with your exim system, you should read the README" - fi -} - -pkg_config () { - if use mysql ; then - [[ -f ${HOMEDIR}/mysql.data ]] && mv -f ${HOMEDIR}/mysql.data ${HOMEDIR} - - DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${HOMEDIR}/mysql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - DSPAM_MySQL_USER="$DSPAM_DB_DATA[2]" - DSPAM_MySQL_PWD="$DSPAM_DB_DATA[3]" - DSPAM_MySQL_DB="$DSPAM_DB_DATA[4]" - - ewarn "When prompted for a password, please enter your MySQL root password" - ewarn "" - - einfo "Creating DSPAM MySQL database \"${DSPAM_MySQL_DB}\"" - /usr/bin/mysqladmin -u root -p create ${DSPAM_MySQL_DB} - - einfo "Creating DSPAM MySQL tables for data objects" - einfo " Please select what kind of object database you like to use." - einfo " [1] Space optimized database" - einfo " [2] Speed optimized database" - einfo - while true - do - read -n 1 -s -p " Press 1 or 2 on the keyboard to select database" DSPAM_MySQL_DB_Type - [[ "${DSPAM_MySQL_DB_Type}" == "1" || "${DSPAM_MySQL_DB_Type}" == "2" ]] && echo && break - done - - if [ "${DSPAM_MySQL_DB_Type}" == "1" ] - then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-space.sql - else - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-speed.sql - fi - - einfo "Creating DSPAM MySQL database for virtual-users users" - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_virtual-users_users.sql - - if use neural ; then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_neural.sql - fi - - einfo "Creating DSPAM MySQL user \"${DSPAM_MySQL_USER}\"" - /usr/bin/mysql -u root -p -e "GRANT SELECT,INSERT,UPDATE,DELETE ON ${DSPAM_MySQL_DB}.* TO ${DSPAM_MySQL_USER}@localhost IDENTIFIED BY '${DSPAM_MySQL_PWD}';FLUSH PRIVILEGES;" -D mysql - elif use postgres ; then - [[ -f ${HOMEDIR}/pgsql.data ]] && mv -f ${HOMEDIR}/pgsql.data ${HOMEDIR} - - DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${HOMEDIR}/pgsql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - DSPAM_PgSQL_USER="${DSPAM_DB_DATA[2]}" - DSPAM_PgSQL_PWD="${DSPAM_DB_DATA[3]}" - DSPAM_PgSQL_DB="${DSPAM_DB_DATA[4]}" - - ewarn "When prompted for a password, please enter your PgSQL postgres password" - ewarn "" - - einfo "Creating DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\" and user \"${DSPAM_PgSQL_USER}\"" - /usr/bin/psql -h localhost -d template1 -U postgres -c "CREATE USER ${DSPAM_PgSQL_USER} WITH PASSWORD '${DSPAM_PgSQL_PWD}' NOCREATEDB NOCREATEUSER; CREATE DATABASE ${DSPAM_PgSQL_DB}; GRANT ALL PRIVILEGES ON DATABASE ${DSPAM_PgSQL_DB} TO ${DSPAM_PgSQL_USER}; GRANT ALL PRIVILEGES ON SCHEMA public TO ${DSPAM_PgSQL_USER}; UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='${DSPAM_PgSQL_USER}') WHERE datname='${DSPAM_PgSQL_DB}';" - - einfo "Creating DSPAM PostgreSQL tables" - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_objects.sql 1>/dev/null 2>&1 - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_virtual-users_users.sql 1>/dev/null 2>&1 - - elif use oci8 ; then - [[ -f ${HOMEDIR}/oracle.data ]] && mv -f ${HOMEDIR}/oracle.data ${HOMEDIR} - einfo "We have not enought Oracle knowledge to configure Oracle" - einfo "automatically. If you know how, please post a message in" - einfo "Gentoo Bugzilla." - einfo "" - einfo "You need manually to create the Oracle user for DSPAM and" - einfo "the necessary database." - einfo "But the DSPAM configuration file dspam.conf and oracle.data" - einfo "was already configured with the necessary information to" - einfo "access the database." - einfo "Pleae read your dspam.conf, oracle.data and the README for" - einfo "more info on how to setup DSPAM with Oracle." - elif use sqlite3 ; then - einfo "sqlite3_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - elif use sqlite ; then - einfo "sqlite_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - fi - -} diff --git a/mail-filter/dspam/dspam-3.4.0.ebuild b/mail-filter/dspam/dspam-3.4.0.ebuild deleted file mode 100644 index 3bff28e5b9b1..000000000000 --- a/mail-filter/dspam/dspam-3.4.0.ebuild +++ /dev/null @@ -1,406 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.4.0.ebuild,v 1.2 2005/07/09 03:16:34 swegener Exp $ - -inherit eutils - -DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter" -SRC_URI="http://dspam.nuclearelephant.com/sources/${P}.tar.gz - http://dspam.nuclearelephant.com/sources/extras/dspam_sa_trainer.tar.gz" -HOMEPAGE="http://dspam.nuclearelephant.com/" -LICENSE="GPL-2" - -IUSE="debug mysql neural oci8 postgres sqlite sqlite3 large-domain" -DEPEND="mysql? ( >=dev-db/mysql-3.23 ) - sqlite? ( <dev-db/sqlite-3 ) - sqlite3? ( >=dev-db/sqlite-3 ) - postgres? ( >=dev-db/postgresql-7.4.3 ) - >=sys-libs/db-4.0 - " -RDEPEND="sys-process/cronbase - app-admin/logrotate" -KEYWORDS="~x86 ~ppc ~alpha" -SLOT="0" - -# some FHS-like structure -HOMEDIR="/etc/mail/dspam" -DATADIR="/var/spool/dspam" -LOGDIR="/var/log/dspam" - -pkg_setup() { - if (use mysql && use postgres) || \ - (use mysql && use oci8) || \ - (use mysql && use sqlite) || \ - (use mysql && use sqlite3) || \ - (use postgres && use oci8) || \ - (use postgres && use sqlite) || \ - (use postgres && use sqlite3) || \ - (use sqlite && use oci8) || \ - (use sqlite3 && use oci8); then - echo - ewarn "You have two of either \"mysql\", \"postgres\", \"oci8\", \"sqlite\" or \"sqlite3\" in your USE flags." - ewarn "Will default to MySQL as your dspam database backend." - ewarn "If you want to build with Postgres/Oracle/SQLite support; hit Control-C now." - ewarn "Change your USE flag -mysql and emerge again." - echo - has_version ">=sys-apps/portage-2.0.50" && ( - einfo "It would be best practice to add the set of USE flags that you use for this" - einfo "package to the file: /etc/portage/package.use. Example:" - einfo "\`echo \"mail-filter/dspam -mysql postgres -oci8 -sqlite -sqlite3\" >> /etc/portage/package.use\`" - einfo "to build dspam with Postgres database as your dspam backend." - ) - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - fi - id dspam 2>/dev/null || enewgroup dspam 26 - id dspam 2>/dev/null || enewuser dspam 26 /bin/bash ${HOMEDIR} dspam -} - -src_compile() { - local myconf - - # these are the default settings - #myconf="${myconf} --enable-daemon" - myconf="${myconf} --enable-homedir" - myconf="${myconf} --enable-long-username" - # Note: The author recommends that if you enable chi square, - # you also DISABLE graham and burton bayesian tests. - #myconf="${myconf} --enable-chi-square" - #myconf="${myconf} --disable-graham-bayesian --disable-burton-bayesian" - #myconf="${myconf} --enable-robinson-pvalues" - use large-domain && myconf="${myconf} --enable-large-scale" ||\ - myconf="${myconf} --enable-domain-scale" - - myconf="${myconf} --with-dspam-mode=4755" - myconf="${myconf} --with-dspam-owner=dspam" - myconf="${myconf} --with-dspam-group=dspam" - myconf="${myconf} --with-dspam-home=${HOMEDIR} --sysconfdir=${HOMEDIR}" - myconf="${myconf} --with-logdir=${LOGDIR}" - - use debug && myconf="${myconf} --enable-debug --enable-verbose-debug" - - # select storage driver - if use mysql; then - myconf="${myconf} --with-storage-driver=mysql_drv" - myconf="${myconf} --with-mysql-includes=/usr/include/mysql" - myconf="${myconf} --with-mysql-libraries=/usr/lib/mysql" - myconf="${myconf} --enable-virtual-users" - myconf="${myconf} --enable-preferences-extension" - - # an experimental feature available with MySQL and PgSQL backend - if use neural ; then - myconf="${myconf} --enable-neural-networking" - fi - elif use postgres ; then - myconf="${myconf} --with-storage-driver=pgsql_drv" - myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql" - myconf="${myconf} --with-pgsql-libraries=/usr/lib/postgresql" - myconf="${myconf} --enable-virtual-users" - myconf="${myconf} --enable-preferences-extension" - - # an experimental feature available with MySQL and PgSQL backend - if use neural ; then - myconf="${myconf} --enable-neural-networking" - fi - elif use oci8 ; then - myconf="${myconf} --with-storage-driver=ora_drv" - myconf="${myconf} --with-oracle-home=${ORACLE_HOME}" - myconf="${myconf} --enable-virtual-users" - myconf="${myconf} --enable-preferences-extension" - - # I am in no way a Oracle specialist. If someone knows - # how to query the version of Oracle, then let me know. - if (expr ${ORACLE_HOME/*\/} : 10 1>/dev/null 2>&1) - then - --with-oracle-version=MAJOR - myconf="${myconf} --with-oracle-version=10" - fi - elif use sqlite3 ; then - myconf="${myconf} --with-storage-driver=sqlite3_drv" - myconf="${myconf} --enable-virtual-users" - elif use sqlite ; then - myconf="${myconf} --with-storage-driver=sqlite_drv" - myconf="${myconf} --enable-virtual-users" - - else - myconf="${myconf} --with-storage-driver=libdb4_drv" - fi - - econf ${myconf} || die - emake || die - -} - -src_install () { - # open up perms on /etc/mail/dspam - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR} - keepdir ${HOMEDIR} - - # keeps dspam data in /var - diropts -m0775 -o dspam -g dspam - dodir ${DATADIR} - keepdir ${DATADIR} - - # keeps dspam log in /var/log - diropts -m0775 -o dspam -g dspam - dodir ${LOGDIR} - keepdir ${LOGDIR} - # ${HOMEDIR}/data is a symlink to ${DATADIR} - dosym ${DATADIR} ${HOMEDIR}/data - - # make install - sed -e 's/rm -f ..mandir.\(.*\)/rm -f ${D}${mandir}\1/g' \ - -e 's/ln -s ..mandir.\(.*\) ..mandir.\(.*3\)/ln -s ${mandir}\1.gz ${D}${mandir}\2.gz/g' \ - -i Makefile - make DESTDIR=${D} install || die - chmod 4755 ${D}/usr/bin/dspam - chmod 4755 ${D}/usr/bin/dspam_stats - - # documentation - if use mysql; then - cp src/tools.mysql_drv/README README.mysql_drv - elif use postgres ; then - cp src/tools.pgsql_drv/README README.pgsql_drv - elif use oci8 ; then - cp src/tools.ora_drv/README README.ora_drv - elif use sqlite ; then - cp src/tools.sqlite_drv/README README.sqlite_drv - fi - dodoc CHANGELOG LICENSE README* RELEASE.NOTES UPGRADING - dodoc ${DISTDIR}/dspam_sa_trainer.tar.gz - docinto gentoo - dodoc ${FILESDIR}/README.postfix ${FILESDIR}/README.qmail - doman man/dspam* - - # build some initial configuration data - # Copy existing dspam.conf - [ -f ${HOMEDIR}/dspam.conf ] && cp ${HOMEDIR}/dspam.conf ${T}/dspam.conf - # If no existing dspam.conf - if [ ! -f ${HOMEDIR}/dspam.conf ]; then - cp ${D}${HOMEDIR}/dspam.conf ${T}/dspam.conf - if use cyrus; then - echo "UntrustedDeliveryAgent /usr/lib/cyrus/deliver %u" >> ${T}/dspam.conf - dosed 's:/usr/bin/procmail:/usr/lib/cyrus/deliver %u:g' ${T}/dspam.conf - elif use exim; then - echo "UntrustedDeliveryAgent /usr/sbin/exim -oMr spam-scanned %u" >> ${T}/dspam.conf - dosed 's:/usr/bin/procmail:/usr/sbin/exim -oMr spam-scanned %u:g' ${T}/dspam.conf - elif use maildrop; then - echo "UntrustedDeliveryAgent /usr/bin/maildrop -d %u" >> ${T}/dspam.conf - dosed 's:/usr/bin/procmail:/usr/bin/maildrop -d %u:g' ${T}/dspam.conf - elif use procmail; then - echo "UntrustedDeliveryAgent /usr/bin/procmail" >> ${T}/dspam.conf - else - echo "UntrustedDeliveryAgent /usr/sbin/sendmail" >> ${T}/dspam.conf - sed 's:/usr/bin/procmail:/usr/sbin/sendmail:g' ${T}/dspam.conf - fi - fi - - local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" - - # database related configuration and scripts - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - if use mysql; then - - if [ -f ${HOMEDIR}/mysql.data ]; then - # Use an existing password - PASSWORD="$(tail -n 2 ${HOMEDIR}/mysql.data | head -n 1 )" - else - # Create the mysql.data file - echo "MySQLServer /var/run/mysqld/mysqld.sock" >> ${T}/mysql.data - echo "MySQLPort" >> ${T}/mysql.data - echo "MySQLUser dspam" >> ${T}/mysql.data - echo "MySQLPass ${PASSWORD}" >> ${T}/mysql.data - echo "MySQLDb dspam" >> ${T}/mysql.data - echo "MySQLCompress true" >> ${T}/mysql.data - [ -z "`grep '^MySQL' ${D}/${HOMEDIR}/dspam.conf`" ] && cat ${T}/mysql.data >> ${T}/dspam.conf - sed -e 's/^MySQL[A-Za-z]* *//g' -i ${T}/mysql.data - doins ${T}/mysql.data - fi - - 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/virtual_users.sql mysql_virtual_users.sql - newins src/tools.mysql_drv/neural.sql mysql_neural.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 - elif use postgres ; then - if [ -f ${HOMEDIR}/pgsql.data ]; then - # Use an existing password - PASSWORD="$(tail -n 2 ${HOMEDIR}/pgsql.data | head -n 1 )" - else - # Create the pgsql.data file - echo "PgSQLServer 127.0.0.1" >> ${T}/pgsql.data - echo "PgSQLPort 5432" >> ${T}/pgsql.data - echo "PgSQLUser dspam" >> ${T}/pgsql.data - echo "PgSQLPass ${PASSWORD}" >> ${T}/pgsql.data - echo "PgSQLDb dspam" >> ${T}/pgsql.data - [ -z "`grep '^PgSQL' ${D}/${HOMEDIR}/dspam.conf`" ] && cat ${T}/pgsql.data >> ${T}/dspam.conf - sed -e 's/^PgSQL[A-Za-z]* *//g' -i ${T}/pgsql.data - doins ${T}/pgsql.data - fi - - newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql - newins src/tools.pgsql_drv/virtual_users.sql pgsql_virtual_users.sql - newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql - - elif use oci8 ; then - if [ -f ${HOMEDIR}/oracle.data ]; then - # Use an existing password - PASSWORD="$(tail -n 2 ${HOMEDIR}/oracle.data | head -n 1 )" - else - # Create the pgsql.data file - echo "OraServer (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=PROD)))" >>${T}/oracle.data - echo "OraUser dspam" >>${T}/oracle.data - echo "OraPass ${PASSWORD}" >>${T}/oracle.data - echo "OraSchema dspam" >>${T}/oracle.data - [ -z "`grep '^Ora' ${D}/${HOMEDIR}/dspam.conf`" ] && cat ${T}/oracle.data >> ${T}/dspam.conf - sed -e 's/^Ora[A-Za-z]* *//g' -i ${T}/oracle.data - doins ${T}/oracle.data - fi - - newins src/tools.ora_drv/oral_objects.sql ora_objects.sql - newins src/tools.ora_drv/virtual_users.sql ora_virtual_users.sql - newins src/tools.ora_drv/purge.sql ora_purge.sql - elif use sqlite ; then - newins src/tools.sqlite_drv/purge.sql sqlite_purge.sql - fi - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/dspam.conf - - # installs the logrotation scripts to the logrotate.d directory - diropts -m0755 -o dspam -g dspam - dodir /etc/logrotate.d - keepdir /etc/logrotate.d - insinto /etc/logrotate.d - newins ${FILESDIR}/logrotate.dspam dspam - - # installs the cron job to the cron directory - diropts -m0755 -o dspam -g dspam - dodir /etc/cron.daily - keepdir /etc/cron.daily - exeinto /etc/cron.daily - exeopts -m0755 -o dspam -g dspam - doexe ${FILESDIR}/dspam.cron - - # installs the notification messages - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR}/txt - keepdir ${HOMEDIR}/txt - insinto ${HOMEDIR}/txt - insopts -m644 -o dspam -g dspam - for foo in ${S}/txt/*.txt; do - if [ ! -f "$(basename ${foo})" ]; then - doins ${foo} - fi - done - - # dspam enviroment - echo -ne "CONFIG_PROTECT_MASK=\"${HOMEDIR}\"\n\n" > ${T}/40dspam - doenvd ${T}/40dspam || die -} - -pkg_postinst() { - if use mysql || use postgres; then - einfo "To setup dspam to run out-of-the-box on your system with a mysql or pgsql database, run:" - einfo "ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config" - fi - if use exim ; then - echo - einfo "To use dspam in conjunction with your exim system, you should read the README" - fi -} - -pkg_config () { - if use mysql ; then - [[ -f ${HOMEDIR}/mysql.data ]] && mv -f ${HOMEDIR}/mysql.data ${HOMEDIR} - DSPAM_MySQL_USER="$(head -n 3 ${HOMEDIR}/mysql.data|tail -n 1)" - DSPAM_MySQL_PWD="$(head -n 4 ${HOMEDIR}/mysql.data|tail -n 1)" - DSPAM_MySQL_DB="$(head -n 5 ${HOMEDIR}/mysql.data|tail -n 1)" - - ewarn "When prompted for a password, please enter your MySQL root password" - ewarn "" - - einfo "Creating DSPAM MySQL database \"${DSPAM_MySQL_DB}\"" - /usr/bin/mysqladmin -u root -p create ${DSPAM_MySQL_DB} - - einfo "Creating DSPAM MySQL tables for data objects" - einfo " Please select what kind of object database you like to use." - einfo " [1] Space optimized database" - einfo " [2] Speed optimized database" - einfo - while true - do - read -n 1 -s -p " Press 1 or 2 on the keyboard to select database" DSPAM_MySQL_DB_Type - [[ "${DSPAM_MySQL_DB_Type}" == "1" || "${DSPAM_MySQL_DB_Type}" == "2" ]] && break - done - - if [ "${DSPAM_MySQL_DB_Type}" == "1" ] - then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-space.sql - else - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-speed.sql - fi - - einfo "Creating DSPAM MySQL database for virtual users" - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_virtual_users.sql - - if use neural ; then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_neural.sql - fi - - einfo "Creating DSPAM MySQL user \"${DSPAM_MySQL_USER}\"" - /usr/bin/mysql -u root -p -e "GRANT SELECT,INSERT,UPDATE,DELETE ON ${DSPAM_MySQL_DB}.* TO ${DSPAM_MySQL_USER}@localhost IDENTIFIED BY '${DSPAM_MySQL_PWD}';FLUSH PRIVILEGES;" -D mysql - elif use postgres ; then - [[ -f ${HOMEDIR}/pgsql.data ]] && mv -f ${HOMEDIR}/pgsql.data ${HOMEDIR} - DSPAM_PgSQL_USER="$(head -n 3 ${HOMEDIR}/pgsql.data|tail -n 1)" - DSPAM_PgSQL_PWD="$(head -n 4 ${HOMEDIR}/pgsql.data|tail -n 1)" - DSPAM_PgSQL_DB="$(head -n 5 ${HOMEDIR}/pgsql.data|tail -n 1)" - - ewarn "When prompted for a password, please enter your PgSQL postgres password" - ewarn "" - - einfo "Creating DSPAM PostgreSQL user \"${DSPAM_PgSQL_USER}\"" - /usr/bin/psql -d template1 -U postgres -c "CREATE USER ${DSPAM_PgSQL_USER} WITH PASSWORD '${DSPAM_PgSQL_PWD}' NOCREATEDB NOCREATEUSER;" 1>/dev/null 2>&1 - - einfo "Creating DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\"" - /usr/bin/psql -d template1 -U postgres -c "CREATE DATABASE ${DSPAM_PgSQL_DB};" 1>/dev/null 2>&1 - - einfo "Getting DSPAM PostgreSQL userid for \"${DSPAM_PgSQL_USER}\"" - DSPAM_PgSQL_USERID=$(/usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -t -c "SELECT usesysid FROM pg_user WHERE usename='${DSPAM_PgSQL_USER}';" | head -n1 | sed "s/^[ ]*\([^ ]*\).*/\1/g") - einfo " UserID: ${DSPAM_PgSQL_USERID}" - - einfo "Getting DSPAM PostgreSQL databaseid for \"${DSPAM_PgSQL_DB}\"" - DSPAM_PgSQL_DBID=$(/usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -t -c "SELECT datdba FROM pg_database WHERE datname='${DSPAM_PgSQL_DB}';" | head -n1 | sed "s/^[ ]*\([^ ]*\).*/\1/g") - einfo " DBID: ${DSPAM_PgSQL_DBID}" - - einfo "Changing owner of DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\" to \"${DSPAM_PgSQL_USER}\"" - /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "UPDATE pg_database SET datdba=${DSPAM_PgSQL_USERID} WHERE datname='${DSPAM_PgSQL_DB}';" 1>/dev/null 2>&1 - - einfo "Creating DSPAM PostgreSQL tables" - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_objects.sql 1>/dev/null 2>&1 - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_virtual_users.sql 1>/dev/null 2>&1 - - einfo "Grant privileges to DSPAM PostgreSQL objects to \"${DSPAM_PgSQL_USER}\"" - for foo in $(/usr/bin/psql -t -d ${DSPAM_PgSQL_DB} -U postgres -c "SELECT tablename FROM pg_tables WHERE tablename LIKE 'dspam\%';") - do - /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "GRANT ALL PRIVILEGES ON TABLE ${foo} TO ${DSPAM_PgSQL_USER};" 1>/dev/null 2>&1 - done - /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE ${DSPAM_PgSQL_DB} TO ${DSPAM_PgSQL_USER};" 1>/dev/null 2>&1 - /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "GRANT ALL PRIVILEGES ON SCHEMA public TO ${DSPAM_PgSQL_USER};" 1>/dev/null 2>&1 - elif use oci8 ; then - [[ -f ${HOMEDIR}/oracle.data ]] && mv -f ${HOMEDIR}/oracle.data ${HOMEDIR} - elif use sqlite3 ; then - einfo "sqlite3_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - elif use sqlite ; then - einfo "sqlite_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - fi - -} diff --git a/mail-filter/dspam/dspam-3.4.1.ebuild b/mail-filter/dspam/dspam-3.4.1.ebuild deleted file mode 100644 index 0600aed8f4f4..000000000000 --- a/mail-filter/dspam/dspam-3.4.1.ebuild +++ /dev/null @@ -1,517 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.4.1.ebuild,v 1.6 2005/07/09 03:16:34 swegener Exp $ - -inherit eutils - -DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter" -SRC_URI="http://dspam.nuclearelephant.com/sources/${P}.tar.gz - http://dspam.nuclearelephant.com/sources/extras/dspam_sa_trainer.tar.gz" -HOMEPAGE="http://dspam.nuclearelephant.com/" -LICENSE="GPL-2" - -IUSE="cyrus debug exim mysql maildrop neural oci8 postgres procmail sqlite sqlite3 large-domain virtual-users" -DEPEND="exim? ( >=mail-mta/exim-4.34 ) - mysql? ( >=dev-db/mysql-3.23 ) || ( >=sys-libs/db-4.0 ) - maildrop? ( >=mail-filter/maildrop-1.5.3 ) - sqlite? ( <dev-db/sqlite-3 ) - sqlite3? ( >=dev-db/sqlite-3 ) - postgres? ( >=dev-db/postgresql-7.4.3 ) - procmail? ( >=mail-filter/procmail-3.22 ) - x86? ( cyrus? ( >=net-mail/cyrus-imapd-2.1.15 ) ) - >=sys-libs/db-4.0 - " -RDEPEND="sys-process/cronbase - app-admin/logrotate" -KEYWORDS="~x86 ~ppc ~alpha" -SLOT="0" - -# some FHS-like structure -HOMEDIR="/etc/mail/dspam" -DATADIR="/var/spool/dspam" -LOGDIR="/var/log/dspam" - -pkg_setup() { - local multiple_dbs="0" - local supported_dbs="mysql postgres oci8 sqlite sqlite3" - for foo in ${supported_dbs}; do - if use ${foo}; then - let multiple_dbs="((multiple_dbs + 1 ))" - einfo " ${foo} database support in your USE flags." - fi - done - if [ "${multiple_dbs}" -ge "2" ]; then - echo - ewarn "You have multiple database backends active in your USE flags." - ewarn "Will default to MySQL as your dspam database backend." - ewarn "If you want to build with another database backend; hit Control-C now." - ewarn "Change your USE flag -mysql and emerge again." - echo - has_version ">=sys-apps/portage-2.0.50" && ( - einfo "It would be best practice to add the set of USE flags that you use for this" - einfo "package to the file: /etc/portage/package.use. Example:" - einfo "\`echo \"mail-filter/dspam -mysql postgres -oci8 -sqlite\" >> /etc/portage/package.use\`" - einfo "to build dspam with Postgres database as your dspam backend." - ) - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - elif [ "${multiple_dbs}" -eq "0" ]; then - echo - ewarn "You did not select any SQL based database backend. DSPAM will use" - ewarn "Berkeley DB for storing data. If you don't want that, then enable" - ewarn "one of the following USE flags:" - ewarn "${supported_dbs}" - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - fi - has_version ">sys-kernel/linux-headers-2.6" || ( - einfo "To use the new DSPAM deamon mode, you need to emerge" - einfo ">sys-kernel/linux-headers-2.6 and rebuild glibc to support NPTL" - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - ) - id dspam 2>/dev/null || enewgroup dspam 26 - id dspam 2>/dev/null || enewuser dspam 26 /bin/bash ${HOMEDIR} dspam -} - -src_compile() { - local myconf - - myconf="${myconf} --enable-long-username" - use large-domain && myconf="${myconf} --enable-large-scale" ||\ - myconf="${myconf} --enable-domain-scale" - - myconf="${myconf} --with-dspam-home=${HOMEDIR}" - myconf="${myconf} --with-dspam-mode=4755" - myconf="${myconf} --with-dspam-owner=dspam" - myconf="${myconf} --with-dspam-group=dspam" - myconf="${myconf} --sysconfdir=${HOMEDIR}" - myconf="${myconf} --with-logdir=${LOGDIR}" - use virtual-users || myconf="${myconf} --enable-homedir" - - # enables support for debugging (touch /etc/dspam/.debug to turn on) - # optional: even MORE debugging output, use with extreme caution! - use debug && myconf="${myconf} --enable-debug --enable-verbose-debug" - - # select storage driver - if use mysql; then - myconf="${myconf} --with-storage-driver=mysql_drv" - myconf="${myconf} --with-mysql-includes=/usr/include/mysql" - myconf="${myconf} --with-mysql-libraries=/usr/lib/mysql" - myconf="${myconf} --enable-preferences-extension" - - if has_version ">sys-kernel/linux-headers-2.6"; then - myconf="${myconf} --enable-daemon" - fi - - use virtual-users && myconf="${myconf} --enable-virtual-users" - # an experimental feature available with MySQL and PgSQL backend - use neural && myconf="${myconf} --enable-neural-networking" - elif use postgres ; then - myconf="${myconf} --with-storage-driver=pgsql_drv" - myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql" - myconf="${myconf} --with-pgsql-libraries=/usr/lib/postgresql" - myconf="${myconf} --enable-preferences-extension" - - if has_version ">sys-kernel/linux-headers-2.6"; then - myconf="${myconf} --enable-daemon" - fi - - use virtual-users && myconf="${myconf} --enable-virtual-users" - # an experimental feature available with MySQL and PgSQL backend - use neural && myconf="${myconf} --enable-neural-networking" - elif use oci8 ; then - myconf="${myconf} --with-storage-driver=ora_drv" - myconf="${myconf} --with-oracle-home=${ORACLE_HOME}" - myconf="${myconf} --enable-virtual-users" - - # I am in no way a Oracle specialist. If someone knows - # how to query the version of Oracle, then let me know. - if (expr ${ORACLE_HOME/*\/} : 10 1>/dev/null 2>&1); then - myconf="${myconf} --with-oracle-version=10" - fi - elif use sqlite3 ; then - myconf="${myconf} --with-storage-driver=sqlite3_drv" - myconf="${myconf} --enable-virtual-users" - elif use sqlite ; then - myconf="${myconf} --with-storage-driver=sqlite_drv" - myconf="${myconf} --enable-virtual-users" - else - myconf="${myconf} --with-storage-driver=libdb4_drv" - fi - - econf ${myconf} || die - emake || die - -} - -src_install () { - - # Fix issues with older dspam configuration - CONFIG_PROTECT="${CONFIG_PROTECT} ${DATADIR} /var/run/dspam" - CONFIG_PROTECT_MASK="${CONFIG_PROTECTMASK/${HOMEDIR}/}" - CONFIG_PROTECT_MASK="${CONFIG_PROTECTMASK/${DATADIR}/}" - - # open up perms on /etc/mail/dspam - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR} - keepdir ${HOMEDIR} - - # keeps dspam data in /var - diropts -m0775 -o dspam -g dspam - dodir ${DATADIR} - keepdir ${DATADIR} - - # keeps dspam log in /var/log - diropts -m0775 -o dspam -g dspam - dodir ${LOGDIR} - keepdir ${LOGDIR} - insinto ${LOGDIR} - touch ${T}/empty.file - newins ${T}/empty.file system.log - dosym ${LOGDIR}/system.log ${HOMEDIR}/system.log - - # ${HOMEDIR}/data is a symlink to ${DATADIR} - dosym ${DATADIR} ${HOMEDIR}/data - - # make install - make DESTDIR=${D} install || die - chmod 4755 ${D}/usr/bin/dspam - chmod 4755 ${D}/usr/bin/dspam_stats - - # documentation - dodoc CHANGELOG LICENSE README* RELEASE.NOTES UPGRADING - dodoc ${DISTDIR}/dspam_sa_trainer.tar.gz - docinto doc - dodoc doc/*.txt - docinto gentoo - dodoc ${FILESDIR}/README.postfix ${FILESDIR}/README.qmail - if use mysql; then - dodoc src/tools.mysql_drv/README - elif use postgres ; then - dodoc src/tools.pgsql_drv/README - elif use oci8 ; then - dodoc src/tools.ora_drv/README - elif use sqlite || use sqlite3 ; then - dodoc src/tools.sqlite_drv/README - fi - doman man/dspam* - dodoc ${DISTDIR}/dspam_sa_trainer.tar.gz - - # build some initial configuration data - [ -f ${HOMEDIR}/dspam.conf ] \ - && cp ${HOMEDIR}/dspam.conf ${T}/dspam.conf \ - || cp src/dspam.conf ${T}/dspam.conf - - if use cyrus; then - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/lib/cyrus/deliver %u\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/lib/cyrus/deliver\":gI' \ - -i ${T}/dspam.conf - elif use exim; then - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/exim -oMr spam-scanned %u\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/exim -oMr spam-scanned %u\":gI' \ - -i ${T}/dspam.conf - elif use maildrop; then - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/maildrop -d %u\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/maildrop\":gI' \ - -i ${T}/dspam.conf - elif use procmail; then - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/procmail -d %u\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/procmail":gI' \ - -i ${T}/dspam.conf - else - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/sendmail\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/sendmail\":gI' \ - -i ${T}/dspam.conf - fi - if use mysql || use postgres; then - if has_version ">sys-kernel/linux-headers-2.6"; then - # keeps dspam socket for deamon in /var/run/dspam - diropts -m0775 -o dspam -g dspam - dodir /var/run/dspam - keepdir /var/run/dspam - - # We use sockets for the deamon 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' \ - -i ${T}/dspam.conf - - # dspam init script - exeinto /etc/init.d - exeopts -m0755 -o root -g root - newexe ${FILESDIR}/dspam.rc dspam - fi - fi - - # generate random password - local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" - - # database related configuration and scripts - if use mysql; then - # Use existing configuration if possible - if [[ -f ${ROOT}${HOMEDIR}/mysql.data ]]; then - DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${HOMEDIR}/mysql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - 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]="true" - fi - - # Modify configuration and create mysql.data file - 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 ${T}/dspam.conf - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${T}/mysql.data - done - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/mysql.data - 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/virtual_users.sql mysql_virtual_users.sql - newins src/tools.mysql_drv/neural.sql mysql_neural.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 - - elif use postgres ; then - # Use existing configuration if possible - if [ -f ${ROOT}${HOMEDIR}/pgsql.data ]; then - DSPAM_DB_DATA=( $(cat "${ROOT}${HOMEDIR}/pgsql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - 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" - fi - - # Modify configuration and create pgsql.data file - 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 ${T}/dspam.conf - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${T}/pgsql.data - done - - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/pgsql.data - newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql - newins src/tools.pgsql_drv/virtual_users.sql pgsql_virtual_users.sql - newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql - - elif use oci8 ; then - # Use existing configuration if possible - if [ -f ${ROOT}${HOMEDIR}/oracle.data ]; then - DSPAM_DB_DATA=( $(cat "${ROOT}${HOMEDIR}/oracle.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - DSPAM_DB_DATA[0]="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=PROD)))" - DSPAM_DB_DATA[1]="dspam" - DSPAM_DB_DATA[2]="${PASSWORD}" - DSPAM_DB_DATA[3]="dspam" - fi - - # Modify configuration and create oracle.data file - sed -e "s:^#*\(OraServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \ - -e "s:^\(OraUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \ - -e "s:^\(OraPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \ - -e "s:^\(OraSchema[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI"\ - -i ${T}/dspam.conf - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${T}/oracle.data - done - - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/oracle.data - newins src/tools.ora_drv/oral_objects.sql ora_objects.sql - newins src/tools.ora_drv/virtual_users.sql ora_virtual_users.sql - newins src/tools.ora_drv/purge.sql ora_purge.sql - elif use sqlite || use sqlite3 ; then - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - newins src/tools.sqlite_drv/purge.sql sqlite_purge.sql - fi - - sed -e "s:^\(Purge.*\):###\1:g" \ - -e "s:^#\(Purge.*\):\1:g" \ - -e "s:^###\(Purge.*\):#\1:g" \ - -i ${T}/dspam.conf - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/dspam.conf - - # installs the notification messages - # -> The documentation is wrong! The files need to be in ./txt - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR}/txt - keepdir ${HOMEDIR}/txt - insinto ${HOMEDIR}/txt - insopts -m644 -o dspam -g dspam - doins ${S}/txt/*.txt - - # Create the opt-in / opt-out directories - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR}/opt-in - keepdir ${HOMEDIR}/opt-in - dodir ${HOMEDIR}/opt-out - keepdir ${HOMEDIR}/opt-out - - # logrotation scripts - diropts -m0755 -o dspam -g dspam - dodir /etc/logrotate.d - keepdir /etc/logrotate.d - insinto /etc/logrotate.d - insopts -m0755 -o dspam -g dspam - newins ${FILESDIR}/logrotate.dspam dspam - - # dspam cron job - diropts -m0755 -o dspam -g dspam - dodir /etc/cron.daily - keepdir /etc/cron.daily - exeinto /etc/cron.daily - exeopts -m0755 -o dspam -g dspam - doexe ${FILESDIR}/dspam.cron - - # dspam enviroment - echo -ne "CONFIG_PROTECT=\"${DATADIR} /var/run/dspam\"\n\n" > ${T}/40dspam - doenvd ${T}/40dspam || die -} - -pkg_postinst() { - env-update - if use mysql || use postgres || use oci8; then - echo - einfo "To setup DSPAM to run out-of-the-box on your system with a MySQL," - einfo "PostgreSQL or Oracle database, run:" - einfo "ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config" - fi - if use mysql || use postgres; then - if has_version ">sys-kernel/linux-headers-2.6"; then - einfo "If you want to run DSPAM in the new deamon mode. Remember" - einfo "to make the DSPAM daemon start durig boot:" - einfo " rc-update add dspam default" - fi - fi - if use exim ; then - echo - einfo "To use dspam in conjunction with your exim system, you should read the README" - fi -} - -pkg_config () { - if use mysql ; then - DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${HOMEDIR}/mysql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - DSPAM_MySQL_USER="${DSPAM_DB_DATA[2]}" - DSPAM_MySQL_PWD="${DSPAM_DB_DATA[3]}" - DSPAM_MySQL_DB="${DSPAM_DB_DATA[4]}" - - ewarn "When prompted for a password, please enter your MySQL root password" - ewarn "" - - einfo "Creating DSPAM MySQL database \"${DSPAM_MySQL_DB}\"" - /usr/bin/mysqladmin -u root -p create ${DSPAM_MySQL_DB} - - einfo "Creating DSPAM MySQL tables for data objects" - einfo " Please select what kind of object database you like to use." - einfo " [1] Space optimized database" - einfo " [2] Speed optimized database" - einfo - while true - do - read -n 1 -s -p " Press 1 or 2 on the keyboard to select database" DSPAM_MySQL_DB_Type - [[ "${DSPAM_MySQL_DB_Type}" == "1" || "${DSPAM_MySQL_DB_Type}" == "2" ]] && echo && break - done - - if [ "${DSPAM_MySQL_DB_Type}" == "1" ] - then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-space.sql - else - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-speed.sql - fi - - if use virtual-users ; then - einfo "Creating DSPAM MySQL database for virtual-users users" - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_virtual_users.sql - fi - - if use neural ; then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_neural.sql - fi - - einfo "Creating DSPAM MySQL user \"${DSPAM_MySQL_USER}\"" - /usr/bin/mysql -u root -p -e "GRANT SELECT,INSERT,UPDATE,DELETE ON ${DSPAM_MySQL_DB}.* TO ${DSPAM_MySQL_USER}@localhost IDENTIFIED BY '${DSPAM_MySQL_PWD}';FLUSH PRIVILEGES;" -D mysql - elif use postgres ; then - DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${HOMEDIR}/pgsql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - DSPAM_PgSQL_USER="${DSPAM_DB_DATA[2]}" - DSPAM_PgSQL_PWD="${DSPAM_DB_DATA[3]}" - DSPAM_PgSQL_DB="${DSPAM_DB_DATA[4]}" - - ewarn "When prompted for a password, please enter your PgSQL postgres password" - ewarn "" - - einfo "Creating DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\" and user \"${DSPAM_PgSQL_USER}\"" - /usr/bin/psql -h localhost -d template1 -U postgres -c "CREATE USER ${DSPAM_PgSQL_USER} WITH PASSWORD '${DSPAM_PgSQL_PWD}' NOCREATEDB NOCREATEUSER; CREATE DATABASE ${DSPAM_PgSQL_DB}; GRANT ALL PRIVILEGES ON DATABASE ${DSPAM_PgSQL_DB} TO ${DSPAM_PgSQL_USER}; GRANT ALL PRIVILEGES ON SCHEMA public TO ${DSPAM_PgSQL_USER}; UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='${DSPAM_PgSQL_USER}') WHERE datname='${DSPAM_PgSQL_DB}';" - - einfo "Creating DSPAM PostgreSQL tables" - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_objects.sql 1>/dev/null 2>&1 - - if use virtual-users ; then - einfo "Creating DSPAM PostgreSQL database for virtual-users users" - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_virtual-users.sql 1>/dev/null 2>&1 - fi - elif use oci8 ; then - einfo "We have not enought Oracle knowledge to configure Oracle" - einfo "automatically. If you know how, please post a message in" - einfo "Gentoo Bugzilla." - einfo "" - einfo "You need manually to create the Oracle user for DSPAM and" - einfo "the necessary database." - einfo "But the DSPAM configuration file dspam.conf and oracle.data" - einfo "was already configured with the necessary information to" - einfo "access the database." - einfo "Please read your dspam.conf, oracle.data and the README for" - einfo "more info on how to setup DSPAM with Oracle." - elif use sqlite3 ; then - einfo "sqlite3_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - elif use sqlite ; then - einfo "sqlite_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - fi - -} diff --git a/mail-filter/dspam/dspam-3.4.2.ebuild b/mail-filter/dspam/dspam-3.4.2.ebuild deleted file mode 100644 index 406ce137c5ec..000000000000 --- a/mail-filter/dspam/dspam-3.4.2.ebuild +++ /dev/null @@ -1,517 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.4.2.ebuild,v 1.3 2005/07/09 03:16:34 swegener Exp $ - -inherit eutils - -DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter" -SRC_URI="http://dspam.nuclearelephant.com/sources/${P}.tar.gz - http://dspam.nuclearelephant.com/sources/extras/dspam_sa_trainer.tar.gz" -HOMEPAGE="http://dspam.nuclearelephant.com/" -LICENSE="GPL-2" - -IUSE="cyrus debug exim mysql maildrop neural oci8 postgres procmail sqlite sqlite3 large-domain virtual-users" -DEPEND="exim? ( >=mail-mta/exim-4.34 ) - mysql? ( >=dev-db/mysql-3.23 ) || ( >=sys-libs/db-4.0 ) - maildrop? ( >=mail-filter/maildrop-1.5.3 ) - sqlite? ( <dev-db/sqlite-3 ) - sqlite3? ( >=dev-db/sqlite-3 ) - postgres? ( >=dev-db/postgresql-7.4.3 ) - procmail? ( >=mail-filter/procmail-3.22 ) - x86? ( cyrus? ( >=net-mail/cyrus-imapd-2.1.15 ) ) - >=sys-libs/db-4.0 - " -RDEPEND="sys-process/cronbase - app-admin/logrotate" -KEYWORDS="~x86 ~ppc ~alpha" -SLOT="0" - -# some FHS-like structure -HOMEDIR="/etc/mail/dspam" -DATADIR="/var/spool/dspam" -LOGDIR="/var/log/dspam" - -pkg_setup() { - local multiple_dbs="0" - local supported_dbs="mysql postgres oci8 sqlite sqlite3" - for foo in ${supported_dbs}; do - if use ${foo}; then - let multiple_dbs="((multiple_dbs + 1 ))" - einfo " ${foo} database support in your USE flags." - fi - done - if [ "${multiple_dbs}" -ge "2" ]; then - echo - ewarn "You have multiple database backends active in your USE flags." - ewarn "Will default to MySQL as your dspam database backend." - ewarn "If you want to build with another database backend; hit Control-C now." - ewarn "Change your USE flag -mysql and emerge again." - echo - has_version ">=sys-apps/portage-2.0.50" && ( - einfo "It would be best practice to add the set of USE flags that you use for this" - einfo "package to the file: /etc/portage/package.use. Example:" - einfo "\`echo \"mail-filter/dspam -mysql postgres -oci8 -sqlite\" >> /etc/portage/package.use\`" - einfo "to build dspam with Postgres database as your dspam backend." - ) - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - elif [ "${multiple_dbs}" -eq "0" ]; then - echo - ewarn "You did not select any SQL based database backend. DSPAM will use" - ewarn "Berkeley DB for storing data. If you don't want that, then enable" - ewarn "one of the following USE flags:" - ewarn "${supported_dbs}" - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - fi - has_version ">sys-kernel/linux-headers-2.6" || ( - einfo "To use the new DSPAM deamon mode, you need to emerge" - einfo ">sys-kernel/linux-headers-2.6 and rebuild glibc to support NPTL" - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - ) - id dspam 2>/dev/null || enewgroup dspam 26 - id dspam 2>/dev/null || enewuser dspam 26 /bin/bash ${HOMEDIR} dspam -} - -src_compile() { - local myconf - - myconf="${myconf} --enable-long-username" - use large-domain && myconf="${myconf} --enable-large-scale" ||\ - myconf="${myconf} --enable-domain-scale" - - myconf="${myconf} --with-dspam-home=${HOMEDIR}" - myconf="${myconf} --with-dspam-mode=4755" - myconf="${myconf} --with-dspam-owner=dspam" - myconf="${myconf} --with-dspam-group=dspam" - myconf="${myconf} --sysconfdir=${HOMEDIR}" - myconf="${myconf} --with-logdir=${LOGDIR}" - use virtual-users || myconf="${myconf} --enable-homedir" - - # enables support for debugging (touch /etc/dspam/.debug to turn on) - # optional: even MORE debugging output, use with extreme caution! - use debug && myconf="${myconf} --enable-debug --enable-verbose-debug" - - # select storage driver - if use mysql; then - myconf="${myconf} --with-storage-driver=mysql_drv" - myconf="${myconf} --with-mysql-includes=/usr/include/mysql" - myconf="${myconf} --with-mysql-libraries=/usr/lib/mysql" - myconf="${myconf} --enable-preferences-extension" - - if has_version ">sys-kernel/linux-headers-2.6"; then - myconf="${myconf} --enable-daemon" - fi - - use virtual-users && myconf="${myconf} --enable-virtual-users" - # an experimental feature available with MySQL and PgSQL backend - use neural && myconf="${myconf} --enable-neural-networking" - elif use postgres ; then - myconf="${myconf} --with-storage-driver=pgsql_drv" - myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql" - myconf="${myconf} --with-pgsql-libraries=/usr/lib/postgresql" - myconf="${myconf} --enable-preferences-extension" - - if has_version ">sys-kernel/linux-headers-2.6"; then - myconf="${myconf} --enable-daemon" - fi - - use virtual-users && myconf="${myconf} --enable-virtual-users" - # an experimental feature available with MySQL and PgSQL backend - use neural && myconf="${myconf} --enable-neural-networking" - elif use oci8 ; then - myconf="${myconf} --with-storage-driver=ora_drv" - myconf="${myconf} --with-oracle-home=${ORACLE_HOME}" - myconf="${myconf} --enable-virtual-users" - - # I am in no way a Oracle specialist. If someone knows - # how to query the version of Oracle, then let me know. - if (expr ${ORACLE_HOME/*\/} : 10 1>/dev/null 2>&1); then - myconf="${myconf} --with-oracle-version=10" - fi - elif use sqlite3 ; then - myconf="${myconf} --with-storage-driver=sqlite3_drv" - myconf="${myconf} --enable-virtual-users" - elif use sqlite ; then - myconf="${myconf} --with-storage-driver=sqlite_drv" - myconf="${myconf} --enable-virtual-users" - else - myconf="${myconf} --with-storage-driver=libdb4_drv" - fi - - econf ${myconf} || die - emake || die - -} - -src_install () { - - # Fix issues with older dspam configuration - CONFIG_PROTECT="${CONFIG_PROTECT} ${DATADIR} /var/run/dspam" - CONFIG_PROTECT_MASK="${CONFIG_PROTECTMASK/${HOMEDIR}/}" - CONFIG_PROTECT_MASK="${CONFIG_PROTECTMASK/${DATADIR}/}" - - # open up perms on /etc/mail/dspam - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR} - keepdir ${HOMEDIR} - - # keeps dspam data in /var - diropts -m0775 -o dspam -g dspam - dodir ${DATADIR} - keepdir ${DATADIR} - - # keeps dspam log in /var/log - diropts -m0775 -o dspam -g dspam - dodir ${LOGDIR} - keepdir ${LOGDIR} - insinto ${LOGDIR} - touch ${T}/empty.file - newins ${T}/empty.file system.log - dosym ${LOGDIR}/system.log ${HOMEDIR}/system.log - - # ${HOMEDIR}/data is a symlink to ${DATADIR} - dosym ${DATADIR} ${HOMEDIR}/data - - # make install - make DESTDIR=${D} install || die - chmod 4755 ${D}/usr/bin/dspam - chmod 4755 ${D}/usr/bin/dspam_stats - - # documentation - dodoc CHANGELOG LICENSE README* RELEASE.NOTES UPGRADING - dodoc ${DISTDIR}/dspam_sa_trainer.tar.gz - docinto doc - dodoc doc/*.txt - docinto gentoo - dodoc ${FILESDIR}/README.postfix ${FILESDIR}/README.qmail - if use mysql; then - dodoc src/tools.mysql_drv/README - elif use postgres ; then - dodoc src/tools.pgsql_drv/README - elif use oci8 ; then - dodoc src/tools.ora_drv/README - elif use sqlite || use sqlite3 ; then - dodoc src/tools.sqlite_drv/README - fi - doman man/dspam* - dodoc ${DISTDIR}/dspam_sa_trainer.tar.gz - - # build some initial configuration data - [ -f ${HOMEDIR}/dspam.conf ] \ - && cp ${HOMEDIR}/dspam.conf ${T}/dspam.conf \ - || cp src/dspam.conf ${T}/dspam.conf - - if use cyrus; then - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/lib/cyrus/deliver %u\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/lib/cyrus/deliver\":gI' \ - -i ${T}/dspam.conf - elif use exim; then - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/exim -oMr spam-scanned %u\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/exim -oMr spam-scanned %u\":gI' \ - -i ${T}/dspam.conf - elif use maildrop; then - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/maildrop -d %u\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/maildrop\":gI' \ - -i ${T}/dspam.conf - elif use procmail; then - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/procmail -d %u\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/procmail":gI' \ - -i ${T}/dspam.conf - else - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/sendmail\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/sendmail\":gI' \ - -i ${T}/dspam.conf - fi - if use mysql || use postgres; then - if has_version ">sys-kernel/linux-headers-2.6"; then - # keeps dspam socket for deamon in /var/run/dspam - diropts -m0775 -o dspam -g dspam - dodir /var/run/dspam - keepdir /var/run/dspam - - # We use sockets for the deamon 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' \ - -i ${T}/dspam.conf - - # dspam init script - exeinto /etc/init.d - exeopts -m0755 -o root -g root - newexe ${FILESDIR}/dspam.rc dspam - fi - fi - - # generate random password - local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" - - # database related configuration and scripts - if use mysql; then - # Use existing configuration if possible - if [[ -f ${ROOT}${HOMEDIR}/mysql.data ]]; then - DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${HOMEDIR}/mysql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - 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]="true" - fi - - # Modify configuration and create mysql.data file - 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 ${T}/dspam.conf - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${T}/mysql.data - done - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/mysql.data - 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/virtual_users.sql mysql_virtual_users.sql - newins src/tools.mysql_drv/neural.sql mysql_neural.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 - - elif use postgres ; then - # Use existing configuration if possible - if [ -f ${ROOT}${HOMEDIR}/pgsql.data ]; then - DSPAM_DB_DATA=( $(cat "${ROOT}${HOMEDIR}/pgsql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - 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" - fi - - # Modify configuration and create pgsql.data file - 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 ${T}/dspam.conf - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${T}/pgsql.data - done - - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/pgsql.data - newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql - newins src/tools.pgsql_drv/virtual_users.sql pgsql_virtual_users.sql - newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql - - elif use oci8 ; then - # Use existing configuration if possible - if [ -f ${ROOT}${HOMEDIR}/oracle.data ]; then - DSPAM_DB_DATA=( $(cat "${ROOT}${HOMEDIR}/oracle.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - DSPAM_DB_DATA[0]="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=PROD)))" - DSPAM_DB_DATA[1]="dspam" - DSPAM_DB_DATA[2]="${PASSWORD}" - DSPAM_DB_DATA[3]="dspam" - fi - - # Modify configuration and create oracle.data file - sed -e "s:^#*\(OraServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \ - -e "s:^\(OraUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \ - -e "s:^\(OraPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \ - -e "s:^\(OraSchema[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI"\ - -i ${T}/dspam.conf - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${T}/oracle.data - done - - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/oracle.data - newins src/tools.ora_drv/oral_objects.sql ora_objects.sql - newins src/tools.ora_drv/virtual_users.sql ora_virtual_users.sql - newins src/tools.ora_drv/purge.sql ora_purge.sql - elif use sqlite || use sqlite3 ; then - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - newins src/tools.sqlite_drv/purge.sql sqlite_purge.sql - fi - - sed -e "s:^\(Purge.*\):###\1:g" \ - -e "s:^#\(Purge.*\):\1:g" \ - -e "s:^###\(Purge.*\):#\1:g" \ - -i ${T}/dspam.conf - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/dspam.conf - - # installs the notification messages - # -> The documentation is wrong! The files need to be in ./txt - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR}/txt - keepdir ${HOMEDIR}/txt - insinto ${HOMEDIR}/txt - insopts -m644 -o dspam -g dspam - doins ${S}/txt/*.txt - - # Create the opt-in / opt-out directories - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR}/opt-in - keepdir ${HOMEDIR}/opt-in - dodir ${HOMEDIR}/opt-out - keepdir ${HOMEDIR}/opt-out - - # logrotation scripts - diropts -m0755 -o dspam -g dspam - dodir /etc/logrotate.d - keepdir /etc/logrotate.d - insinto /etc/logrotate.d - insopts -m0755 -o dspam -g dspam - newins ${FILESDIR}/logrotate.dspam dspam - - # dspam cron job - diropts -m0755 -o dspam -g dspam - dodir /etc/cron.daily - keepdir /etc/cron.daily - exeinto /etc/cron.daily - exeopts -m0755 -o dspam -g dspam - doexe ${FILESDIR}/dspam.cron - - # dspam enviroment - echo -ne "CONFIG_PROTECT=\"${DATADIR} /var/run/dspam\"\n\n" > ${T}/40dspam - doenvd ${T}/40dspam || die -} - -pkg_postinst() { - env-update - if use mysql || use postgres || use oci8; then - echo - einfo "To setup DSPAM to run out-of-the-box on your system with a MySQL," - einfo "PostgreSQL or Oracle database, run:" - einfo "ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config" - fi - if use mysql || use postgres; then - if has_version ">sys-kernel/linux-headers-2.6"; then - einfo "If you want to run DSPAM in the new deamon mode. Remember" - einfo "to make the DSPAM daemon start durig boot:" - einfo " rc-update add dspam default" - fi - fi - if use exim ; then - echo - einfo "To use dspam in conjunction with your exim system, you should read the README" - fi -} - -pkg_config () { - if use mysql ; then - DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${HOMEDIR}/mysql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - DSPAM_MySQL_USER="${DSPAM_DB_DATA[2]}" - DSPAM_MySQL_PWD="${DSPAM_DB_DATA[3]}" - DSPAM_MySQL_DB="${DSPAM_DB_DATA[4]}" - - ewarn "When prompted for a password, please enter your MySQL root password" - ewarn "" - - einfo "Creating DSPAM MySQL database \"${DSPAM_MySQL_DB}\"" - /usr/bin/mysqladmin -u root -p create ${DSPAM_MySQL_DB} - - einfo "Creating DSPAM MySQL tables for data objects" - einfo " Please select what kind of object database you like to use." - einfo " [1] Space optimized database" - einfo " [2] Speed optimized database" - einfo - while true - do - read -n 1 -s -p " Press 1 or 2 on the keyboard to select database" DSPAM_MySQL_DB_Type - [[ "${DSPAM_MySQL_DB_Type}" == "1" || "${DSPAM_MySQL_DB_Type}" == "2" ]] && echo && break - done - - if [ "${DSPAM_MySQL_DB_Type}" == "1" ] - then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-space.sql - else - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-speed.sql - fi - - if use virtual-users ; then - einfo "Creating DSPAM MySQL database for virtual-users users" - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_virtual_users.sql - fi - - if use neural ; then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_neural.sql - fi - - einfo "Creating DSPAM MySQL user \"${DSPAM_MySQL_USER}\"" - /usr/bin/mysql -u root -p -e "GRANT SELECT,INSERT,UPDATE,DELETE ON ${DSPAM_MySQL_DB}.* TO ${DSPAM_MySQL_USER}@localhost IDENTIFIED BY '${DSPAM_MySQL_PWD}';FLUSH PRIVILEGES;" -D mysql - elif use postgres ; then - DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${HOMEDIR}/pgsql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - DSPAM_PgSQL_USER="${DSPAM_DB_DATA[2]}" - DSPAM_PgSQL_PWD="${DSPAM_DB_DATA[3]}" - DSPAM_PgSQL_DB="${DSPAM_DB_DATA[4]}" - - ewarn "When prompted for a password, please enter your PgSQL postgres password" - ewarn "" - - einfo "Creating DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\" and user \"${DSPAM_PgSQL_USER}\"" - /usr/bin/psql -h localhost -d template1 -U postgres -c "CREATE USER ${DSPAM_PgSQL_USER} WITH PASSWORD '${DSPAM_PgSQL_PWD}' NOCREATEDB NOCREATEUSER; CREATE DATABASE ${DSPAM_PgSQL_DB}; GRANT ALL PRIVILEGES ON DATABASE ${DSPAM_PgSQL_DB} TO ${DSPAM_PgSQL_USER}; GRANT ALL PRIVILEGES ON SCHEMA public TO ${DSPAM_PgSQL_USER}; UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='${DSPAM_PgSQL_USER}') WHERE datname='${DSPAM_PgSQL_DB}';" - - einfo "Creating DSPAM PostgreSQL tables" - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_objects.sql 1>/dev/null 2>&1 - - if use virtual-users ; then - einfo "Creating DSPAM PostgreSQL database for virtual-users users" - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_virtual-users.sql 1>/dev/null 2>&1 - fi - elif use oci8 ; then - einfo "We have not enought Oracle knowledge to configure Oracle" - einfo "automatically. If you know how, please post a message in" - einfo "Gentoo Bugzilla." - einfo "" - einfo "You need manually to create the Oracle user for DSPAM and" - einfo "the necessary database." - einfo "But the DSPAM configuration file dspam.conf and oracle.data" - einfo "was already configured with the necessary information to" - einfo "access the database." - einfo "Please read your dspam.conf, oracle.data and the README for" - einfo "more info on how to setup DSPAM with Oracle." - elif use sqlite3 ; then - einfo "sqlite3_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - elif use sqlite ; then - einfo "sqlite_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - fi - -} diff --git a/mail-filter/dspam/dspam-3.4.5.ebuild b/mail-filter/dspam/dspam-3.4.5.ebuild deleted file mode 100644 index 5aa580a19c7e..000000000000 --- a/mail-filter/dspam/dspam-3.4.5.ebuild +++ /dev/null @@ -1,518 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.4.5.ebuild,v 1.3 2005/07/09 03:16:34 swegener Exp $ - -inherit eutils - -DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter" -SRC_URI="http://dspam.nuclearelephant.com/sources/${P}.tar.gz - http://dspam.nuclearelephant.com/sources/extras/dspam_sa_trainer.tar.gz" -HOMEPAGE="http://dspam.nuclearelephant.com/" -LICENSE="GPL-2" - -IUSE="cyrus debug exim mysql maildrop neural oci8 postgres procmail sqlite sqlite3 large-domain virtual-users" -DEPEND="exim? ( >=mail-mta/exim-4.34 ) - mysql? ( >=dev-db/mysql-3.23 ) || ( >=sys-libs/db-4.0 ) - maildrop? ( >=mail-filter/maildrop-1.5.3 ) - sqlite? ( <dev-db/sqlite-3 ) - sqlite3? ( >=dev-db/sqlite-3 ) - postgres? ( >=dev-db/postgresql-7.4.3 ) - procmail? ( >=mail-filter/procmail-3.22 ) - x86? ( cyrus? ( >=net-mail/cyrus-imapd-2.1.15 ) ) - >=sys-libs/db-4.0 - " -RDEPEND="sys-process/cronbase - app-admin/logrotate" -KEYWORDS="~x86 ~ppc ~alpha" -SLOT="0" - -# some FHS-like structure -HOMEDIR="/etc/mail/dspam" -DATADIR="/var/spool/dspam" -LOGDIR="/var/log/dspam" - -pkg_setup() { - local multiple_dbs="0" - local supported_dbs="mysql postgres oci8 sqlite sqlite3" - for foo in ${supported_dbs}; do - if use ${foo}; then - let multiple_dbs="((multiple_dbs + 1 ))" - einfo " ${foo} database support in your USE flags." - fi - done - if [ "${multiple_dbs}" -ge "2" ]; then - echo - ewarn "You have multiple database backends active in your USE flags." - ewarn "Will default to MySQL as your dspam database backend." - ewarn "If you want to build with another database backend; hit Control-C now." - ewarn "Change your USE flag -mysql and emerge again." - echo - has_version ">=sys-apps/portage-2.0.50" && ( - einfo "It would be best practice to add the set of USE flags that you use for this" - einfo "package to the file: /etc/portage/package.use. Example:" - einfo "\`echo \"mail-filter/dspam -mysql postgres -oci8 -sqlite\" >> /etc/portage/package.use\`" - einfo "to build dspam with Postgres database as your dspam backend." - ) - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - elif [ "${multiple_dbs}" -eq "0" ]; then - echo - ewarn "You did not select any SQL based database backend. DSPAM will use" - ewarn "Berkeley DB for storing data. If you don't want that, then enable" - ewarn "one of the following USE flags:" - ewarn "${supported_dbs}" - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - fi - has_version ">sys-kernel/linux-headers-2.6" || ( - einfo "To use the new DSPAM deamon mode, you need to emerge" - einfo ">sys-kernel/linux-headers-2.6 and rebuild glibc to support NPTL" - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - ) - id dspam 2>/dev/null || enewgroup dspam 26 - id dspam 2>/dev/null || enewuser dspam 26 /bin/bash ${HOMEDIR} dspam -} - -src_compile() { - local myconf - - myconf="${myconf} --enable-long-username" - use large-domain && myconf="${myconf} --enable-large-scale" ||\ - myconf="${myconf} --enable-domain-scale" - - myconf="${myconf} --with-dspam-home=${HOMEDIR}" - myconf="${myconf} --with-dspam-mode=4755" - myconf="${myconf} --with-dspam-owner=dspam" - myconf="${myconf} --with-dspam-group=dspam" - myconf="${myconf} --sysconfdir=${HOMEDIR}" - myconf="${myconf} --with-logdir=${LOGDIR}" - use virtual-users || myconf="${myconf} --enable-homedir" - - # enables support for debugging (touch /etc/dspam/.debug to turn on) - # optional: even MORE debugging output, use with extreme caution! - use debug && myconf="${myconf} --enable-debug --enable-verbose-debug" - - # select storage driver - if use mysql; then - myconf="${myconf} --with-storage-driver=mysql_drv" - myconf="${myconf} --with-mysql-includes=/usr/include/mysql" - myconf="${myconf} --with-mysql-libraries=/usr/lib/mysql" - myconf="${myconf} --enable-preferences-extension" - - if has_version ">sys-kernel/linux-headers-2.6"; then - myconf="${myconf} --enable-daemon" - fi - - use virtual-users && myconf="${myconf} --enable-virtual-users" - # an experimental feature available with MySQL and PgSQL backend - use neural && myconf="${myconf} --enable-neural-networking" - elif use postgres ; then - myconf="${myconf} --with-storage-driver=pgsql_drv" - myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql" - myconf="${myconf} --with-pgsql-libraries=/usr/lib/postgresql" - myconf="${myconf} --enable-preferences-extension" - - if has_version ">sys-kernel/linux-headers-2.6"; then - myconf="${myconf} --enable-daemon" - fi - - use virtual-users && myconf="${myconf} --enable-virtual-users" - # an experimental feature available with MySQL and PgSQL backend - use neural && myconf="${myconf} --enable-neural-networking" - elif use oci8 ; then - myconf="${myconf} --with-storage-driver=ora_drv" - myconf="${myconf} --with-oracle-home=${ORACLE_HOME}" - myconf="${myconf} --enable-virtual-users" - - # I am in no way a Oracle specialist. If someone knows - # how to query the version of Oracle, then let me know. - if (expr ${ORACLE_HOME/*\/} : 10 1>/dev/null 2>&1); then - myconf="${myconf} --with-oracle-version=10" - fi - elif use sqlite3 ; then - myconf="${myconf} --with-storage-driver=sqlite3_drv" - myconf="${myconf} --enable-virtual-users" - elif use sqlite ; then - myconf="${myconf} --with-storage-driver=sqlite_drv" - myconf="${myconf} --enable-virtual-users" - else - myconf="${myconf} --with-storage-driver=libdb4_drv" - fi - - econf ${myconf} || die - emake || die - -} - -src_install () { - - # Fix issues with older dspam configuration - CONFIG_PROTECT="${CONFIG_PROTECT} ${DATADIR} /var/run/dspam" - CONFIG_PROTECT_MASK="${CONFIG_PROTECTMASK/${HOMEDIR}/}" - CONFIG_PROTECT_MASK="${CONFIG_PROTECTMASK/${DATADIR}/}" - - # open up perms on /etc/mail/dspam - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR} - keepdir ${HOMEDIR} - - # keeps dspam data in /var - diropts -m0775 -o dspam -g dspam - dodir ${DATADIR} - keepdir ${DATADIR} - - # keeps dspam log in /var/log - diropts -m0775 -o dspam -g dspam - dodir ${LOGDIR} - keepdir ${LOGDIR} - insinto ${LOGDIR} - touch ${T}/empty.file - doins ${T}/empty.file system.log - chown dspam:dspam ${D}/${LOGDIR}/system.log - dosym ${LOGDIR}/system.log ${HOMEDIR}/system.log - - # ${HOMEDIR}/data is a symlink to ${DATADIR} - dosym ${DATADIR} ${HOMEDIR}/data - - # make install - make DESTDIR=${D} install || die - chmod 4755 ${D}/usr/bin/dspam - chmod 4755 ${D}/usr/bin/dspam_stats - - # documentation - dodoc CHANGELOG LICENSE README* RELEASE.NOTES UPGRADING - dodoc ${DISTDIR}/dspam_sa_trainer.tar.gz - docinto doc - dodoc doc/*.txt - docinto gentoo - dodoc ${FILESDIR}/README.postfix ${FILESDIR}/README.qmail - if use mysql; then - dodoc src/tools.mysql_drv/README - elif use postgres ; then - dodoc src/tools.pgsql_drv/README - elif use oci8 ; then - dodoc src/tools.ora_drv/README - elif use sqlite || use sqlite3 ; then - dodoc src/tools.sqlite_drv/README - fi - doman man/dspam* - dodoc ${DISTDIR}/dspam_sa_trainer.tar.gz - - # build some initial configuration data - [ -f ${HOMEDIR}/dspam.conf ] \ - && cp ${HOMEDIR}/dspam.conf ${T}/dspam.conf \ - || cp src/dspam.conf ${T}/dspam.conf - - if use cyrus; then - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/lib/cyrus/deliver %u\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/lib/cyrus/deliver\":gI' \ - -i ${T}/dspam.conf - elif use exim; then - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/exim -oMr spam-scanned %u\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/exim -oMr spam-scanned %u\":gI' \ - -i ${T}/dspam.conf - elif use maildrop; then - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/maildrop -d %u\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/maildrop\":gI' \ - -i ${T}/dspam.conf - elif use procmail; then - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/procmail -d %u\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/bin/procmail":gI' \ - -i ${T}/dspam.conf - else - sed -e 's:^#*\(UntrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/sendmail\":gI' \ - -e 's:^\(TrustedDeliveryAgent\)[\t ]*.*:\1 \"/usr/sbin/sendmail\":gI' \ - -i ${T}/dspam.conf - fi - if use mysql || use postgres; then - if has_version ">sys-kernel/linux-headers-2.6"; then - # keeps dspam socket for deamon in /var/run/dspam - diropts -m0775 -o dspam -g dspam - dodir /var/run/dspam - keepdir /var/run/dspam - - # We use sockets for the deamon 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' \ - -i ${T}/dspam.conf - - # dspam init script - exeinto /etc/init.d - exeopts -m0755 -o root -g root - newexe ${FILESDIR}/dspam.rc dspam - fi - fi - - # generate random password - local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" - - # database related configuration and scripts - if use mysql; then - # Use existing configuration if possible - if [[ -f ${ROOT}${HOMEDIR}/mysql.data ]]; then - DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${HOMEDIR}/mysql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - 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]="true" - fi - - # Modify configuration and create mysql.data file - 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 ${T}/dspam.conf - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${T}/mysql.data - done - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/mysql.data - 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/virtual_users.sql mysql_virtual_users.sql - newins src/tools.mysql_drv/neural.sql mysql_neural.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 - - elif use postgres ; then - # Use existing configuration if possible - if [ -f ${ROOT}${HOMEDIR}/pgsql.data ]; then - DSPAM_DB_DATA=( $(cat "${ROOT}${HOMEDIR}/pgsql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - 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" - fi - - # Modify configuration and create pgsql.data file - 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 ${T}/dspam.conf - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${T}/pgsql.data - done - - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/pgsql.data - newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql - newins src/tools.pgsql_drv/virtual_users.sql pgsql_virtual_users.sql - newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql - - elif use oci8 ; then - # Use existing configuration if possible - if [ -f ${ROOT}${HOMEDIR}/oracle.data ]; then - DSPAM_DB_DATA=( $(cat "${ROOT}${HOMEDIR}/oracle.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - DSPAM_DB_DATA[0]="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=PROD)))" - DSPAM_DB_DATA[1]="dspam" - DSPAM_DB_DATA[2]="${PASSWORD}" - DSPAM_DB_DATA[3]="dspam" - fi - - # Modify configuration and create oracle.data file - sed -e "s:^#*\(OraServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \ - -e "s:^\(OraUser[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[1]}:gI" \ - -e "s:^\(OraPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[2]}:gI" \ - -e "s:^\(OraSchema[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI"\ - -i ${T}/dspam.conf - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${T}/oracle.data - done - - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/oracle.data - newins src/tools.ora_drv/oral_objects.sql ora_objects.sql - newins src/tools.ora_drv/virtual_users.sql ora_virtual_users.sql - newins src/tools.ora_drv/purge.sql ora_purge.sql - elif use sqlite || use sqlite3 ; then - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - newins src/tools.sqlite_drv/purge.sql sqlite_purge.sql - fi - - sed -e "s:^\(Purge.*\):###\1:g" \ - -e "s:^#\(Purge.*\):\1:g" \ - -e "s:^###\(Purge.*\):#\1:g" \ - -i ${T}/dspam.conf - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/dspam.conf - - # installs the notification messages - # -> The documentation is wrong! The files need to be in ./txt - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR}/txt - keepdir ${HOMEDIR}/txt - insinto ${HOMEDIR}/txt - insopts -m644 -o dspam -g dspam - doins ${S}/txt/*.txt - - # Create the opt-in / opt-out directories - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR}/opt-in - keepdir ${HOMEDIR}/opt-in - dodir ${HOMEDIR}/opt-out - keepdir ${HOMEDIR}/opt-out - - # logrotation scripts - diropts -m0755 -o dspam -g dspam - dodir /etc/logrotate.d - keepdir /etc/logrotate.d - insinto /etc/logrotate.d - insopts -m0755 -o dspam -g dspam - newins ${FILESDIR}/logrotate.dspam dspam - - # dspam cron job - diropts -m0755 -o dspam -g dspam - dodir /etc/cron.daily - keepdir /etc/cron.daily - exeinto /etc/cron.daily - exeopts -m0755 -o dspam -g dspam - doexe ${FILESDIR}/dspam.cron - - # dspam enviroment - echo -ne "CONFIG_PROTECT=\"${DATADIR} /var/run/dspam\"\n\n" > ${T}/40dspam - doenvd ${T}/40dspam || die -} - -pkg_postinst() { - env-update - if use mysql || use postgres || use oci8; then - echo - einfo "To setup DSPAM to run out-of-the-box on your system with a MySQL," - einfo "PostgreSQL or Oracle database, run:" - einfo "ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config" - fi - if use mysql || use postgres; then - if has_version ">sys-kernel/linux-headers-2.6"; then - einfo "If you want to run DSPAM in the new deamon mode. Remember" - einfo "to make the DSPAM daemon start durig boot:" - einfo " rc-update add dspam default" - fi - fi - if use exim ; then - echo - einfo "To use dspam in conjunction with your exim system, you should read the README" - fi -} - -pkg_config () { - if use mysql ; then - DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${HOMEDIR}/mysql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - DSPAM_MySQL_USER="${DSPAM_DB_DATA[2]}" - DSPAM_MySQL_PWD="${DSPAM_DB_DATA[3]}" - DSPAM_MySQL_DB="${DSPAM_DB_DATA[4]}" - - ewarn "When prompted for a password, please enter your MySQL root password" - ewarn "" - - einfo "Creating DSPAM MySQL database \"${DSPAM_MySQL_DB}\"" - /usr/bin/mysqladmin -u root -p create ${DSPAM_MySQL_DB} - - einfo "Creating DSPAM MySQL tables for data objects" - einfo " Please select what kind of object database you like to use." - einfo " [1] Space optimized database" - einfo " [2] Speed optimized database" - einfo - while true - do - read -n 1 -s -p " Press 1 or 2 on the keyboard to select database" DSPAM_MySQL_DB_Type - [[ "${DSPAM_MySQL_DB_Type}" == "1" || "${DSPAM_MySQL_DB_Type}" == "2" ]] && echo && break - done - - if [ "${DSPAM_MySQL_DB_Type}" == "1" ] - then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-space.sql - else - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-speed.sql - fi - - if use virtual-users ; then - einfo "Creating DSPAM MySQL database for virtual-users users" - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_virtual_users.sql - fi - - if use neural ; then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_neural.sql - fi - - einfo "Creating DSPAM MySQL user \"${DSPAM_MySQL_USER}\"" - /usr/bin/mysql -u root -p -e "GRANT SELECT,INSERT,UPDATE,DELETE ON ${DSPAM_MySQL_DB}.* TO ${DSPAM_MySQL_USER}@localhost IDENTIFIED BY '${DSPAM_MySQL_PWD}';FLUSH PRIVILEGES;" -D mysql - elif use postgres ; then - DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${HOMEDIR}/pgsql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - DSPAM_PgSQL_USER="${DSPAM_DB_DATA[2]}" - DSPAM_PgSQL_PWD="${DSPAM_DB_DATA[3]}" - DSPAM_PgSQL_DB="${DSPAM_DB_DATA[4]}" - - ewarn "When prompted for a password, please enter your PgSQL postgres password" - ewarn "" - - einfo "Creating DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\" and user \"${DSPAM_PgSQL_USER}\"" - /usr/bin/psql -h localhost -d template1 -U postgres -c "CREATE USER ${DSPAM_PgSQL_USER} WITH PASSWORD '${DSPAM_PgSQL_PWD}' NOCREATEDB NOCREATEUSER; CREATE DATABASE ${DSPAM_PgSQL_DB}; GRANT ALL PRIVILEGES ON DATABASE ${DSPAM_PgSQL_DB} TO ${DSPAM_PgSQL_USER}; GRANT ALL PRIVILEGES ON SCHEMA public TO ${DSPAM_PgSQL_USER}; UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE usename='${DSPAM_PgSQL_USER}') WHERE datname='${DSPAM_PgSQL_DB}';" - - einfo "Creating DSPAM PostgreSQL tables" - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_objects.sql 1>/dev/null 2>&1 - - if use virtual-users ; then - einfo "Creating DSPAM PostgreSQL database for virtual-users users" - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_virtual-users.sql 1>/dev/null 2>&1 - fi - elif use oci8 ; then - einfo "We have not enought Oracle knowledge to configure Oracle" - einfo "automatically. If you know how, please post a message in" - einfo "Gentoo Bugzilla." - einfo "" - einfo "You need manually to create the Oracle user for DSPAM and" - einfo "the necessary database." - einfo "But the DSPAM configuration file dspam.conf and oracle.data" - einfo "was already configured with the necessary information to" - einfo "access the database." - einfo "Please read your dspam.conf, oracle.data and the README for" - einfo "more info on how to setup DSPAM with Oracle." - elif use sqlite3 ; then - einfo "sqlite3_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - elif use sqlite ; then - einfo "sqlite_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - fi - -} diff --git a/mail-filter/dspam/dspam-3.4.6.ebuild b/mail-filter/dspam/dspam-3.4.9.ebuild index 392ed0b8b97a..311119c39554 100644 --- a/mail-filter/dspam/dspam-3.4.6.ebuild +++ b/mail-filter/dspam/dspam-3.4.9.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.4.6.ebuild,v 1.2 2005/07/09 03:16:34 swegener Exp $ +# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.4.9.ebuild,v 1.1 2005/08/08 07:23:22 st_lim Exp $ inherit eutils diff --git a/mail-filter/dspam/dspam-3.4_rc2.ebuild b/mail-filter/dspam/dspam-3.4_rc2.ebuild deleted file mode 100644 index 3dd4fc57c4f4..000000000000 --- a/mail-filter/dspam/dspam-3.4_rc2.ebuild +++ /dev/null @@ -1,408 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.4_rc2.ebuild,v 1.4 2005/03/11 01:04:24 st_lim Exp $ - -inherit eutils - -MY_PV=${PV/_rc/.rc} -S=${WORKDIR}/${PN}-${MY_PV} -DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter" -SRC_URI="http://dspam.nuclearelephant.com/sources/${PN}-${MY_PV}.tar.gz - http://dspam.nuclearelephant.com/sources/extras/dspam_sa_trainer.tar.gz" -HOMEPAGE="http://dspam.nuclearelephant.com/" -LICENSE="GPL-2" - -IUSE="debug mysql neural oci8 postgres sqlite sqlite3 large-domain" -DEPEND="mysql? ( >=dev-db/mysql-3.23 ) - sqlite? ( <dev-db/sqlite-3 ) - sqlite3? ( >=dev-db/sqlite-3 ) - postgres? ( >=dev-db/postgresql-7.4.3 ) - >=sys-libs/db-4.0 - " -RDEPEND="sys-process/cronbase - app-admin/logrotate" -KEYWORDS="~x86 ~ppc ~alpha" -SLOT="0" - -# some FHS-like structure -HOMEDIR="/etc/mail/dspam" -DATADIR="/var/spool/dspam" -LOGDIR="/var/log/dspam" - -pkg_setup() { - if (use mysql && use postgres) || \ - (use mysql && use oci8) || \ - (use mysql && use sqlite) || \ - (use mysql && use sqlite3) || \ - (use postgres && use oci8) || \ - (use postgres && use sqlite) || \ - (use postgres && use sqlite3) || \ - (use sqlite && use oci8) || \ - (use sqlite3 && use oci8); then - echo - ewarn "You have two of either \"mysql\", \"postgres\", \"oci8\", \"sqlite\" or \"sqlite3\" in your USE flags." - ewarn "Will default to MySQL as your dspam database backend." - ewarn "If you want to build with Postgres/Oracle/SQLite support; hit Control-C now." - ewarn "Change your USE flag -mysql and emerge again." - echo - has_version ">=sys-apps/portage-2.0.50" && ( - einfo "It would be best practice to add the set of USE flags that you use for this" - einfo "package to the file: /etc/portage/package.use. Example:" - einfo "\`echo \"mail-filter/dspam -mysql postgres -oci8 -sqlite -sqlite3\" >> /etc/portage/package.use\`" - einfo "to build dspam with Postgres database as your dspam backend." - ) - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - fi - id dspam 2>/dev/null || enewgroup dspam 26 - id dspam 2>/dev/null || enewuser dspam 26 /bin/bash ${HOMEDIR} dspam -} - -src_compile() { - local myconf - - # these are the default settings - #myconf="${myconf} --enable-daemon" - myconf="${myconf} --enable-homedir" - myconf="${myconf} --enable-long-username" - # Note: The author recommends that if you enable chi square, - # you also DISABLE graham and burton bayesian tests. - #myconf="${myconf} --enable-chi-square" - #myconf="${myconf} --disable-graham-bayesian --disable-burton-bayesian" - #myconf="${myconf} --enable-robinson-pvalues" - use large-domain && myconf="${myconf} --enable-large-scale" ||\ - myconf="${myconf} --enable-domain-scale" - - myconf="${myconf} --with-dspam-mode=4755" - myconf="${myconf} --with-dspam-owner=dspam" - myconf="${myconf} --with-dspam-group=dspam" - myconf="${myconf} --with-dspam-home=${HOMEDIR} --sysconfdir=${HOMEDIR}" - myconf="${myconf} --with-logdir=${LOGDIR}" - - use debug && myconf="${myconf} --enable-debug --enable-verbose-debug" - - # select storage driver - if use mysql; then - myconf="${myconf} --with-storage-driver=mysql_drv" - myconf="${myconf} --with-mysql-includes=/usr/include/mysql" - myconf="${myconf} --with-mysql-libraries=/usr/lib/mysql" - myconf="${myconf} --enable-virtual-users" - myconf="${myconf} --enable-preferences-extension" - - # an experimental feature available with MySQL and PgSQL backend - if use neural ; then - myconf="${myconf} --enable-neural-networking" - fi - elif use postgres ; then - myconf="${myconf} --with-storage-driver=pgsql_drv" - myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql" - myconf="${myconf} --with-pgsql-libraries=/usr/lib/postgresql" - myconf="${myconf} --enable-virtual-users" - myconf="${myconf} --enable-preferences-extension" - - # an experimental feature available with MySQL and PgSQL backend - if use neural ; then - myconf="${myconf} --enable-neural-networking" - fi - elif use oci8 ; then - myconf="${myconf} --with-storage-driver=ora_drv" - myconf="${myconf} --with-oracle-home=${ORACLE_HOME}" - myconf="${myconf} --enable-virtual-users" - myconf="${myconf} --enable-preferences-extension" - - # I am in no way a Oracle specialist. If someone knows - # how to query the version of Oracle, then let me know. - if (expr ${ORACLE_HOME/*\/} : 10 1>/dev/null 2>&1) - then - --with-oracle-version=MAJOR - myconf="${myconf} --with-oracle-version=10" - fi - elif use sqlite3 ; then - myconf="${myconf} --with-storage-driver=sqlite3_drv" - myconf="${myconf} --enable-virtual-users" - elif use sqlite ; then - myconf="${myconf} --with-storage-driver=sqlite_drv" - myconf="${myconf} --enable-virtual-users" - - else - myconf="${myconf} --with-storage-driver=libdb4_drv" - fi - - econf ${myconf} || die - emake || die - -} - -src_install () { - # open up perms on /etc/mail/dspam - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR} - keepdir ${HOMEDIR} - - # keeps dspam data in /var - diropts -m0775 -o dspam -g dspam - dodir ${DATADIR} - keepdir ${DATADIR} - - # keeps dspam log in /var/log - diropts -m0775 -o dspam -g dspam - dodir ${LOGDIR} - keepdir ${LOGDIR} - # ${HOMEDIR}/data is a symlink to ${DATADIR} - dosym ${DATADIR} ${HOMEDIR}/data - - # make install - sed -e 's/rm -f ..mandir.\(.*\)/rm -f ${D}${mandir}\1/g' \ - -e 's/ln -s ..mandir.\(.*\) ..mandir.\(.*3\)/ln -s ${mandir}\1.gz ${D}${mandir}\2.gz/g' \ - -i Makefile - make DESTDIR=${D} install || die - chmod 4755 ${D}/usr/bin/dspam - chmod 4755 ${D}/usr/bin/dspam_stats - - # documentation - if use mysql; then - cp src/tools.mysql_drv/README README.mysql_drv - elif use postgres ; then - cp src/tools.pgsql_drv/README README.pgsql_drv - elif use oci8 ; then - cp src/tools.ora_drv/README README.ora_drv - elif use sqlite ; then - cp src/tools.sqlite_drv/README README.sqlite_drv - fi - dodoc CHANGELOG LICENSE README* RELEASE.NOTES UPGRADING - dodoc ${DISTDIR}/dspam_sa_trainer.tar.gz - docinto gentoo - dodoc ${FILESDIR}/README.postfix ${FILESDIR}/README.qmail - doman man/dspam* - - # build some initial configuration data - # Copy existing dspam.conf - [ -f ${HOMEDIR}/dspam.conf ] && cp ${HOMEDIR}/dspam.conf ${T}/dspam.conf - # If no existing dspam.conf - if [ ! -f ${HOMEDIR}/dspam.conf ]; then - cp ${D}${HOMEDIR}/dspam.conf ${T}/dspam.conf - if use cyrus; then - echo "UntrustedDeliveryAgent /usr/lib/cyrus/deliver %u" >> ${T}/dspam.conf - dosed 's:/usr/bin/procmail:/usr/lib/cyrus/deliver %u:g' ${T}/dspam.conf - elif use exim; then - echo "UntrustedDeliveryAgent /usr/sbin/exim -oMr spam-scanned %u" >> ${T}/dspam.conf - dosed 's:/usr/bin/procmail:/usr/sbin/exim -oMr spam-scanned %u:g' ${T}/dspam.conf - elif use maildrop; then - echo "UntrustedDeliveryAgent /usr/bin/maildrop -d %u" >> ${T}/dspam.conf - dosed 's:/usr/bin/procmail:/usr/bin/maildrop -d %u:g' ${T}/dspam.conf - elif use procmail; then - echo "UntrustedDeliveryAgent /usr/bin/procmail" >> ${T}/dspam.conf - else - echo "UntrustedDeliveryAgent /usr/sbin/sendmail" >> ${T}/dspam.conf - sed 's:/usr/bin/procmail:/usr/sbin/sendmail:g' ${T}/dspam.conf - fi - fi - - local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" - - # database related configuration and scripts - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - if use mysql; then - - if [ -f ${HOMEDIR}/mysql.data ]; then - # Use an existing password - PASSWORD="$(tail -n 2 ${HOMEDIR}/mysql.data | head -n 1 )" - else - # Create the mysql.data file - echo "MySQLServer /var/run/mysqld/mysqld.sock" >> ${T}/mysql.data - echo "MySQLPort" >> ${T}/mysql.data - echo "MySQLUser dspam" >> ${T}/mysql.data - echo "MySQLPass ${PASSWORD}" >> ${T}/mysql.data - echo "MySQLDb dspam" >> ${T}/mysql.data - echo "MySQLCompress true" >> ${T}/mysql.data - [ -z "`grep '^MySQL' ${D}/${HOMEDIR}/dspam.conf`" ] && cat ${T}/mysql.data >> ${T}/dspam.conf - sed -e 's/^MySQL[A-Za-z]* *//g' -i ${T}/mysql.data - doins ${T}/mysql.data - fi - - 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/virtual_users.sql mysql_virtual_users.sql - newins src/tools.mysql_drv/neural.sql mysql_neural.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 - elif use postgres ; then - if [ -f ${HOMEDIR}/pgsql.data ]; then - # Use an existing password - PASSWORD="$(tail -n 2 ${HOMEDIR}/pgsql.data | head -n 1 )" - else - # Create the pgsql.data file - echo "PgSQLServer 127.0.0.1" >> ${T}/pgsql.data - echo "PgSQLPort 5432" >> ${T}/pgsql.data - echo "PgSQLUser dspam" >> ${T}/pgsql.data - echo "PgSQLPass ${PASSWORD}" >> ${T}/pgsql.data - echo "PgSQLDb dspam" >> ${T}/pgsql.data - [ -z "`grep '^PgSQL' ${D}/${HOMEDIR}/dspam.conf`" ] && cat ${T}/pgsql.data >> ${T}/dspam.conf - sed -e 's/^PgSQL[A-Za-z]* *//g' -i ${T}/pgsql.data - doins ${T}/pgsql.data - fi - - newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql - newins src/tools.pgsql_drv/virtual_users.sql pgsql_virtual_users.sql - newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql - - elif use oci8 ; then - if [ -f ${HOMEDIR}/oracle.data ]; then - # Use an existing password - PASSWORD="$(tail -n 2 ${HOMEDIR}/oracle.data | head -n 1 )" - else - # Create the pgsql.data file - echo "OraServer (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=PROD)))" >>${T}/oracle.data - echo "OraUser dspam" >>${T}/oracle.data - echo "OraPass ${PASSWORD}" >>${T}/oracle.data - echo "OraSchema dspam" >>${T}/oracle.data - [ -z "`grep '^Ora' ${D}/${HOMEDIR}/dspam.conf`" ] && cat ${T}/oracle.data >> ${T}/dspam.conf - sed -e 's/^Ora[A-Za-z]* *//g' -i ${T}/oracle.data - doins ${T}/oracle.data - fi - - newins src/tools.ora_drv/oral_objects.sql ora_objects.sql - newins src/tools.ora_drv/virtual_users.sql ora_virtual_users.sql - newins src/tools.ora_drv/purge.sql ora_purge.sql - elif use sqlite ; then - newins src/tools.sqlite_drv/purge.sql sqlite_purge.sql - fi - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/dspam.conf - - # installs the logrotation scripts to the logrotate.d directory - diropts -m0755 -o dspam -g dspam - dodir /etc/logrotate.d - keepdir /etc/logrotate.d - insinto /etc/logrotate.d - newins ${FILESDIR}/logrotate.dspam dspam - - # installs the cron job to the cron directory - diropts -m0755 -o dspam -g dspam - dodir /etc/cron.daily - keepdir /etc/cron.daily - exeinto /etc/cron.daily - exeopts -m0755 -o dspam -g dspam - doexe ${FILESDIR}/dspam.cron - - # installs the notification messages - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR}/txt - keepdir ${HOMEDIR}/txt - insinto ${HOMEDIR}/txt - insopts -m644 -o dspam -g dspam - for foo in ${S}/txt/*.txt; do - if [ ! -f "$(basename ${foo})" ]; then - doins ${foo} - fi - done - - # dspam enviroment - echo -ne "CONFIG_PROTECT_MASK=\"${HOMEDIR}\"\n\n" > ${T}/40dspam - doenvd ${T}/40dspam || die -} - -pkg_postinst() { - if use mysql || use postgres; then - einfo "To setup dspam to run out-of-the-box on your system with a mysql or pgsql database, run:" - einfo "ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config" - fi - if use exim ; then - echo - einfo "To use dspam in conjunction with your exim system, you should read the README" - fi -} - -pkg_config () { - if use mysql ; then - [[ -f ${HOMEDIR}/mysql.data ]] && mv -f ${HOMEDIR}/mysql.data ${HOMEDIR} - DSPAM_MySQL_USER="$(head -n 3 ${HOMEDIR}/mysql.data|tail -n 1)" - DSPAM_MySQL_PWD="$(head -n 4 ${HOMEDIR}/mysql.data|tail -n 1)" - DSPAM_MySQL_DB="$(head -n 5 ${HOMEDIR}/mysql.data|tail -n 1)" - - ewarn "When prompted for a password, please enter your MySQL root password" - ewarn "" - - einfo "Creating DSPAM MySQL database \"${DSPAM_MySQL_DB}\"" - /usr/bin/mysqladmin -u root -p create ${DSPAM_MySQL_DB} - - einfo "Creating DSPAM MySQL tables for data objects" - einfo " Please select what kind of object database you like to use." - einfo " [1] Space optimized database" - einfo " [2] Speed optimized database" - einfo - while true - do - read -n 1 -s -p " Press 1 or 2 on the keyboard to select database" DSPAM_MySQL_DB_Type - [[ "${DSPAM_MySQL_DB_Type}" == "1" || "${DSPAM_MySQL_DB_Type}" == "2" ]] && break - done - - if [ "${DSPAM_MySQL_DB_Type}" == "1" ] - then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-space.sql - else - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-speed.sql - fi - - einfo "Creating DSPAM MySQL database for virtual users" - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_virtual_users.sql - - if use neural ; then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_neural.sql - fi - - einfo "Creating DSPAM MySQL user \"${DSPAM_MySQL_USER}\"" - /usr/bin/mysql -u root -p -e "GRANT SELECT,INSERT,UPDATE,DELETE ON ${DSPAM_MySQL_DB}.* TO ${DSPAM_MySQL_USER}@localhost IDENTIFIED BY '${DSPAM_MySQL_PWD}';FLUSH PRIVILEGES;" -D mysql - elif use postgres ; then - [[ -f ${HOMEDIR}/pgsql.data ]] && mv -f ${HOMEDIR}/pgsql.data ${HOMEDIR} - DSPAM_PgSQL_USER="$(head -n 3 ${HOMEDIR}/pgsql.data|tail -n 1)" - DSPAM_PgSQL_PWD="$(head -n 4 ${HOMEDIR}/pgsql.data|tail -n 1)" - DSPAM_PgSQL_DB="$(head -n 5 ${HOMEDIR}/pgsql.data|tail -n 1)" - - ewarn "When prompted for a password, please enter your PgSQL postgres password" - ewarn "" - - einfo "Creating DSPAM PostgreSQL user \"${DSPAM_PgSQL_USER}\"" - /usr/bin/psql -d template1 -U postgres -c "CREATE USER ${DSPAM_PgSQL_USER} WITH PASSWORD '${DSPAM_PgSQL_PWD}' NOCREATEDB NOCREATEUSER;" 1>/dev/null 2>&1 - - einfo "Creating DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\"" - /usr/bin/psql -d template1 -U postgres -c "CREATE DATABASE ${DSPAM_PgSQL_DB};" 1>/dev/null 2>&1 - - einfo "Getting DSPAM PostgreSQL userid for \"${DSPAM_PgSQL_USER}\"" - DSPAM_PgSQL_USERID=$(/usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -t -c "SELECT usesysid FROM pg_user WHERE usename='${DSPAM_PgSQL_USER}';" | head -n1 | sed "s/^[ ]*\([^ ]*\).*/\1/g") - einfo " UserID: ${DSPAM_PgSQL_USERID}" - - einfo "Getting DSPAM PostgreSQL databaseid for \"${DSPAM_PgSQL_DB}\"" - DSPAM_PgSQL_DBID=$(/usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -t -c "SELECT datdba FROM pg_database WHERE datname='${DSPAM_PgSQL_DB}';" | head -n1 | sed "s/^[ ]*\([^ ]*\).*/\1/g") - einfo " DBID: ${DSPAM_PgSQL_DBID}" - - einfo "Changing owner of DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\" to \"${DSPAM_PgSQL_USER}\"" - /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "UPDATE pg_database SET datdba=${DSPAM_PgSQL_USERID} WHERE datname='${DSPAM_PgSQL_DB}';" 1>/dev/null 2>&1 - - einfo "Creating DSPAM PostgreSQL tables" - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_objects.sql 1>/dev/null 2>&1 - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_virtual_users.sql 1>/dev/null 2>&1 - - einfo "Grant privileges to DSPAM PostgreSQL objects to \"${DSPAM_PgSQL_USER}\"" - for foo in $(/usr/bin/psql -t -d ${DSPAM_PgSQL_DB} -U postgres -c "SELECT tablename FROM pg_tables WHERE tablename LIKE 'dspam\%';") - do - /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "GRANT ALL PRIVILEGES ON TABLE ${foo} TO ${DSPAM_PgSQL_USER};" 1>/dev/null 2>&1 - done - /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE ${DSPAM_PgSQL_DB} TO ${DSPAM_PgSQL_USER};" 1>/dev/null 2>&1 - /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "GRANT ALL PRIVILEGES ON SCHEMA public TO ${DSPAM_PgSQL_USER};" 1>/dev/null 2>&1 - elif use oci8 ; then - [[ -f ${HOMEDIR}/oracle.data ]] && mv -f ${HOMEDIR}/oracle.data ${HOMEDIR} - elif use sqlite3 ; then - einfo "sqlite3_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - elif use sqlite ; then - einfo "sqlite_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - fi - -} diff --git a/mail-filter/dspam/dspam-3.4_rc3.ebuild b/mail-filter/dspam/dspam-3.4_rc3.ebuild deleted file mode 100644 index f1fb8933fa12..000000000000 --- a/mail-filter/dspam/dspam-3.4_rc3.ebuild +++ /dev/null @@ -1,408 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.4_rc3.ebuild,v 1.1 2005/03/11 01:04:24 st_lim Exp $ - -inherit eutils - -MY_PV=${PV/_rc3/.pr1} -S=${WORKDIR}/${PN}-${MY_PV} -DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter" -SRC_URI="http://dspam.nuclearelephant.com/sources/${PN}-${MY_PV}.tar.gz - http://dspam.nuclearelephant.com/sources/extras/dspam_sa_trainer.tar.gz" -HOMEPAGE="http://dspam.nuclearelephant.com/" -LICENSE="GPL-2" - -IUSE="debug mysql neural oci8 postgres sqlite sqlite3 large-domain" -DEPEND="mysql? ( >=dev-db/mysql-3.23 ) - sqlite? ( <dev-db/sqlite-3 ) - sqlite3? ( >=dev-db/sqlite-3 ) - postgres? ( >=dev-db/postgresql-7.4.3 ) - >=sys-libs/db-4.0 - " -RDEPEND="sys-process/cronbase - app-admin/logrotate" -KEYWORDS="~x86 ~ppc ~alpha" -SLOT="0" - -# some FHS-like structure -HOMEDIR="/etc/mail/dspam" -DATADIR="/var/spool/dspam" -LOGDIR="/var/log/dspam" - -pkg_setup() { - if (use mysql && use postgres) || \ - (use mysql && use oci8) || \ - (use mysql && use sqlite) || \ - (use mysql && use sqlite3) || \ - (use postgres && use oci8) || \ - (use postgres && use sqlite) || \ - (use postgres && use sqlite3) || \ - (use sqlite && use oci8) || \ - (use sqlite3 && use oci8); then - echo - ewarn "You have two of either \"mysql\", \"postgres\", \"oci8\", \"sqlite\" or \"sqlite3\" in your USE flags." - ewarn "Will default to MySQL as your dspam database backend." - ewarn "If you want to build with Postgres/Oracle/SQLite support; hit Control-C now." - ewarn "Change your USE flag -mysql and emerge again." - echo - has_version ">=sys-apps/portage-2.0.50" && ( - einfo "It would be best practice to add the set of USE flags that you use for this" - einfo "package to the file: /etc/portage/package.use. Example:" - einfo "\`echo \"mail-filter/dspam -mysql postgres -oci8 -sqlite -sqlite3\" >> /etc/portage/package.use\`" - einfo "to build dspam with Postgres database as your dspam backend." - ) - echo - ewarn "Waiting 30 seconds before starting..." - ewarn "(Control-C to abort)..." - epause 30 - fi - id dspam 2>/dev/null || enewgroup dspam 26 - id dspam 2>/dev/null || enewuser dspam 26 /bin/bash ${HOMEDIR} dspam -} - -src_compile() { - local myconf - - # these are the default settings - #myconf="${myconf} --enable-daemon" - myconf="${myconf} --enable-homedir" - myconf="${myconf} --enable-long-username" - # Note: The author recommends that if you enable chi square, - # you also DISABLE graham and burton bayesian tests. - #myconf="${myconf} --enable-chi-square" - #myconf="${myconf} --disable-graham-bayesian --disable-burton-bayesian" - #myconf="${myconf} --enable-robinson-pvalues" - use large-domain && myconf="${myconf} --enable-large-scale" ||\ - myconf="${myconf} --enable-domain-scale" - - myconf="${myconf} --with-dspam-mode=4755" - myconf="${myconf} --with-dspam-owner=dspam" - myconf="${myconf} --with-dspam-group=dspam" - myconf="${myconf} --with-dspam-home=${HOMEDIR} --sysconfdir=${HOMEDIR}" - myconf="${myconf} --with-logdir=${LOGDIR}" - - use debug && myconf="${myconf} --enable-debug --enable-verbose-debug" - - # select storage driver - if use mysql; then - myconf="${myconf} --with-storage-driver=mysql_drv" - myconf="${myconf} --with-mysql-includes=/usr/include/mysql" - myconf="${myconf} --with-mysql-libraries=/usr/lib/mysql" - myconf="${myconf} --enable-virtual-users" - myconf="${myconf} --enable-preferences-extension" - - # an experimental feature available with MySQL and PgSQL backend - if use neural ; then - myconf="${myconf} --enable-neural-networking" - fi - elif use postgres ; then - myconf="${myconf} --with-storage-driver=pgsql_drv" - myconf="${myconf} --with-pgsql-includes=/usr/include/postgresql" - myconf="${myconf} --with-pgsql-libraries=/usr/lib/postgresql" - myconf="${myconf} --enable-virtual-users" - myconf="${myconf} --enable-preferences-extension" - - # an experimental feature available with MySQL and PgSQL backend - if use neural ; then - myconf="${myconf} --enable-neural-networking" - fi - elif use oci8 ; then - myconf="${myconf} --with-storage-driver=ora_drv" - myconf="${myconf} --with-oracle-home=${ORACLE_HOME}" - myconf="${myconf} --enable-virtual-users" - myconf="${myconf} --enable-preferences-extension" - - # I am in no way a Oracle specialist. If someone knows - # how to query the version of Oracle, then let me know. - if (expr ${ORACLE_HOME/*\/} : 10 1>/dev/null 2>&1) - then - --with-oracle-version=MAJOR - myconf="${myconf} --with-oracle-version=10" - fi - elif use sqlite3 ; then - myconf="${myconf} --with-storage-driver=sqlite3_drv" - myconf="${myconf} --enable-virtual-users" - elif use sqlite ; then - myconf="${myconf} --with-storage-driver=sqlite_drv" - myconf="${myconf} --enable-virtual-users" - - else - myconf="${myconf} --with-storage-driver=libdb4_drv" - fi - - econf ${myconf} || die - emake || die - -} - -src_install () { - # open up perms on /etc/mail/dspam - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR} - keepdir ${HOMEDIR} - - # keeps dspam data in /var - diropts -m0775 -o dspam -g dspam - dodir ${DATADIR} - keepdir ${DATADIR} - - # keeps dspam log in /var/log - diropts -m0775 -o dspam -g dspam - dodir ${LOGDIR} - keepdir ${LOGDIR} - # ${HOMEDIR}/data is a symlink to ${DATADIR} - dosym ${DATADIR} ${HOMEDIR}/data - - # make install - sed -e 's/rm -f ..mandir.\(.*\)/rm -f ${D}${mandir}\1/g' \ - -e 's/ln -s ..mandir.\(.*\) ..mandir.\(.*3\)/ln -s ${mandir}\1.gz ${D}${mandir}\2.gz/g' \ - -i Makefile - make DESTDIR=${D} install || die - chmod 4755 ${D}/usr/bin/dspam - chmod 4755 ${D}/usr/bin/dspam_stats - - # documentation - if use mysql; then - cp src/tools.mysql_drv/README README.mysql_drv - elif use postgres ; then - cp src/tools.pgsql_drv/README README.pgsql_drv - elif use oci8 ; then - cp src/tools.ora_drv/README README.ora_drv - elif use sqlite ; then - cp src/tools.sqlite_drv/README README.sqlite_drv - fi - dodoc CHANGELOG LICENSE README* RELEASE.NOTES UPGRADING - dodoc ${DISTDIR}/dspam_sa_trainer.tar.gz - docinto gentoo - dodoc ${FILESDIR}/README.postfix ${FILESDIR}/README.qmail - doman man/dspam* - - # build some initial configuration data - # Copy existing dspam.conf - [ -f ${HOMEDIR}/dspam.conf ] && cp ${HOMEDIR}/dspam.conf ${T}/dspam.conf - # If no existing dspam.conf - if [ ! -f ${HOMEDIR}/dspam.conf ]; then - cp ${D}${HOMEDIR}/dspam.conf ${T}/dspam.conf - if use cyrus; then - echo "UntrustedDeliveryAgent /usr/lib/cyrus/deliver %u" >> ${T}/dspam.conf - dosed 's:/usr/bin/procmail:/usr/lib/cyrus/deliver %u:g' ${T}/dspam.conf - elif use exim; then - echo "UntrustedDeliveryAgent /usr/sbin/exim -oMr spam-scanned %u" >> ${T}/dspam.conf - dosed 's:/usr/bin/procmail:/usr/sbin/exim -oMr spam-scanned %u:g' ${T}/dspam.conf - elif use maildrop; then - echo "UntrustedDeliveryAgent /usr/bin/maildrop -d %u" >> ${T}/dspam.conf - dosed 's:/usr/bin/procmail:/usr/bin/maildrop -d %u:g' ${T}/dspam.conf - elif use procmail; then - echo "UntrustedDeliveryAgent /usr/bin/procmail" >> ${T}/dspam.conf - else - echo "UntrustedDeliveryAgent /usr/sbin/sendmail" >> ${T}/dspam.conf - sed 's:/usr/bin/procmail:/usr/sbin/sendmail:g' ${T}/dspam.conf - fi - fi - - local PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}" - - # database related configuration and scripts - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - if use mysql; then - - if [ -f ${HOMEDIR}/mysql.data ]; then - # Use an existing password - PASSWORD="$(tail -n 2 ${HOMEDIR}/mysql.data | head -n 1 )" - else - # Create the mysql.data file - echo "MySQLServer /var/run/mysqld/mysqld.sock" >> ${T}/mysql.data - echo "MySQLPort" >> ${T}/mysql.data - echo "MySQLUser dspam" >> ${T}/mysql.data - echo "MySQLPass ${PASSWORD}" >> ${T}/mysql.data - echo "MySQLDb dspam" >> ${T}/mysql.data - echo "MySQLCompress true" >> ${T}/mysql.data - [ -z "`grep '^MySQL' ${D}/${HOMEDIR}/dspam.conf`" ] && cat ${T}/mysql.data >> ${T}/dspam.conf - sed -e 's/^MySQL[A-Za-z]* *//g' -i ${T}/mysql.data - doins ${T}/mysql.data - fi - - 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/virtual_users.sql mysql_virtual_users.sql - newins src/tools.mysql_drv/neural.sql mysql_neural.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 - elif use postgres ; then - if [ -f ${HOMEDIR}/pgsql.data ]; then - # Use an existing password - PASSWORD="$(tail -n 2 ${HOMEDIR}/pgsql.data | head -n 1 )" - else - # Create the pgsql.data file - echo "PgSQLServer 127.0.0.1" >> ${T}/pgsql.data - echo "PgSQLPort 5432" >> ${T}/pgsql.data - echo "PgSQLUser dspam" >> ${T}/pgsql.data - echo "PgSQLPass ${PASSWORD}" >> ${T}/pgsql.data - echo "PgSQLDb dspam" >> ${T}/pgsql.data - [ -z "`grep '^PgSQL' ${D}/${HOMEDIR}/dspam.conf`" ] && cat ${T}/pgsql.data >> ${T}/dspam.conf - sed -e 's/^PgSQL[A-Za-z]* *//g' -i ${T}/pgsql.data - doins ${T}/pgsql.data - fi - - newins src/tools.pgsql_drv/pgsql_objects.sql pgsql_objects.sql - newins src/tools.pgsql_drv/virtual_users.sql pgsql_virtual_users.sql - newins src/tools.pgsql_drv/purge.sql pgsql_purge.sql - - elif use oci8 ; then - if [ -f ${HOMEDIR}/oracle.data ]; then - # Use an existing password - PASSWORD="$(tail -n 2 ${HOMEDIR}/oracle.data | head -n 1 )" - else - # Create the pgsql.data file - echo "OraServer (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=PROD)))" >>${T}/oracle.data - echo "OraUser dspam" >>${T}/oracle.data - echo "OraPass ${PASSWORD}" >>${T}/oracle.data - echo "OraSchema dspam" >>${T}/oracle.data - [ -z "`grep '^Ora' ${D}/${HOMEDIR}/dspam.conf`" ] && cat ${T}/oracle.data >> ${T}/dspam.conf - sed -e 's/^Ora[A-Za-z]* *//g' -i ${T}/oracle.data - doins ${T}/oracle.data - fi - - newins src/tools.ora_drv/oral_objects.sql ora_objects.sql - newins src/tools.ora_drv/virtual_users.sql ora_virtual_users.sql - newins src/tools.ora_drv/purge.sql ora_purge.sql - elif use sqlite ; then - newins src/tools.sqlite_drv/purge.sql sqlite_purge.sql - fi - insinto ${HOMEDIR} - insopts -m644 -o dspam -g dspam - doins ${T}/dspam.conf - - # installs the logrotation scripts to the logrotate.d directory - diropts -m0755 -o dspam -g dspam - dodir /etc/logrotate.d - keepdir /etc/logrotate.d - insinto /etc/logrotate.d - newins ${FILESDIR}/logrotate.dspam dspam - - # installs the cron job to the cron directory - diropts -m0755 -o dspam -g dspam - dodir /etc/cron.daily - keepdir /etc/cron.daily - exeinto /etc/cron.daily - exeopts -m0755 -o dspam -g dspam - doexe ${FILESDIR}/dspam.cron - - # installs the notification messages - diropts -m0775 -o dspam -g dspam - dodir ${HOMEDIR}/txt - keepdir ${HOMEDIR}/txt - insinto ${HOMEDIR}/txt - insopts -m644 -o dspam -g dspam - for foo in ${S}/txt/*.txt; do - if [ ! -f "$(basename ${foo})" ]; then - doins ${foo} - fi - done - - # dspam enviroment - echo -ne "CONFIG_PROTECT_MASK=\"${HOMEDIR}\"\n\n" > ${T}/40dspam - doenvd ${T}/40dspam || die -} - -pkg_postinst() { - if use mysql || use postgres; then - einfo "To setup dspam to run out-of-the-box on your system with a mysql or pgsql database, run:" - einfo "ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config" - fi - if use exim ; then - echo - einfo "To use dspam in conjunction with your exim system, you should read the README" - fi -} - -pkg_config () { - if use mysql ; then - [[ -f ${HOMEDIR}/mysql.data ]] && mv -f ${HOMEDIR}/mysql.data ${HOMEDIR} - DSPAM_MySQL_USER="$(head -n 3 ${HOMEDIR}/mysql.data|tail -n 1)" - DSPAM_MySQL_PWD="$(head -n 4 ${HOMEDIR}/mysql.data|tail -n 1)" - DSPAM_MySQL_DB="$(head -n 5 ${HOMEDIR}/mysql.data|tail -n 1)" - - ewarn "When prompted for a password, please enter your MySQL root password" - ewarn "" - - einfo "Creating DSPAM MySQL database \"${DSPAM_MySQL_DB}\"" - /usr/bin/mysqladmin -u root -p create ${DSPAM_MySQL_DB} - - einfo "Creating DSPAM MySQL tables for data objects" - einfo " Please select what kind of object database you like to use." - einfo " [1] Space optimized database" - einfo " [2] Speed optimized database" - einfo - while true - do - read -n 1 -s -p " Press 1 or 2 on the keyboard to select database" DSPAM_MySQL_DB_Type - [[ "${DSPAM_MySQL_DB_Type}" == "1" || "${DSPAM_MySQL_DB_Type}" == "2" ]] && break - done - - if [ "${DSPAM_MySQL_DB_Type}" == "1" ] - then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-space.sql - else - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_objects-speed.sql - fi - - einfo "Creating DSPAM MySQL database for virtual users" - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_virtual_users.sql - - if use neural ; then - /usr/bin/mysql -u root -p ${DSPAM_MySQL_DB} < ${HOMEDIR}/mysql_neural.sql - fi - - einfo "Creating DSPAM MySQL user \"${DSPAM_MySQL_USER}\"" - /usr/bin/mysql -u root -p -e "GRANT SELECT,INSERT,UPDATE,DELETE ON ${DSPAM_MySQL_DB}.* TO ${DSPAM_MySQL_USER}@localhost IDENTIFIED BY '${DSPAM_MySQL_PWD}';FLUSH PRIVILEGES;" -D mysql - elif use postgres ; then - [[ -f ${HOMEDIR}/pgsql.data ]] && mv -f ${HOMEDIR}/pgsql.data ${HOMEDIR} - DSPAM_PgSQL_USER="$(head -n 3 ${HOMEDIR}/pgsql.data|tail -n 1)" - DSPAM_PgSQL_PWD="$(head -n 4 ${HOMEDIR}/pgsql.data|tail -n 1)" - DSPAM_PgSQL_DB="$(head -n 5 ${HOMEDIR}/pgsql.data|tail -n 1)" - - ewarn "When prompted for a password, please enter your PgSQL postgres password" - ewarn "" - - einfo "Creating DSPAM PostgreSQL user \"${DSPAM_PgSQL_USER}\"" - /usr/bin/psql -d template1 -U postgres -c "CREATE USER ${DSPAM_PgSQL_USER} WITH PASSWORD '${DSPAM_PgSQL_PWD}' NOCREATEDB NOCREATEUSER;" 1>/dev/null 2>&1 - - einfo "Creating DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\"" - /usr/bin/psql -d template1 -U postgres -c "CREATE DATABASE ${DSPAM_PgSQL_DB};" 1>/dev/null 2>&1 - - einfo "Getting DSPAM PostgreSQL userid for \"${DSPAM_PgSQL_USER}\"" - DSPAM_PgSQL_USERID=$(/usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -t -c "SELECT usesysid FROM pg_user WHERE usename='${DSPAM_PgSQL_USER}';" | head -n1 | sed "s/^[ ]*\([^ ]*\).*/\1/g") - einfo " UserID: ${DSPAM_PgSQL_USERID}" - - einfo "Getting DSPAM PostgreSQL databaseid for \"${DSPAM_PgSQL_DB}\"" - DSPAM_PgSQL_DBID=$(/usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -t -c "SELECT datdba FROM pg_database WHERE datname='${DSPAM_PgSQL_DB}';" | head -n1 | sed "s/^[ ]*\([^ ]*\).*/\1/g") - einfo " DBID: ${DSPAM_PgSQL_DBID}" - - einfo "Changing owner of DSPAM PostgreSQL database \"${DSPAM_PgSQL_DB}\" to \"${DSPAM_PgSQL_USER}\"" - /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "UPDATE pg_database SET datdba=${DSPAM_PgSQL_USERID} WHERE datname='${DSPAM_PgSQL_DB}';" 1>/dev/null 2>&1 - - einfo "Creating DSPAM PostgreSQL tables" - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_objects.sql 1>/dev/null 2>&1 - PGUSER=${DSPAM_PgSQL_USER} PGPASSWORD=${DSPAM_PgSQL_PWD} /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U ${DSPAM_PgSQL_USER} -f ${HOMEDIR}/pgsql_virtual_users.sql 1>/dev/null 2>&1 - - einfo "Grant privileges to DSPAM PostgreSQL objects to \"${DSPAM_PgSQL_USER}\"" - for foo in $(/usr/bin/psql -t -d ${DSPAM_PgSQL_DB} -U postgres -c "SELECT tablename FROM pg_tables WHERE tablename LIKE 'dspam\%';") - do - /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "GRANT ALL PRIVILEGES ON TABLE ${foo} TO ${DSPAM_PgSQL_USER};" 1>/dev/null 2>&1 - done - /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE ${DSPAM_PgSQL_DB} TO ${DSPAM_PgSQL_USER};" 1>/dev/null 2>&1 - /usr/bin/psql -d ${DSPAM_PgSQL_DB} -U postgres -c "GRANT ALL PRIVILEGES ON SCHEMA public TO ${DSPAM_PgSQL_USER};" 1>/dev/null 2>&1 - elif use oci8 ; then - [[ -f ${HOMEDIR}/oracle.data ]] && mv -f ${HOMEDIR}/oracle.data ${HOMEDIR} - elif use sqlite3 ; then - einfo "sqlite3_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - elif use sqlite ; then - einfo "sqlite_drv will automatically create the necessary database" - einfo "objects for each user upon first use of DSPAM by that user." - fi - -} diff --git a/mail-filter/dspam/files/digest-dspam-3.4.0-r1 b/mail-filter/dspam/files/digest-dspam-3.4.0-r1 deleted file mode 100644 index ad81d86d6511..000000000000 --- a/mail-filter/dspam/files/digest-dspam-3.4.0-r1 +++ /dev/null @@ -1,2 +0,0 @@ -MD5 eafb06cc4beda7686b77720e9841537a dspam-3.4.0.tar.gz 687132 -MD5 8ffe9d41e6104a4c6d19067528193145 dspam_sa_trainer.tar.gz 1230 diff --git a/mail-filter/dspam/files/digest-dspam-3.4.1 b/mail-filter/dspam/files/digest-dspam-3.4.1 deleted file mode 100644 index c6dfd8ada71f..000000000000 --- a/mail-filter/dspam/files/digest-dspam-3.4.1 +++ /dev/null @@ -1,2 +0,0 @@ -MD5 46764fdcf5db676ac784e7a633e19da3 dspam-3.4.1.tar.gz 692977 -MD5 8ffe9d41e6104a4c6d19067528193145 dspam_sa_trainer.tar.gz 1230 diff --git a/mail-filter/dspam/files/digest-dspam-3.4.2 b/mail-filter/dspam/files/digest-dspam-3.4.2 deleted file mode 100644 index 81cfe9f11766..000000000000 --- a/mail-filter/dspam/files/digest-dspam-3.4.2 +++ /dev/null @@ -1,2 +0,0 @@ -MD5 0c3cbdf699b8a89e92f846332bf4cb54 dspam-3.4.2.tar.gz 697028 -MD5 8ffe9d41e6104a4c6d19067528193145 dspam_sa_trainer.tar.gz 1230 diff --git a/mail-filter/dspam/files/digest-dspam-3.4.5 b/mail-filter/dspam/files/digest-dspam-3.4.5 deleted file mode 100644 index a60f50b71284..000000000000 --- a/mail-filter/dspam/files/digest-dspam-3.4.5 +++ /dev/null @@ -1,2 +0,0 @@ -MD5 fcb16a275e343baaa657eda045123e06 dspam-3.4.5.tar.gz 698456 -MD5 8ffe9d41e6104a4c6d19067528193145 dspam_sa_trainer.tar.gz 1230 diff --git a/mail-filter/dspam/files/digest-dspam-3.4.6 b/mail-filter/dspam/files/digest-dspam-3.4.6 deleted file mode 100644 index 20eb3f458c31..000000000000 --- a/mail-filter/dspam/files/digest-dspam-3.4.6 +++ /dev/null @@ -1,2 +0,0 @@ -MD5 05d6d5546967305e9f1c394f443f8e93 dspam-3.4.6.tar.gz 698599 -MD5 8ffe9d41e6104a4c6d19067528193145 dspam_sa_trainer.tar.gz 1230 diff --git a/mail-filter/dspam/files/digest-dspam-3.4.0 b/mail-filter/dspam/files/digest-dspam-3.4.9 index ad81d86d6511..5fef1fed4b8b 100644 --- a/mail-filter/dspam/files/digest-dspam-3.4.0 +++ b/mail-filter/dspam/files/digest-dspam-3.4.9 @@ -1,2 +1,2 @@ -MD5 eafb06cc4beda7686b77720e9841537a dspam-3.4.0.tar.gz 687132 +MD5 ef7ceba47e63edb02a59be3c36cf0f6f dspam-3.4.9.tar.gz 701069 MD5 8ffe9d41e6104a4c6d19067528193145 dspam_sa_trainer.tar.gz 1230 diff --git a/mail-filter/dspam/files/digest-dspam-3.4_rc2 b/mail-filter/dspam/files/digest-dspam-3.4_rc2 deleted file mode 100644 index fa6c3fabad5f..000000000000 --- a/mail-filter/dspam/files/digest-dspam-3.4_rc2 +++ /dev/null @@ -1,2 +0,0 @@ -MD5 95a8df011885995e4e1f4bf178437379 dspam-3.4.rc2.tar.gz 680623 -MD5 8ffe9d41e6104a4c6d19067528193145 dspam_sa_trainer.tar.gz 1230 diff --git a/mail-filter/dspam/files/digest-dspam-3.4_rc3 b/mail-filter/dspam/files/digest-dspam-3.4_rc3 deleted file mode 100644 index e729bd1357f6..000000000000 --- a/mail-filter/dspam/files/digest-dspam-3.4_rc3 +++ /dev/null @@ -1,2 +0,0 @@ -MD5 6fd75bee56adbff457ef9bae7dcf6bc8 dspam-3.4.pr1.tar.gz 684032 -MD5 8ffe9d41e6104a4c6d19067528193145 dspam_sa_trainer.tar.gz 1230 |