summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2017-01-17 17:29:01 (GMT)
committer Jaromil <jaromil@dyne.org>2017-01-17 17:29:01 (GMT)
commitfff5fc4be3da3d8037e20ce594ec774349594036 (patch)
tree3ea61bfb02ee285de42e5dfb3bf70846acfba572
parent17ea5c5d83f998f2e2e64b333a6a3f355414335e (diff)
fixes to keyring selection
added explicit selection via JARO_KEYRING env var
-rwxr-xr-xsrc/jaro64
1 files changed, 45 insertions, 19 deletions
diff --git a/src/jaro b/src/jaro
index 2ee6a28..192a241 100755
--- 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
}