From 05a219587336d51203196f5f809d1c5d9d93af7c Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 22 Sep 2012 19:47:55 +0200 Subject: Allow git repo to be elsewhere via env var. --- man/pass.1 | 29 ++++++++++++++++++++++------- src/password-store.sh | 4 ++-- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/man/pass.1 b/man/pass.1 index d00363b..5a8a32b 100644 --- a/man/pass.1 +++ b/man/pass.1 @@ -19,8 +19,7 @@ pass - stores, retrieves, generates, and synchronizes passwords securely is a very simple password store that keeps passwords inside .BR gpg (1) encrypted files inside a simple directory tree residing at -.IR $HOME/.password-store , -or the environment variable \fBPASSWORD_STORE_DIR\fP if it is set. +.IR ~/.password-store . The .B pass utility provides a series of commands for manipulating the password store, @@ -43,8 +42,7 @@ extended description using \fBinit\fP and The \fBinit\fP command must be run before other commands in order to initialize the password store with the correct gpg key id. Passwords are encrypting using -the gpg key set with \fBinit\fP, unless the \fBPASSWORD_STORE_KEY\fP environment -variable is set to an alternative key id. +the gpg key set with \fBinit\fP. There is a corresponding bash completion script for use with tab completing password names in @@ -318,11 +316,28 @@ To kexec.com:pass-store .TP .B ~/.password-store -The password storage directory. +The default password storage directory. .TP .B ~/.password-store/.gpg-id -Contains the gpg key identification used for encryption and decryption. This should -be set using the \fBinit\fP command. +Contains the default gpg key identification used for encryption and decryption. +This should be set using the \fBinit\fP command. + +.SH ENVIRONMENT VARIABLES + +.TP +.I PASSWORD_STORE_DIR +Overrides the default password storage directory. +.TP +.I PASSWORD_STORE_KEY +Overrides the default gpg key identification set by \fBinit\fP. +.TP +.I PASSWORD_STORE_GIT +Overrides the default root of the git repository, which is helpful if +\fIPASSWORD_STORE_DIR\fP is temporarily set to a sub-directory of the default +password store. +.TP +.I EDITOR +The location of the text editor used by \fBedit\fP. .SH SEE ALSO .BR gpg (1), diff --git a/src/password-store.sh b/src/password-store.sh index 21f8fe4..b28e408 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -7,11 +7,11 @@ umask 077 PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}" ID="$PREFIX/.gpg-id" -GIT_DIR="$PREFIX/.git" +GIT_DIR="${PASSWORD_STORE_GIT:-$PREFIX}/.git" GPG_OPTS="--quiet --yes --batch" export GIT_DIR -export GIT_WORK_TREE="$PREFIX" +export GIT_WORK_TREE="${PASSWORD_STORE_GIT:-$PREFIX}" version() { cat <<_EOF -- cgit v1.2.3