sed -n '/^Folderlist/,/^Folderlist/p' "$tmpdir"/log |
grep "^ " | sed -e "s/\//./g;s/(.*//g;s/^ //g" > "$tmpdir"/lognew
while read box; do mkdir -p "$HOME/.mail/$1/$box"; done <"$tmpdir"/lognew ;}
@@ -27,15 +27,15 @@ changePassword() { \
gpgemail=$(dialog --no-cancel --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "That's not a valid email address. Please input the entire address." 10 60 3>&1 1>&2 2>&3 3>&1)
done
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)
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 "$muttdir"/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 ;}
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 $(grep "^accounts =" ~/.offlineimaprc | sed -e 's/accounts =\( \)//g;s/\(,\) /\n/g;'); do detectMailboxes $x; done && detectSuccess ;}
@@ -183,8 +183,8 @@ replacement="
s/\$login/$login/g;
/$delet/d"
# Gets the first unused shortcut number in the muttrc and puts it in $idnum.
dialog --title "Luke's mutt/offlineIMAP password wizard" --passwordbox "Enter the password for the \"$title\" account." 10 60 2> /tmp/$title
gpg2 -r $gpgemail --encrypt /tmp/$title || (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/$title
mv /tmp/$title.gpg "$muttdir"/credentials/
shred -u "/tmp/$title"
mv "/tmp/$title.gpg" "$muttdir"/credentials/
# Adding directory structure for cache.
mkdir -p "$muttdir"/accounts/$title/cache/bodies
mkdir -p "$muttdir/accounts/$title/cache/bodies"
# Creating the offlineimaprc if it doesn't exist already.
if [ ! -f ~/.offlineimaprc ]; then cp "$muttdir"/autoconf/offlineimap_header"$os" ~/.offlineimaprc; fi
sed -e "$replacement" "$muttdir"/autoconf/offlineimap_profile"$os" >> ~/.offlineimaprc
mkdir -p ~/.mail/$title
mkdir -p "$HOME/.mail/$title"
# Creating msmtprc if it doesn't exist already.
if [ ! -f ~/.msmtprc ]; then cp "$muttdir"/autoconf/msmtprc_header ~/.msmtprc; fi
sed -e "$replacement" "$muttdir"/autoconf/msmtprc_profile >> ~/.msmtprc
# Add the mutt profile.
sed -e "$replacement" "$muttdir"/autoconf/mutt_profile > "$muttdir"/accounts/$title.muttrc
sed -e "$replacement" "$muttdir"/autoconf/mutt_profile > "$muttdir/accounts/$title.muttrc"
dialog --title "Finalizing your account." --infobox "The account \"$title\" has been added. Now attempting to configure mail directories...
This may take several seconds..." 10 70
createMailboxes $title || (clear && exit)
detectMailboxes $title
dialog --title "Account added." --msgbox "Your "$fulladdr" account has been added. 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 ;}
createMailboxes "$title" || (clear && exit)
detectMailboxes "$title"
dialog --title "Account added." --msgbox "Your \"$fulladdr\" account has been added. 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 ;}
# This is run when a user chooses to add an account.
4) inventory && for i in $userchoices; do changePassword $i ; done;;
5) inventory && for i in $userchoices; do removeAccount $i ; done;;
4) inventory && for i in $userchoices; do changePassword "$i" ; done;;
5) inventory && for i in $userchoices; do removeAccount "$i" ; done;;
6) (dialog --defaultno --title "Wipe all custom neomutt/offlineIMAP settings?" --yesno "Would you like to wipe all of the mutt/offlineIMAP settings generated by the system?" 6 60 && wipe) ;;
7) clear && break ;;
*) echo "Unable to read response from dialog. Exiting." >&2; exit 2