courier 2 cyrus

Original by Mart van Santen:
download here

Patched by Willem Jaap Zwart:
download This patch contains the setting of internal date

Patched by Christian Kratzer:
download This patch contains a fix to keep the UIDDB from courier to cyrus

Combined patches by Federico Sevilla III (received on 14/06/2010):
download Federico Sevilla combined above patched versions to one scripts. This is currently the most complete version. (I didn't test this version).



This scrips converts maildir boxes to cyrus boxes,
please BE VERY CAREFULL WITH EXECUTION OF THIS SCRIPT,
it is made for our internal use and some options
are a littlebit dangerous.

What it does is this:

- Takes a Maildir box en copies its email to a cyrus box
- Read flags from user Maildir boxes and write them in
the cyrus database
- Creates cyrus mailboxes

Some code works on the cyrus databases directly, without
using the cyrus commands. Please be very carefull if
you are running an other version then we did
(that was, 2.2.13-8 from debian etch/testing)
It is possible that the database format has been changed.

Also be sure cyrus is not running when converting

It alters these files directly (some files also indirectly):
1. /var/lib/cyrus/mailboxes.db (cyrus skiplist file)
2. /var/lib/cyrus/user/$char/$user.seen (skiplist file)
3. /var/lib/cyrus/user/$char/$user.sub (plaintext file)
4. /var/spool/cyrus/mail/$char/user/$mailbox/cyrus.header
5. /var/spool/cyrus/mail/$char/user/$mailbox/cyrus.index

This is what is done:
For file 1. Add user mailboxes and subboxes
For file 2. Write list of 'seen' messages
For file 3. Write list of subscribed mailboxes
For file 4. Read mailbox id & add custom flags
For file 5. Write per message system & custom flags

ALL FILES CREATED BY THIS SCRIPT ARE WORLD READABLE/WRITABLE,
CHANGE FILE MODES AFTER CONVERSION

Thanks to & parts used from:
http://www.codepoets.co.uk/docs/courier2cyrus (David Goodwin)
http://loophole.morpheus.net/linux/ (index_dump_pl.txt)

This file is distributed under GPL, please send all
changes/additions to me.


usage: maildir2cyrus maildir_username cyrus_username

be sure cyrus is NOT running when executing

a