summaryrefslogtreecommitdiff
path: root/localmb2md
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2005-07-30 12:20:47 +0000
committerJonas Smedegaard <dr@jones.dk>2005-07-30 12:20:47 +0000
commit631a976c95c5530e209896bede62f7ccc6361ea8 (patch)
tree47c715fc0d7ff5c23d7b5dc91ea787c69b9c94fa /localmb2md
parent652b170393f64d27eea1abbce46c176ae3b13766 (diff)
Major overhaul of this tiny command: Should actually be useful now.
Diffstat (limited to 'localmb2md')
-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