From 631a976c95c5530e209896bede62f7ccc6361ea8 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 30 Jul 2005 12:20:47 +0000 Subject: Major overhaul of this tiny command: Should actually be useful now. --- localmb2md | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'localmb2md') 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 -- cgit v1.2.3