From c554c0f926f469a38d8d5811a1898791e37f45b6 Mon Sep 17 00:00:00 2001 From: otlin100 Date: Sat, 27 Apr 2019 14:43:14 +0200 Subject: [PATCH] gopass as option added --- bin/mw | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bin/mw b/bin/mw index 17412b0..c7856da 100755 --- a/bin/mw +++ b/bin/mw @@ -1,6 +1,11 @@ #!/bin/sh -[ ! -f "$HOME/.password-store/.gpg-id" ] && printf "\`pass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`pass init \`.\\nIf you don't have a GPG public private key pair, run \`gpg --full-gen-key\` first.\\n" && exit +[ ! -f "$HOME/.password-store/.gpg-id" ] && printf "\`pass\` or \`gopass\` must be installed and initialized to encrypt passwords.\\nBe sure it is installed and run \`(go)pass init \`.\\nIf you don't have a GPG public private key pair, run \`gpg --full-gen-key\` first.\\n" && exit ! command -v mbsync >/dev/null && printf "\`mbsync\` must be installed to run mutt-wizard.\\n" && exit +pass="pass" +ifinstalled gopass +if [ $? -eq 0 ]; then + pass="gopass" +fi muttdir="$HOME/.config/mutt" # Main mutt config location accdir="$muttdir/accounts" # Directory for account settings maildir="$HOME/.local/share/mail" # Location of mail storage @@ -35,13 +40,12 @@ host $smtp port $sport from $fulladdr user $login -passwordeval \"pass mutt-wizard-$title\" -" +passwordeval \"$pass mutt-wizard-$title\"" mbsync_profile="IMAPStore $title-remote Host $imap Port $iport User $login -PassCmd \"pass mutt-wizard-$title\" +PassCmd \"$pass mutt-wizard-$title\" SSLType $ssltype CertificateFile $sslcert @@ -93,7 +97,7 @@ set folder = \"imaps://$fulladdr@$imap:$iport\" set imap_user = \"$login\" set header_cache = $cachedir/$title/headers set message_cachedir = $cachedir/$title/bodies -set imap_pass = \`pass mutt-wizard-$title\` +set imap_pass = \`$pass mutt-wizard-$title\` set mbox_type = Maildir set ssl_starttls = yes @@ -174,8 +178,8 @@ EOF echo "macro index,pager i$idnum 'source $accdir/$idnum-$title.muttrc!;' \"switch to $fulladdr\" # mw-autogenerated" >> "$muttrc" } -getpass() { while : ; do pass rm -f "mutt-wizard-$title" >/dev/null 2>&1 - pass insert "mutt-wizard-$title" && break; done ;} +getpass() { while : ; do $pass rm -f "mutt-wizard-$title" >/dev/null 2>&1 + $pass insert "mutt-wizard-$title" && break; done ;} formatShortcut() { \ while read -r data; do { echo "macro index,pager g$1 \"$data\" \"go to $2\" # mw-autogenerated"