summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlocalmb2md28
1 files changed, 19 insertions, 9 deletions
diff --git a/localmb2md b/localmb2md
index c2739cf..421547f 100755
--- a/localmb2md
+++ b/localmb2md
@@ -2,19 +2,29 @@
set -e
-test -f /usr/bin/mb2md
+if [ ! -f /usr/bin/mb2md ]; then
+ echo 'ERROR: mb2md not installed!'
+ exit 1
+fi
-test ! -f ~/.procmailrc
+if [ -f ~/.procmailrc ]; then
+ echo 'ERROR: ~/.procmailrc exists - must be handled manually...!'
+ exit 1
+fi
echo 'DEFAULT=$HOME/Maildir/' > ~/.procmailrc
-#FIXME: check spool file lock before reading the spool file
+# Convert secondary mailboxes first
+# (reduces risk of clashing with new incoming mail)
+mv ~/mail ~/mail.abandoned
+mb2md -s mail.abandoned
-if [ -f "/var/mail/$user" ]; then
- mb2md -s mail -m
- echo '' > "/var/mail/$user"
+#FIXME: check spool file lock before reading the spool file
+if [ -f "/var/mail/$USER" ]; then
+ mb2md -m
+ echo -n '' > "/var/mail/$USER"
fi
-mb2md -s mail
-
-mv ~/.mailboxlist ~/Maildir/.subscriptions
+if [ -f ~/.mailboxlist ]; then
+ mv ~/.mailboxlist ~/Maildir/.subscriptions
+fi