commit 7b62edde2700f68278029d896397b951db284671
parent 9e1dc0e92d6b439e12a9ddd50276b46f2b4cba6e
Author: Sören Tempel <git+mail@soeren-tempel.net>
Date: Sun, 30 Nov 2014 12:35:23 +0100
Be more compatible with pass(1)
By reading the gpg-id file as well. However, pass(1) supports multiple
gpg-id files maybe we should consider reading all of them.
To increase compatibility further we could also use the same
environment variable names as pass(1):
TPM_STORE_DIR -> PASSWORD_STORE_DIR
TPM_STORE_KEY -> PASSWORD_STORE_KEY
Diffstat:
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/README.pod b/README.pod
@@ -34,9 +34,13 @@ GPG key to encrypt files with (default: self).
=over 4
-=item ~/.password-store
+=item $TPM_STORE_DIR
-The default storage directory.
+The storage directory.
+
+=item $TPM_STORE_DIR/.gpg-id
+
+Provided for compatiblity with pass(1). Overwrites $TPM_STORE_KEY.
=back
diff --git a/tpm b/tpm
@@ -9,6 +9,10 @@ umask 077
GPG_OPTS="--quiet --yes --batch"
STORE_DIR="${TPM_STORE_DIR:-${HOME}/.password-store}"
+if [[ -r "${STORE_DIR}/.gpg-id" ]]; then
+ read -r TPM_STORE_KEY < "${STORE_DIR}/.gpg-id"
+fi
+
if [[ -z "${TPM_STORE_KEY}" ]]; then
GPG_OPTS="${GPG_OPTS} --default-recipient-self"
else