]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/bogofilter/files/postfix-filter.sh
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / bogofilter / files / postfix-filter.sh
1 #!/bin/sh
2
3 FILTER=/usr/bin/bogofilter
4 FILTER_DIR=/var/spool/filter
5 POSTFIX=/usr/sbin/sendmail
6 export BOGOFILTER_DIR=/home/bogo
7
8 # Exit codes from <sysexits.h>
9 EX_TEMPFAIL=75
10 EX_UNAVAILABLE=69
11
12 cd $FILTER_DIR || { echo $FILTER_DIR does not exist; exit $EX_TEMPFAIL; }
13
14 # Clean up when done or when aborting.
15 trap "rm -f msg.$$ ; exit $EX_TEMPFAIL" 0 1 2 3 15
16
17 # bogofilter -e returns: 0 for OK, nonzero for error
18 rm -f msg.$$ || exit $EX_TEMPFAIL
19 $FILTER -p -u -e > msg.$$ || exit $EX_TEMPFAIL
20
21 exec <msg.$$ || exit $EX_TEMPFAIL
22 rm -f msg.$$ # safe, we hold the file descriptor
23 exec $POSTFIX "$@"
24 exit $EX_TEMPFAIL
25