summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2017-04-18 06:58:55 (GMT)
committer Jaromil <jaromil@dyne.org>2017-04-18 06:58:55 (GMT)
commit21d2c808587776b6c9c6b5357c79a3e43c8593c7 (patch)
treec64d101b34a4544e27640d55878491bb1ce29201
parent1fd83c19a3b709e0132231d2e0b9337ad7b3c239 (diff)
password-store moved in $MAILDIRS
configurable via $JARO_PASSWORD_STORE_DIR env var
-rwxr-xr-xsrc/jaro10
-rwxr-xr-xsrc/zlibs/accounts2
-rwxr-xr-xsrc/zlibs/keyring10
3 files changed, 13 insertions, 9 deletions
diff --git a/src/jaro b/src/jaro
index 7fc06bd..60f1ce7 100755
--- a/src/jaro
+++ b/src/jaro
@@ -102,10 +102,11 @@ DRYRUN=${DRYRUN:-0}
CALLMUTT=${CALLMUTT:-1}
# use gnome-keyring for passwords on GNU systems
-vars+=(PASS GNOMEKEY SECRET_TOOL)
+vars+=(PASS GNOMEKEY SECRET_TOOL PASSWORD_STORE_DIR)
PASS=${PASS:-0}
GNOMEKEY=${GNOMEKEY:-0}
SECRET_TOOL=${SECRET_TOOL:-0}
+PASSWORD_STORE_DIR=${JARO_PASSWORD_STORE_DIR:-$MAILDIRS/.password-store}
# global variables for binaries called
vars+=(rm mkdir mutt SQL OS)
@@ -346,11 +347,8 @@ check_bin() {
# check for pass, else fallback
if isfound pass; then
act "keyring in use: pass (auto-detected)"
- export PASSWORD_STORE_DIR=${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"
- }
+ [[ -d $PASSWORD_STORE_DIR ]] ||
+ warning "the 'pass' keyring is found but not initialised"
PASS=1
diff --git a/src/zlibs/accounts b/src/zlibs/accounts
index 433fa1f..946f9ce 100755
--- a/src/zlibs/accounts
+++ b/src/zlibs/accounts
@@ -31,7 +31,7 @@ read_account() {
host login transport auth cert options folders exclude
# parse arguments
- { test "$account" = "" } && { account="default" }
+ [[ "$account" = "" ]] && account="default"
# find the account
func "read_account looking for $account"
diff --git a/src/zlibs/keyring b/src/zlibs/keyring
index 9430c70..650fccb 100755
--- a/src/zlibs/keyring
+++ b/src/zlibs/keyring
@@ -21,6 +21,12 @@
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# pass wrapper to set all env
+_pass() {
+ fn pass $*
+ PASSWORD_STORE_DIR=$PASSWORD_STORE_DIR pass $*
+}
+
# we use pinentry
# comes from gpg project and is secure
# it also conveniently uses the right toolkit
@@ -65,7 +71,7 @@ ask_password() {
GNU)
if [[ $PASS = 1 ]]; then
act "looking for password in password-store"
- password=`pass show ${login}`
+ password=`_pass show ${login}`
[[ $? = 0 ]] && act "password found in password-store"
elif [[ $SECRET_TOOL = 1 ]]; then
act "looking for password in secret-tool"
@@ -134,7 +140,7 @@ new_password() {
# USE PASS
if [[ $PASS = 1 ]]; then
act "using pass for password-store"
- print "$password\n" | pass insert -e ${login}
+ print "$password\n" | _pass insert -e ${login}
if [[ $? = 0 ]]; then
notice "New password saved in password-store"
else