From 415856bdd4f48ab4f2732996f0bae58595092bbe Mon Sep 17 00:00:00 2001 From: Parabola Date: Tue, 5 Apr 2011 14:26:38 +0000 Subject: Tue Apr 5 14:26:38 UTC 2011 --- extra/spamassassin/PKGBUILD | 51 +++++++++++++++++++++++++++++++++ extra/spamassassin/spamassassin.install | 25 ++++++++++++++++ extra/spamassassin/spamd | 49 +++++++++++++++++++++++++++++++ extra/spamassassin/spamd.conf.d | 1 + 4 files changed, 126 insertions(+) create mode 100644 extra/spamassassin/PKGBUILD create mode 100644 extra/spamassassin/spamassassin.install create mode 100644 extra/spamassassin/spamd create mode 100644 extra/spamassassin/spamd.conf.d (limited to 'extra/spamassassin') diff --git a/extra/spamassassin/PKGBUILD b/extra/spamassassin/PKGBUILD new file mode 100644 index 000000000..5559ec48e --- /dev/null +++ b/extra/spamassassin/PKGBUILD @@ -0,0 +1,51 @@ +# $Id: PKGBUILD 106385 2011-01-16 17:09:43Z angvp $ +# Maintainer: Dale Blount +# Contributor: Manolis Tzanidakis + +pkgname=spamassassin +pkgver=3.3.1 +pkgrel=4 +pkgdesc="A mail filter to identify spam." +arch=(i686 x86_64) +license=(APACHE) +url="http://spamassassin.apache.org" +depends=('perl>=5.12.2' 'perl-net-dns' 'perl-uri' 'perl-html-parser' \ + 'perl-digest-sha1' 'perl-io-socket-ssl' 'openssl' \ + 'perl-libwww' 'perl-io-zlib' 'perl-mail-spf' \ + 'perl-archive-tar' 'zlib' 're2c') +makedepends=('razor' 'perl-dbi') +optdepends=('razor: to identify collaborately-flagged spam' + 'gnupg: gpg support, without this use --nogpg flag for sa-update' + 're2c: regexp compiler, for compiling rules with sa-compile') +backup=(etc/conf.d/spamd etc/mail/spamassassin/local.cf \ + etc/mail/spamassassin/init.pre \ + etc/mail/spamassassin/v310.pre \ + etc/mail/spamassassin/v312.pre \ + etc/mail/spamassassin/v320.pre) +install=${pkgname}.install +options=(!emptydirs) +source=(http://mirrors.devlib.org/apache/${pkgname}/source/Mail-SpamAssassin-${pkgver}.tar.gz \ + spamd.conf.d spamd) +md5sums=('5a93f81fda315411560ff5da099382d2' + 'af501c6b0bb937a2775b747cc4b6d150' + '0534d3071a526a27ddc2b297afa03b04') + +build() { + cd ${srcdir}/Mail-SpamAssassin-${pkgver} + + # install module in vendor directories. + PERL_MM_USE_DEFAULT=1 /usr/bin/perl Makefile.PL INSTALLDIRS=vendor \ + CONTACT_ADDRESS=root@localhost ENABLE_SSL=yes PERL_TAINT=no + /usr/bin/make +} + +package() { + cd ${srcdir}/Mail-SpamAssassin-${pkgver} + /usr/bin/make DESTDIR=${pkgdir} install + # remove perllocal.pod and .packlist + find ${pkgdir} -name perllocal.pod -delete + find ${pkgdir} -name .packlist -delete + + /bin/install -D -m644 ${srcdir}/spamd.conf.d ${pkgdir}/etc/conf.d/spamd + /bin/install -D -m755 ${srcdir}/spamd ${pkgdir}/etc/rc.d/spamd +} diff --git a/extra/spamassassin/spamassassin.install b/extra/spamassassin/spamassassin.install new file mode 100644 index 000000000..5109956c9 --- /dev/null +++ b/extra/spamassassin/spamassassin.install @@ -0,0 +1,25 @@ +# arg 1: the new package version +post_install() { + echo "You must run 'sa-update' to install spam rules before use." + /bin/true +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + # Compile rules, if rules have previously been compiled, and it's possible + if [ -x /usr/bin/re2c -a -x /usr/bin/perlbin/vendor/sa-compile -a -d /var/lib/spamassassin/compiled ]; then + echo "Detected compiled rules, running sa-compile..." + sa-compile > /dev/null 2>&1 +fi +} + +# arg 1: the old package version +pre_remove() { + /bin/true +} + +# arg 1: the old package version +post_remove() { + /bin/true +} diff --git a/extra/spamassassin/spamd b/extra/spamassassin/spamd new file mode 100644 index 000000000..11d35f7cd --- /dev/null +++ b/extra/spamassassin/spamd @@ -0,0 +1,49 @@ +#!/bin/bash + +# source application-specific settings +[ -f /etc/conf.d/spamd ] && . /etc/conf.d/spamd + +. /etc/rc.conf +. /etc/rc.d/functions + +PID=`pidof -o %PPID /usr/bin/vendor_perl/spamd` +case "$1" in + start) + stat_busy "Starting spamd" + [ -z "$PID" ] && /usr/bin/vendor_perl/spamd -d ${SPAMD_OPTS} + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon spamd + stat_done + fi + ;; + stop) + stat_busy "Stopping spamd" + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + # Some users report that a second attempt at stopping the process + # works. So, take a little nap and give it another whirl... + sleep 2 + kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon spamd + stat_done + fi + else + rm_daemon spamd + stat_done + fi + ;; + restart) + $0 stop + sleep 3 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 +# vim: ts=2 sw=2 et ft=sh diff --git a/extra/spamassassin/spamd.conf.d b/extra/spamassassin/spamd.conf.d new file mode 100644 index 000000000..4295e0073 --- /dev/null +++ b/extra/spamassassin/spamd.conf.d @@ -0,0 +1 @@ +SPAMD_OPTS="-c" -- cgit v1.2.3-54-g00ecf