|
NAMEcyrus2dovecot - convert Cyrus folders to DovecotSYNOPSIScyrus2dovecot [-bcdmvq[q]] [-A cyrus-database-dir] [-C cyrus-inbox] [-Q cyrus-quota] [-B cyrus-quota-dir] [-O cyrus-quota-format] [-S cyrus-seen] [-U cyrus-sub] [-H dovecot-host] [-D dovecot-inbox] [-F dovecot-uidlist-format] [-z dovecot-zlib] [-N default-quota] [-E edit-foldernames] [user ...]cyrus2dovecot -h | -v DESCRIPTIONcyrus2dovecot converts the e-mails of one or more users from Cyrus format to Dovecot Maildir++ folders. If no user is specified, the user names are read from the standard input, one per line. Message "UID"s, "INTERNALDATE"s, IMAP folder subscriptions, the "UIDVALIDITY" and "UIDNEXT" values for each folder, as well as all IMAP flags (including the first 26 user-defined keywords) are preserved during the conversion. The generated e-mail filenames include the Maildir++ extensions "S=<size>" and "W=<vsize>" (which are used by Dovecot for better performance). Optionally, Maildir++ maildirsize files are created.OPTIONSWithin the specified PATHs, any occurrence of %u will be replaced by the current user name, any occurrence of "%nu" will be replaced by the n'th character of that user name, any occurrence of %h will be replaced by Cyrus' directory "hash" character for that user name (i.e., %h is equivalent to %1u if the first character of the user name is a lowercase letter), and any occurrence of %x will be replaced by Cyrus' "fulldirhash" character for that user name. However, within the specified --cyrus-quota PATH (if any), these replacements will only be done if the --cyrus-quota-format VERSION is set to 1.The default settings can be found (and modified) at the top of the cyrus2dovecot script.
RETURN VALUEcyrus2dovecot exits 0 on success, and >0 if one or more errors occur during the conversion of the e-mails of one or more users.EXAMPLESGiven that the path to the INBOX folders in Cyrus is /var/spool/imap/user/%u (where %u denotes the user name), that Cyrus stores the seen and subscription databases within the directory /var/imap/user/%h, and that Cyrus stores "quotalegacy" files within the directory /var/imap/quota/%h (where %h denotes Cyrus' directory "hash" character for that user name, respectively), the following command would convert all e-mails of the users "bill" and "george" from Cyrus to Dovecot, and the result would be stored below /tmp/dovecot (including maildirsize files for both users if their quota limits are found):cyrus2dovecot --cyrus-database-dir /var/imap/user/%h \ --cyrus-quota-dir /var/imap/quota/%h \ --cyrus-inbox /var/spool/imap/user/%u \ --dovecot-inbox /tmp/dovecot/%u/Maildir \ bill george Given that the default settings specified at the top of the cyrus2dovecot script are correct, and that /tmp/users holds the names of all users whose e-mails should be converted (one per line), the following command would convert all e-mails of those users: cyrus2dovecot < /tmp/users Given that the default settings specified at the top of the cyrus2dovecot script are correct, a command such as the following could be used in order to convert all e-mails of all users (of course, the path to the INBOX folders in Cyrus may have to be adjusted; e.g., if the "hashimapspool" option is not enabled in the Cyrus configuration, /? must be removed from the path): find /var/spool/imap/user/?/. \! -name . -prune \ -exec basename \{\} \; | cyrus2dovecot Cyrus transparently replaces any "." character in folder names with a "^" character. Dovecot supports "." characters in Maildir++ folder names if the "listescape" plugin is used, which replaces any "." character in folder names with the string "\2e". The following argument could be added to the cyrus2dovecot command line in order to replace any "^" character in Cyrus folder names with "\2e" for the Maildir++ folder name: --edit-foldernames 's/\^/\\2e/g' Dovecot 1.1 and newer support using folders such as Maildir/sub/folder (as opposed to Maildir/.sub.folder) if ":LAYOUT=fs" was added to the "mail_location" in the Dovecot configuration. The following cyrus2dovecot arguments could be specified in order to create such folders by removing the leading dot from Maildir++ subfolder names and then substituting any following dots with slashes: --edit-foldernames 's/^\.//' \ --edit-foldernames 's/\./\//g' If the seen states, subscriptions, or quotas are stored in Berkeley databases, they must first be converted to one of the formats supported by cyrus2dovecot using a command such as the following: cvt_cyrusdb /var/imap/user/b/bill.seen berkeley \ /tmp/imap/user/b/bill.seen skiplist CAVEATScyrus2dovecot assumes that the user has no e-mails in Dovecot yet and that neither his Cyrus folders nor his Dovecot folders will be accessed by another process during the conversion.If "%nu" is specified within any PATH on the command line, all user names must have a length of at least n characters. Otherwise, cyrus2dovecot will die with an exception. If folder name substitutions are specified via --edit-foldernames, the resulting Maildir++ folder names must be unique. RESTRICTIONSCyrus' seen and subscription databases must be present either in the "skiplist" format or in the "flat" text format, and Cyrus' quota database(s) (if any) must be present either in one of those formats or in the "quotalegacy" format, as cyrus2dovecot doesn't support Berkeley databases. However, Berkeley databases can be converted to one of the supported formats using cvt_cyrusdb(8), see the "EXAMPLES".In maildirsize files created by cyrus2dovecot, no limit for the number of messages is specified (as such a limit does not seem useful). Cyrus' ACL settings are not converted. COMPATIBILITYcyrus2dovecot is supposed to work with all Cyrus releases up to (at least) version 2.3.x. So far, it has been tested with Cyrus 1.4, 2.1.18, 2.2.12, and 2.3.12p2.SEE ALSOOther tools for converting e-mails from Cyrus to Dovecot can be found at <http://wiki.dovecot.org/Migration/Cyrus>.AUTHORWritten by Holger Weiss <holger@ZEDAT.FU-Berlin.DE> at Freie Universitaet Berlin, Germany, Zentraleinrichtung fuer Datenverarbeitung (ZEDAT).COPYRIGHT AND LICENSECopyright (c) 2008 Freie Universitaet Berlin. All rights reserved.This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. HISTORY$Log: cyrus2dovecot,v $ Revision 1.3 2008/10/05 17:45:06 holger If a seen state, subscription, or quota database is not found, a message will now be printed. As this does not necessarily indicate a problem, such messages can be suppressed by specifying the "--quiet" option. Apart from that, the "--cyrus-database-dir" and "--cyrus-quota-dir" options (which are merely convenience aliases) have been added, and various minor enhancements have been applied. Revision 1.2 2008/09/24 09:52:33 holger Message seen states are now parsed more efficiently with regard to performance and memory usage. Apart from that, minor code cleanups have been applied. Revision 1.1 2008/09/22 08:36:44 holger Initial release.
Visit the GSP FreeBSD Man Page Interface. |