converting wordlist.db (sqlite3 --> DB)

Matthias Andree matthias.andree at gmx.de
Fri Mar 6 21:44:33 CET 2015


Am 06.03.2015 um 12:03 schrieb Gour:
> Hello!
> 
> For several years I'm maintaining my wordlist.db using sqlite3 back-end
> but often I have problem that the distributions/OS-es which I use don't
> have bogofilter-sqlite package and I have to build my own.
> 
> That's why I'm considering that it would be simpler to just user
> 'default' back-end (BerkeleyDB) since I anyway do not do any work with
> wordlist.db database, but wonder if there is some easy way to convert
> wordlist.db database from sqlite3 to Berkele DB format?

Hi Gour,

yes there is.  Basically, you will use bogoutil and a bit of shell stuff

1. stop the mail system so that you don't confuse it

2. for each user, run bogoutil of the sqlite3-enabled version:

cd ~
bogoutil -d .bogofilter/wordlist.db >.bogofilter/wordlist.txt

3. replace the sqlite-based bogofilter by the BerkeleyDB-based
bogofilter install

4. for each user, do this:

cd ~
# backup database:
mv .bogofilter/wordlist.db .bogofilter/wordlist.db.sqlite3
# re-import database:
bogoutil --db-transaction=yes \
	-l .bogofilter/wordlist.db <.bogofilter/wordlist.txt

(there should be no blanks after the \, or you remove the \ and put the
bogoutil ... and the -l ... parts on the same line).

5. restart the mail system

That should be all.  Test a bit and if you are confident that everything
works as desired, you can remove the wordlist.txt and
wordlist.db.sqlite3 files.  Or you keep them as backups :-)

This is a generic procedure, only the --db-transaction=yes is specific
for conversions into BerkeleyDB-based format.  For all other output
formats, just omit --db-transaction=yes.

HTH,
Matthias


More information about the bogofilter mailing list