trainbogo.sh tune

Matthias Andree matthias.andree at gmx.de
Mon Feb 16 20:41:50 CET 2009


Am 16.02.2009, 19:52 Uhr, schrieb Vasiliy G Tolstov <v.tolstov at selfip.ru>:

> Hello! Today i'm switch from gentoo linux to freebsd and saw, that
> trainbogo.sh does not work bacouse md5sum not found, may bee best
> solution - use openssl to generate md5 hash?
>
> to generate md5 with openssl You must pass enc -e -base64 to openssl
> like this
> echo 'test' | openssl enc -e -base64
>
> simple patch to bogofilter-sqlite-1.1.7_1 (freebsd)

Can you install sysutils/coreutils and retry? If that helps, I'll simply  
depend on that port/package so as to provide md5sum.

Thanks in advance
Matthias

> --- /usr/local/share/doc/bogofilter/contrib/trainbogo.sh	2009-02-12
> 03:25:50.000000000 +0300
> +++ /home/vase/trainbogo.sh	2009-02-16 21:49:54.000000000 +0300
> @@ -39,6 +39,7 @@
>      echo "  -n                    don't train bogofilter, just test."
>      echo "  -q                    don't show stats or dots. (quiet)"
>      echo "  -h                    show help."
> +    echo "  -r                    program to hash md5"
>      echo
>  }
> @@ -117,8 +118,8 @@
>  statsdir="${PWD}/stats.tmp/"
>  origstatsdir="${statsdir}"
>  bf=bogofilter
> -
> -while getopts "H:S:s:b:p:fcmnqvh" optname; do
> +hashprog="md5sum"
> +while getopts "H:S:s:b:p:r:fcmnqvh" optname; do
>     case "${optname}" in
>  	
> @@ -133,6 +134,7 @@
>  	"n")	dotrain= ;;
>  	"q")	quiet=y ;;
>  	"v")	verbose=y ;;
> +        "r")    hashprog="$OPTARG";;
>  	"h")	help; exit ;;
>      esac
> @@ -181,7 +183,7 @@
>      for i in "${hamdir}"/* "${spamdir}"/*
>        do
>        [ ! -f "${i}" ] && continue
> -      md5=$(printf "%s" "${rndseed}${i}" | md5sum | sed "s/  -//")
> +      md5=$(printf "%s" "${rndseed}${i}" | $hashprog | sed "s/  -//")
>        echo "${md5}  ${i}" >> "${list}"
>      done
>
>



-- 
Matthias Andree



More information about the Bogofilter mailing list