/usr/bin/bf_tar-bdb is in bogofilter-bdb 1.2.4+dfsg1-4build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #! /bin/sh
# This file dumps a bogofilter to standard output in POSIX-tar format.
#
# Requires: pax
#
# (C) 2004 by Matthias Andree
# GNU GPL v2.
# $Id: bf_tar.in 6750 2008-10-15 23:18:45Z clint $
set -e
: ${BOGOFILTER:=bogofilter}
: ${BOGOUTIL:=bogoutil}
REMOVEBEF=0
REMOVEAFT=0
while [ "$1" ] ; do
case "$1" in
-r) REMOVEAFT=1 ;;
-R) REMOVEBEF=1 ;;
--) shift ; break ;;
-*) echo >&2 "`basename $0`: unknown option $1" ; exit 1 ;;
*) break;
esac
shift
done
if [ $# -ne 1 ] ; then
echo >&2 "Usage: `basename $0` [options] bogodir > outfile.tar"
echo >&2 " or: `basename $0` [options] bogodir | gzip -c >outfile.tar.gz"
echo >&2 'Options are:'
echo >&2 ' -r - remove inactive log files after archiving'
echo >&2 ' -R - remove inactive log files before archiving (use with caution)'
exit 1
fi
# we could write $1 for the moment being as we demand exactly this
# argument above [ $# -ne 1 ]
BOGOHOME=${1:-.}
if [ ! -d "$BOGOHOME" ] ; then
echo $BOGOHOME must be a directory, not a file
exit 1
fi
nukelogs() {
$BOGOUTIL --db-prune="$BOGOHOME"
}
# remove if requested
if [ $REMOVEBEF -eq 1 ] ; then
nukelogs
else
$BOGOUTIL --db-checkpoint="$BOGOHOME"
fi
# database first, then the logs.
# the log MUST be newer than the database, if it's the other way around,
# that state will not be recoverable!
#
# pax options: -w: write archive, -v: verbosely, -x ustar: pick tar format.
files=$(
c="${BOGOHOME}/DB_CONFIG"
if [ -f "$c" ] ; then echo "$c" ; fi
$BOGOFILTER -QQ -d "$BOGOHOME" | grep '^wordlist ' | cut -f3 -d,
$BOGOUTIL --db-list-logfiles="$BOGOHOME" all
)
tar --create --to-stdout --verbose --format=ustar $files
# remove if requested
if [ $REMOVEAFT -eq 1 ] ; then nukelogs ; fi
|