From a53f01fcd7d5652feb9f161d94e79fa6445c7cf1 Mon Sep 17 00:00:00 2001 From: ccsmart Date: Fri, 16 Sep 2005 14:39:48 +0000 Subject: bogofilter: add basic environment - system accounts, working dirs, postfix script --- packages/bogofilter/bogofilter_0.96.0.bb | 16 +++++++++++++++- packages/bogofilter/files/.mtn2git_empty | 0 packages/bogofilter/files/postfix-filter.sh | 25 +++++++++++++++++++++++++ packages/bogofilter/files/volatiles | 1 + 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 packages/bogofilter/files/.mtn2git_empty create mode 100644 packages/bogofilter/files/postfix-filter.sh create mode 100644 packages/bogofilter/files/volatiles diff --git a/packages/bogofilter/bogofilter_0.96.0.bb b/packages/bogofilter/bogofilter_0.96.0.bb index e552f1b8bd..dcef43d2a6 100644 --- a/packages/bogofilter/bogofilter_0.96.0.bb +++ b/packages/bogofilter/bogofilter_0.96.0.bb @@ -4,14 +4,28 @@ DESCRIPTION = "Bogofilter is a mail filter that classifies mail as spam or ham ( by a statistical analysis of the message's header and content (body). \ The program is able to learn from the user's classifications and corrections." LICENSE = "GPL" -PR = "r1" +PR = "r2" PRIORITY = "optional" SRC_URI = "http://download.sourceforge.net/bogofilter/bogofilter-${PV}.tar.bz2 \ file://${FILESDIR}/configure.ac.patch;patch=1 \ + file://volatiles \ + file://postfix-filter.sh \ " inherit autotools EXTRA_OECONF = "--with-libdb-prefix=${libdir}" +do_install_append () { + mkdir -p ${D}${sysconfdir}/default/volatiles + install -m 644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/01_bogofilter + install -m 755 ${WORKDIR}/postfix-filter.sh ${D}${bindir}/postfix-filter.sh +} + +pkg_postinst () { + grep filter /etc/group || addgroup filter + grep spam /etc/passwd || adduser --disabled-password --home=/var/spool/filter --ingroup filter -g "Bogofilter" spam + grep bogo /etc/passwd || adduser --disabled-password --home=/home/bogo --ingroup filter -g "Bogofilter" bogo + /etc/init.d/populate-volatile.sh +} diff --git a/packages/bogofilter/files/.mtn2git_empty b/packages/bogofilter/files/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/bogofilter/files/postfix-filter.sh b/packages/bogofilter/files/postfix-filter.sh new file mode 100644 index 0000000000..156330b43d --- /dev/null +++ b/packages/bogofilter/files/postfix-filter.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +FILTER=/usr/bin/bogofilter +FILTER_DIR=/var/spool/filter +POSTFIX=/usr/sbin/sendmail +export BOGOFILTER_DIR=/home/bogo + +# Exit codes from +EX_TEMPFAIL=75 +EX_UNAVAILABLE=69 + +cd $FILTER_DIR || { echo $FILTER_DIR does not exist; exit $EX_TEMPFAIL; } + +# Clean up when done or when aborting. +trap "rm -f msg.$$ ; exit $EX_TEMPFAIL" 0 1 2 3 15 + +# bogofilter -e returns: 0 for OK, nonzero for error +rm -f msg.$$ || exit $EX_TEMPFAIL +$FILTER -p -u -e > msg.$$ || exit $EX_TEMPFAIL + +exec