summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmutt-wizard.sh18
1 files changed, 12 insertions, 6 deletions
diff --git a/mutt-wizard.sh b/mutt-wizard.sh
index 1fd21a8..076261a 100755
--- a/mutt-wizard.sh
+++ b/mutt-wizard.sh
@@ -9,11 +9,11 @@ fi
muttdir="$HOME/.config/mutt/"
-createMailboxes() { rm -f "$muttdir"autoconf/log
- offlineimap --info -a $1 2&> "$muttdir"autoconf/log
- for box in $(sed -n '/^Folderlist/,/^Folderlist/p' "$muttdir"autoconf/log |
- grep "^ " | awk '{print $1}' | sed -e 's/\//./g')
- do mkdir -p $HOME/.mail/$1/$box; done ;}
+createMailboxes() { rm -f /tmp/log /tmp/lognew
+ offlineimap --info -a $1 2&> /tmp/log
+ sed -n '/^Folderlist/,/^Folderlist/p' /tmp/log |
+ grep "^ " | sed -e "s/\//./g;s/(.*//g;s/^ //g" > /tmp/lognew
+ while read box; do mkdir -p "$HOME/.mail/$1/$box"; done </tmp/lognew ;}
chooseSync() { (crontab -l && testSync) || dialog --msgbox "No cronjob manager detected. Please install one and return to enable automatic mailsyncing" 10 60 ;}
testSync() { (crontab -l | grep .config/mutt/etc/mailsync && removeSync) || addSync ;}
@@ -29,7 +29,13 @@ changePassword() { \
dialog --title "Luke's mutt/offlineIMAP password wizard" --passwordbox "Enter the new password for the \"$1\" account." 10 60 2> /tmp/$1
gpg2 -r $gpgemail --encrypt /tmp/$1 || (dialog --title "GPG decryption failed." --msgbox "GPG decryption failed. This is either because you do not have a GPG key pair or because your distro uses GPG1 and you thus need to symlink /usr/bin/gpg2 to /usr/bin/gpg." 7 60 && break)
shred -u /tmp/$1
- mv /tmp/$1.gpg ~/.config/mutt/credentials/ ;}
+ mv /tmp/$1.gpg ~/.config/mutt/credentials/
+ dialog --title "Finalizing your account." --infobox "The account \"$title\"'s password has been changed. Now attempting to configure mail directories...
+
+ This may take several seconds..." 10 70
+ createMailboxes $title || (clear && exit)
+ detectMailboxes $title
+ dialog --title "Password changed." --msgbox "Your "$fulladdr" password has been changed. To start the download of your mail, you can manually run \`offlineimap -a $title\` in a terminal. The first sync may take some time depending on the amount of your mail." 8 60 ;}
chooseDetect() { for x in $(cat ~/.offlineimaprc | grep "^accounts =" | sed -e 's/accounts =\( \)//g;s/\(,\) /\n/g;'); do detectMailboxes $x; done && detectSuccess ;}