summaryrefslogtreecommitdiff
path: root/bin/mw
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2019-04-22 15:12:03 -0400
committerLuke Smith <luke@lukesmith.xyz>2019-04-22 15:12:03 -0400
commit1a20e68b4cf83bd8db586eb551c75de95d0778c6 (patch)
tree44636c1d93e27e8a734ab98a40d2ec23399982fd /bin/mw
parent8eaf72227e3d6d91d8f4115bc4734a5803a4030f (diff)
init rm'd and certs mv'd
Diffstat (limited to 'bin/mw')
-rwxr-xr-xbin/mw14
1 files changed, 4 insertions, 10 deletions
diff --git a/bin/mw b/bin/mw
index 70a1d31..507981e 100755
--- 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