jaromail

a commandline tool to easily and privately handle your e-mail
git clone git://parazyd.org/jaromail.git
Log | Files | Refs | Submodules | README

commit fff5fc4be3da3d8037e20ce594ec774349594036
parent 17ea5c5d83f998f2e2e64b333a6a3f355414335e
Author: Jaromil <jaromil@dyne.org>
Date:   Tue, 17 Jan 2017 18:29:01 +0100

fixes to keyring selection

added explicit selection via JARO_KEYRING env var

Diffstat:
Msrc/jaro | 64+++++++++++++++++++++++++++++++++++++++++++++-------------------
1 file changed, 45 insertions(+), 19 deletions(-)

diff --git a/src/jaro b/src/jaro @@ -353,26 +353,52 @@ check_bin() { func "Mutt binary: `command -v mutt`" func "Notmuch binary: `command -v notmuch`" func "Alot binary: `command -v alot`" + func "Keyring set: $JARO_KEYRING" + if [[ "$JARO_KEYRING" == "" ]]; then + # check for pass, else fallback + if isfound pass; then + act "keyring in use: pass (auto-detected)" + export PASSWORD_STORE_DIR=$HOME/.password-store + [[ -d $PASSWORD_STORE_DIR ]] || { + error "the 'pass' keyring is found but not initialised" + error "run 'pass init your-gpg-id' or uninstall it to use other keyrings" + } + + PASS=1 + + # check if secret-tool is present else fallback to gnome-keyring + elif isfound secret-tool; then + act "keyring in use: secret-tool (auto-detected)" + SECRET_TOOL=1 + else + ps ax | grep '[g]nome-keyring-daemon' > /dev/null + [[ $? = 0 ]] && { + act "keyring in use: gnome-keyring (auto-detected)" + GNOMEKEY=1 + } + fi + + else # JARO_KEYRING defined + + case $JARO_KEYRING in + pass) + act "keyring in use: pass (set in JARO_KEYRING)" + export PASSWORD_STORE_DIR=$HOME/.password-store + [[ -d $PASSWORD_STORE_DIR ]] || { + error "the 'pass' keyring is found but not initialised" + error "run 'pass init your-gpg-id'" + } + PASS=1 ;; + secret-tool) + act "keyring in use: secret-tool (set in JARO_KEYRING)" + SECRET_TOOL=1 ;; + gnome-keyring) + act "keyring in use: gnome-keyring (set in JARO_KEYRING)" + GNOMEKEY=1 ;; + esac + + fi - # check for pass, else fallback - if isfound pass; then - export PASSWORD_STORE_DIR=$MAILDIRS/.pass - [[ -d $PASSWORD_STORE_DIR ]] || { - error "the 'pass' keyring is found but not initialised" - error "run 'pass init your-gpg-id' or uninstall it to use other keyrings" - return 1 } - PASS==1 - - # check if secret-tool is present else fallback to gnome-keyring - elif isfound secret-tool; then - SECRET_TOOL=1 - else - ps ax | grep '[g]nome-keyring-daemon' > /dev/null - [[ $? = 0 ]] && { - act "using gnome-keyring to store secrets" - GNOMEKEY=1 - } - fi return 0 }