init rm'd and certs mv'd

This commit is contained in:
Luke Smith 2019-04-22 15:12:03 -04:00
parent 8eaf72227e
commit 1a20e68b4c
No known key found for this signature in database
GPG Key ID: 4C50B54A911F6252
2 changed files with 5 additions and 10 deletions

14
bin/mw
View File

@ -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

View File

@ -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'