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
+}
--- /dev/null
+#!/bin/sh
+
+FILTER=/usr/bin/bogofilter
+FILTER_DIR=/var/spool/filter
+POSTFIX=/usr/sbin/sendmail
+export BOGOFILTER_DIR=/home/bogo
+
+# Exit codes from <sysexits.h>
+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 <msg.$$ || exit $EX_TEMPFAIL
+rm -f msg.$$ # safe, we hold the file descriptor
+exec $POSTFIX "$@"
+exit $EX_TEMPFAIL
+
--- /dev/null
+d spam filter 0750 /var/spool/filter