summaryrefslogtreecommitdiff
path: root/localmb2md
blob: 8452b66b075cd8c91c38fbb6d3a51bd746233f92 (plain)
  1. #!/bin/sh
  2. set -e
  3. if [ ! -f /usr/bin/mb2md ]; then
  4. echo 'ERROR: mb2md not installed!'
  5. exit 1
  6. fi
  7. if [ -f ~/.procmailrc ]; then
  8. echo 'ERROR: ~/.procmailrc exists - must be handled manually...!'
  9. exit 1
  10. fi
  11. echo 'DEFAULT=$HOME/Maildir/' > ~/.procmailrc
  12. # Convert secondary mailboxes first
  13. # (reduces risk of clashing with new incoming mail)
  14. mv ~/mail ~/mail.abandoned
  15. mb2md -s mail.abandoned
  16. #FIXME: check spool file lock before reading the spool file
  17. if [ -f "/var/mail/$USER" ]; then
  18. mb2md -m
  19. echo -n '' > "/var/mail/$USER"
  20. fi
  21. # Grab dovecot subscriptions
  22. if [ -f ~/mail/.subscriptions ]; then
  23. mv ~/mail/.subscriptions ~/Maildir/.subscriptions
  24. # ...or UW-imap ones
  25. elif [ -f ~/.mailboxlist ]; then
  26. mv ~/.mailboxlist ~/Maildir/.subscriptions
  27. fi