Created
May 12, 2022 01:37
-
-
Save mounty1/88c6c09a1e3bd97b013621dccb9c16d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copy and convert a Dovecot maildir hierarchy to Cyrus. | |
| # Nothing wrong with Dovecot but my OS (OmniOS) does not maintain it in the package repo. | |
| # Run it in the root of the Dovecot store. | |
| for user in * | |
| do | |
| droot=/var/opt/ooce/cyrus/mail/${user:0:1}/user/${user}/ | |
| ls -d ${user}/.[1-z]*/cur | sed -e 's:^'"${user}"'/\.\(.*\)/cur:\1:' | while read D | |
| do | |
| dest="${droot}${D//\./\/}" | |
| echo "<<<${dest}>>>" | |
| sudo -u cyrus mkdir -p -m 700 "${dest}" | |
| echo "" | ls "${user}/.${D}/cur" | nl -ba | sed 's:^ *\(.*\) \(.*\)$:cp "'"${user}/.${D}"'/cur/\2" "'"${dest}"'/\1.":' | sh | |
| sudo -u cyrus touch "${dest}"/cyrus.header | |
| chown cyrus:cyrus "${dest}"/*. ; chmod 644 "${dest}"/*. | |
| done | |
| done | |
| reconstruct -q -x -f -R -G -M |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment