commit 1a20e68b4cf83bd8db586eb551c75de95d0778c6
parent 8eaf72227e3d6d91d8f4115bc4734a5803a4030f
Author: Luke Smith <luke@lukesmith.xyz>
Date: Mon, 22 Apr 2019 15:12:03 -0400
init rm'd and certs mv'd
Diffstat:
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/bin/mw b/bin/mw
@@ -10,6 +10,7 @@ muttshare="/usr/share/mutt-wizard"
mbsyncrc="$HOME/.mbsyncrc"
sslcert="/etc/ssl/certs/ca-certificates.crt"
mwconfig="/usr/share/mutt-wizard/mutt-wizard.muttrc"
+cachedir="$HOME/.cache/mutt-wizard"
muttrc="$muttdir/muttrc"
getaccounts() { accounts="$(find "$accdir" -type f | grep -o "[0-9]-.*.muttrc" | sed "s/-/: /g;s/\..*//" | sort -n)" ;}
@@ -65,7 +66,6 @@ alias me $realname <$fulladdr>
set folder = \"$maildir/$title\"
set header_cache = $accdir/$title/cache/headers
set message_cachedir = $accdir/$title/cache/bodies
-set certificate_file = $accdir/$title/certificates
set mbox_type = Maildir
bind index,pager gg noop
@@ -87,7 +87,6 @@ set folder = \"imaps://$fulladdr@$imap:$iport\"
set imap_user = \"$login\"
set header_cache = $accdir/$title/cache/headers
set message_cachedir = $accdir/$title/cache/bodies
-set certificate_file = $accdir/$title/certificates
set imap_pass = \`pass mutt-wizard-$title\`
set mbox_type = Maildir
@@ -155,11 +154,13 @@ EOF
for x in $(seq 1 9); do echo "$accounts" | grep "$x" || { export idnum="$x"; break ;}; done
getpass
getprofiles
- mkdir -p "$accdir/$title/cache/bodies" "$HOME/.config/msmtp"
+ mkdir -p "$muttdir" "$accdir/$title" "$cachedir/mutt-wizard/$title/cache/bodies" "$HOME/.config/msmtp"
[ ! -f "$HOME/.config/msmtp/config" ] && echo "$msmtp_header" > "$HOME/.config/msmtp/config"
echo "$msmtp_profile" >> "$HOME/.config/msmtp/config"
echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc"
echo "$mbsync_profile" >> "$mbsyncrc"
+ [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" && echo "muttrc created."
+ ! grep "^source.*mutt-wizard.muttrc" "$muttrc" >/dev/null && echo "source $mwconfig # mw-autogenerated" >> "$muttrc"
! grep "^source.*.muttrc" "$muttrc" | grep -v "$mwconfig" >/dev/null && echo "source $accdir/$idnum-$title.muttrc # mw-autogenerated" >> "$muttrc"
echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source $accdir/$idnum-$title.muttrc<enter><change-folder>!<enter>;<check-stats>' \"switch to $fulladdr\" # mw-autogenerated" >> "$muttrc"
}
@@ -258,11 +259,6 @@ asktype() { while : ; do
*) echo "Write out either yes or no completely. Try again or press ctrl-c to quit." ;;
esac; done ;}
-init() { mkdir -p "$muttdir" "$accdir"
- [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" && echo "muttrc created."
- ! grep "^source.*mutt-wizard.muttrc" "$muttrc" >/dev/null && echo "source $mwconfig # mw-autogenerated" >> "$muttrc" && echo "muttrc will now source mutt-wizard."
-}
-
purge() { confirm "delete all account data" || exit
rm -rf "$mbsyncrc" "$accdir" "$HOME/.config/msmtp"
echo "All configs and account settings have been purged."
@@ -270,7 +266,6 @@ purge() { confirm "delete all account data" || exit
}
case "$1" in
- init) init ;;
ls) list ;;
add) asktype && askinfo && tryconnect && finalize || delete ;;
pass) pick "change the password of" && getpass ;;
@@ -282,7 +277,6 @@ mw: mutt-wizard, auto-configure email accounts for mutt
including downloadable mail with \`isync\`.
Allowed options:
- init Run once and first to copy required files
add Add and autoconfigure an email address (9 max.)
ls List configured accounts
delete Pick an account to delete
diff --git a/mutt-wizard.muttrc b/mutt-wizard.muttrc
@@ -4,6 +4,7 @@
# In the interest of seamless updating, do not edit this file.
# If you want to override any settings, set those in your muttrc.
set mailcap_path = /usr/share/mutt-wizard/mailcap
+set certificate_file = ~/.cache/mutt-wizard/certificates
set date_format="%y/%m/%d %I:%M%p"
set index_format="%2C %zs %?X?A& ? %D %-15.15F %s (%-4.4c)"
set sort = 'reverse-date'