[mail] Add password unlock step to mailsync

This commit is contained in:
lara 2020-06-18 21:41:17 -04:00
parent fb4d909b7c
commit 9897728497

View file

@ -1,5 +1,10 @@
#!/bin/sh
die () {
2>&1 echo "$*"
exit 1
}
maildir=~/mail
mailboxes=$(find "$maildir" -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '%f\n')
@ -16,7 +21,10 @@ fi
trap "rm -f $LOCKFILE; exit" INT TERM EXIT
echo $$ > "$LOCKFILE"
for m in $mailboxes; do
# Try a single short sync to test password availability
mbsync "$(echo "$mailboxes" | head -n 1)" || die "Please unlock password database"
for m in $(echo "$mailboxes" | tail -n+2); do
mbsync "$m" &
sleep 1
done