diff options
Diffstat (limited to 'mail-filter/dspam')
-rw-r--r-- | mail-filter/dspam/Manifest | 1 | ||||
-rw-r--r-- | mail-filter/dspam/dspam-3.10.2-r1.ebuild | 222 | ||||
-rw-r--r-- | mail-filter/dspam/files/dspam.confd | 7 | ||||
-rw-r--r-- | mail-filter/dspam/files/dspam.cron-r4 | 5 | ||||
-rw-r--r-- | mail-filter/dspam/files/dspam.initd | 45 | ||||
-rw-r--r-- | mail-filter/dspam/files/dspam.logrotate | 10 | ||||
-rw-r--r-- | mail-filter/dspam/metadata.xml | 35 |
7 files changed, 325 insertions, 0 deletions
diff --git a/mail-filter/dspam/Manifest b/mail-filter/dspam/Manifest new file mode 100644 index 00000000000..170c2991bb0 --- /dev/null +++ b/mail-filter/dspam/Manifest @@ -0,0 +1 @@ +DIST dspam-3.10.2.tar.gz 1035054 SHA256 ae76569604021f35b741fb95198a1e611a8c64c3838661973a6cf360bba593a9 SHA512 5fe53e1d0d7cabb3983f5c67274b074b7c647c1bae10ebc7ea3805542f99dbfb39abd4697e344e6eb80554522319a1253e1082ed6b389364bbaec1d6ddd43856 WHIRLPOOL 7195f295e786d0b327670ebcb292dc5d9fe98d94e48a5b4e3dd231aae88d55c19dfcf2c04df65bb969fdd8f1210ec125d6aa84d602623cb20964a170f95b880e diff --git a/mail-filter/dspam/dspam-3.10.2-r1.ebuild b/mail-filter/dspam/dspam-3.10.2-r1.ebuild new file mode 100644 index 00000000000..9bb6a703bba --- /dev/null +++ b/mail-filter/dspam/dspam-3.10.2-r1.ebuild @@ -0,0 +1,222 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=4 + +inherit eutils user + +DESCRIPTION="A statistical-algorithmic hybrid anti-spam filter" +HOMEPAGE="http://dspam.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" + +LICENSE="AGPL-3" +SLOT="0" +KEYWORDS="amd64 ~arm ~ppc x86" +DRIVERS_IUSE="+hash mysql postgres sqlite" +SCALES_IUSE="small-scale +domain-scale large-scale" +IUSE="clamav daemon debug ldap static-libs syslog virtual-users user-homedirs ${DRIVERS_IUSE} ${SCALES_IUSE}" + +DEPEND=" + net-mail/mailbase + ldap? ( net-nds/openldap ) + mysql? ( >=virtual/mysql-5.0 ) + postgres? ( dev-db/postgresql ) + sqlite? ( dev-db/sqlite:3 ) +" +RDEPEND=" + ${DEPEND} + clamav? ( app-antivirus/clamav ) + syslog? ( virtual/logger ) +" + +# Demands on sane USE flags: +# - find out what driver to use: select at least one +# - if static-libs is set, only one driver may be selected +# - find out what scale to use: select exactly one +# - user-homedirs does not work with virtual-users +REQUIRED_USE=" + || ( ${DRIVERS_IUSE//+} ) + static-libs? ( ^^ ( ${DRIVERS_IUSE//+} ) ) + ^^ ( ${SCALES_IUSE//+} ) + virtual-users? ( !user-homedirs ) +" + +# dspam setup defaults +DSPAM_HOME=/var/spool/dspam +DSPAM_CONF=/etc/dspam +DSPAM_LOG=/var/log/dspam +DSPAM_MODE=2510 +DSPAM_DRIVERS= +DSPAM_DRIVERS_EXTRAS= + +pkg_setup() { + # setup storage, this sets DSPAM_DRIVERS + dspam_setup_storage_drivers + + # create dspam user and group + dspam_setup_user +} + +src_configure() { + econf \ + --sysconfdir=${DSPAM_CONF} \ + --with-dspam-home=${DSPAM_HOME} \ + --with-dspam-home-group=dspam \ + --with-dspam-mode=${DSPAM_MODE} \ + --with-dspam-group=dspam \ + --with-logdir=${DSPAM_LOG} \ + --enable-external-lookup \ + --enable-long-usernames \ + --enable-split-configuration \ + $(use_enable clamav) \ + $(use_enable daemon) \ + $(use_enable debug) \ + $(use_enable debug bnr-debug) \ + $(use_enable debug verbose-debug) \ + $(use_enable domain-scale) \ + $(use_enable large-scale) \ + $(use_enable static-libs static) \ + $(use_enable syslog) \ + $(use_enable user-homedirs homedir) \ + $(use_enable virtual-users) \ + --with-storage-driver=${DSPAM_DRIVERS} ${DSPAM_DRIVERS_EXTRAS} \ + $(use mysql || use postgres && echo "--enable-preferences-extension") \ + $(use syslog || echo "--with-logfile=${DSPAM_LOG}/dspam.log") +} + +dspam_setup_user() { + # DSPAM CGI web gui (www-apps/dspam-web) needs to run as a regular user + # under suexec in apache, so DSPAM user/group need to be regular users too + + local euid egid + for euid in {1000..5000} ; do + [ -z "$(egetent passwd ${euid})" ] && break + done + for egid in {1000..5000} ; do + [ -z "$(egetent group ${egid})" ] && break + done + enewgroup dspam ${egid} + enewuser dspam ${euid} -1 "${DSPAM_HOMEDIR}" dspam,mail +} + +dspam_setup_storage_drivers() { + # Find out which storage drivers need to be enabled, and set some + # variables so that src_configure can pick them up + + if use hash; then + DSPAM_DRIVERS+=",hash_drv" + fi + + if use mysql; then + DSPAM_DRIVERS+=",mysql_drv" + DSPAM_DRIVERS_EXTRAS+="--with-mysql-includes=/usr/include/mysql " + fi + + if use postgres; then + DSPAM_DRIVERS+=",pgsql_drv" + fi + + if use sqlite; then + DSPAM_DRIVERS+=",sqlite3_drv" + fi + + if ! use static-libs; then + # set the driver name twice to avoid a static build + DSPAM_DRIVERS+=${DSPAM_DRIVERS} + fi + + # remove first comma separator + DSPAM_DRIVERS=${DSPAM_DRIVERS:1} + einfo "Building with drivers: ${DSPAM_DRIVERS}" + #echo DSPAM_DRIVERS_EXTRAS=$DSPAM_DRIVERS_EXTRAS +} + +src_install() { + default + + if use daemon; then + newinitd "${FILESDIR}/dspam.initd" dspam + newconfd "${FILESDIR}/dspam.confd" dspam + fi + + if use mysql; then + insinto "/usr/share/${PN}/mysql" + + local files="mysql_objects-4.1.sql mysql_objects-space.sql mysql_objects-speed.sql purge-4.1.sql purge.sql" + if use virtual-users; then + files+=" virtual_user_aliases.sql virtual_users.sql" + fi + + for file in $files; do + doins src/tools.mysql_drv/${file} + done + fi + + if use postgres; then + insinto "/usr/share/${PN}/pgsql" + + local files="pgsql_objects.sql purge-pe.sql purge.sql" + if use virtual-users; then + files+=" virtual_users.sql" + fi + + for file in $files; do + doins src/tools.pgsql_drv/${file} + done + fi + + if use sqlite; then + insinto "/usr/share/${PN}/sqlite" + newins src/tools.sqlite_drv/purge-3.sql purge.sql + fi + + insinto "${DSPAM_HOME}/txt" + doins txt/*.txt + for i in spam nonspam; do + echo "Scanned and tagged with DSPAM ${PV} on Gentoo Linux as ${i} by ISP" > "${T}/msgtag.${i}" + doins "${T}/msgtag.${i}" + done + + newbin contrib/dspam_maintenance/dspam_maintenance.sh dspam_maintenance + exeinto /etc/cron.daily + newexe "${FILESDIR}/dspam.cron-r4" dspam + + insinto /etc/logrotate.d + newins "${FILESDIR}/dspam.logrotate" dspam + + dodoc CHANGELOG README* RELEASE.NOTES UPGRADING doc/*.txt + + # stop logrotate-3.8 from complaining + dodir /var/log/dspam + fowners dspam:dspam /var/log/dspam + fperms 0750 /var/log/dspam + + # Install dspamc setgid + fowners root:dspam /usr/bin/dspamc && + fperms g+s /usr/bin/dspamc || + die "failed to alter dspamc owner:group or mode" +} + +pkg_preinst() { + # dspam-3.10.0: config dir change, should be removed at some later point + if [ -d "${ROOT}/etc/mail/dspam" ]; then + ewarn "The configuration directory of DSPAM has been relocated from /etc/mail/dspam to ${DSPAM_CONF}." + if [ -h "${ROOT}${DSPAM_CONF}" ]; then + # symlink, this is the setup in older ebuilds + ewarn "Moving contents of /etc/mail/dspam to ${DSPAM_CONF} ..." + rm "${ROOT}${DSPAM_CONF}" && mv "${ROOT}/etc/mail/dspam" "${DSPAM_CONF}" + eend $? + + elif [ -d "${ROOT}${DSPAM_CONF}" ]; then + # directory and no symlink, do it manually since we cannot decide. + ewarn "You have both /etc/mail/dspam and ${DSPAM_CONF} directories, please delete the former." + + else + # nothing interesting in /etc/dspam + ewarn "Moving contents of /etc/mail/dspam to ${DSPAM_CONF} ..." + mv "${ROOT}/etc/mail/dspam" "${DSPAM_CONF}" + eend $? + fi + fi +} diff --git a/mail-filter/dspam/files/dspam.confd b/mail-filter/dspam/files/dspam.confd new file mode 100644 index 00000000000..75e0d4bda7d --- /dev/null +++ b/mail-filter/dspam/files/dspam.confd @@ -0,0 +1,7 @@ +# Change this to the user:group you want to run the dspam daemon as. +# If you need dspam to switch uids, this is root:root. +# If you use virtual users and deliver via LMTP, this can be nonprivileged such as dspam:dspam. +DAEMON_USER_GROUP="root:root" + +# Pid file +PID_FILE="/var/run/dspam/dspam.pid" diff --git a/mail-filter/dspam/files/dspam.cron-r4 b/mail-filter/dspam/files/dspam.cron-r4 new file mode 100644 index 00000000000..edf97dce541 --- /dev/null +++ b/mail-filter/dspam/files/dspam.cron-r4 @@ -0,0 +1,5 @@ +#!/bin/sh + +# See dspam_maintenance --help for a list additional parameters + +/usr/bin/dspam_maintenance --verbose --purgescriptdir=/usr/share/dspam 1> /dev/null diff --git a/mail-filter/dspam/files/dspam.initd b/mail-filter/dspam/files/dspam.initd new file mode 100644 index 00000000000..4e8acf60ec8 --- /dev/null +++ b/mail-filter/dspam/files/dspam.initd @@ -0,0 +1,45 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +extra_started_commands="reload" +PIDFILE=${PID_FILE:-/var/run/dspam/dspam.pid} + +depend() { + use logger + before mta + after postgresql mysql ldap +} + +checkconfig() { + local PIDDIR + PIDDIR=${PIDFILE%/*} + if [ ! -d "${PIDDIR:-/var/run/dspam}" ]; then + checkpath -q -d -o dspam:dspam -m 0755 "${PIDDIR}" || return 1 + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting dspam" + start-stop-daemon --start --quiet \ + --user ${DAEMON_USER_GROUP} \ + --pidfile ${PIDFILE} \ + --exec /usr/bin/dspam -- --daemon + eend $? +} + +stop() { + ebegin "Stopping dspam" + start-stop-daemon --stop \ + --pidfile ${PIDFILE} \ + --exec /usr/bin/dspam + eend $? +} + +reload() { + ebegin "Reloading dspam" + start-stop-daemon --signal SIGHUP /usr/bin/dspam + eend $? +} diff --git a/mail-filter/dspam/files/dspam.logrotate b/mail-filter/dspam/files/dspam.logrotate new file mode 100644 index 00000000000..f5e13067cfc --- /dev/null +++ b/mail-filter/dspam/files/dspam.logrotate @@ -0,0 +1,10 @@ +/var/log/dspam/bnr.log +/var/log/dspam/dspam.debug +/var/log/dspam/dspam.log +/var/log/dspam/dspam.messages +/var/log/dspam/sql.errors { + weekly + compress + missingok + copytruncate +} diff --git a/mail-filter/dspam/metadata.xml b/mail-filter/dspam/metadata.xml new file mode 100644 index 00000000000..a8b33acb205 --- /dev/null +++ b/mail-filter/dspam/metadata.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>net-mail</herd> + <longdescription>A statistical-algorithmic hybrid anti-spam filter</longdescription> + <use> + <flag name="daemon"> + Enable support for DSPAM to run in --daemon mode + </flag> + <flag name="debug"> + Enable debugging support (don't enable this unless something needs testing!) + </flag> + <flag name="user-homedirs"> + Build with user homedir support + </flag> + <flag name="virtual-users"> + Build with virtual-users support + </flag> + <flag name="small-scale"> + Build for small scale setups - puts data to $HOME/data/user + </flag> + <flag name="domain-scale"> + Build for domain scale setups - puts data to $HOME/data/domain.com/user + </flag> + <flag name="large-scale"> + Build for large scale setups - puts data to $HOME/data/u/s/user + </flag> + <flag name="hash"> + Enable support for the file-orientated hash driver + </flag> + </use> + <upstream> + <remote-id type="sourceforge">dspam</remote-id> + </upstream> +</pkgmetadata> |