summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/bogofilter/bogofilter_0.96.0.bb16
-rw-r--r--packages/bogofilter/files/.mtn2git_empty0
-rw-r--r--packages/bogofilter/files/postfix-filter.sh25
-rw-r--r--packages/bogofilter/files/volatiles1
4 files changed, 41 insertions, 1 deletions
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
--- /dev/null
+++ b/packages/bogofilter/files/.mtn2git_empty
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 <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
+
diff --git a/packages/bogofilter/files/volatiles b/packages/bogofilter/files/volatiles
new file mode 100644
index 0000000000..4c18681cac
--- /dev/null
+++ b/packages/bogofilter/files/volatiles
@@ -0,0 +1 @@
+d spam filter 0750 /var/spool/filter