trainbogo.sh tune

Vasiliy G Tolstov <[email protected]>
Newsgroups gmane.mail.bogofilter.general
Organization Selfip.Ru
Message-ID <[email protected]>
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)

--- /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


-- 
Vasiliy G Tolstov <[email protected]>
Selfip.Ru

_______________________________________________
Bogofilter mailing list
[email protected]
http://www.bogofilter.org/mailman/listinfo/bogofilter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.