[pass] [PATCH] Fix: allow pass to be a symlink to the real password-store.sh

Steffen Vogel post at steffenvogel.de
Fri Jul 24 09:58:57 CEST 2015


Hi Jason,

here's another approach which also fixes the same problem.
According to my understanding we dont need to canonicalize the full path.
Only the "real" directory of the password store scripts is needed.

My approach now uses readlink and dirname which both are available on OS X and Unixes..

Thanks

> Can you find a prettier way of doing this? This is a little bit ugly for my
> tastes. Generally I prefer to use "readlink -f" but this isn't available on
> OS X. Brew has it as greadlink though hmm...

---
 src/password-store.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index d535a74..b7caf33 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -185,7 +185,10 @@ tmpdir() {
 GETOPT="getopt"
 SHRED="shred -f -z"
 
-source "$(dirname "$0")/platform/$(uname | cut -d _ -f 1 | tr '[:upper:]' '[:lower:]').sh" 2>/dev/null # PLATFORM_FUNCTION_FILE
+PLATF="$(uname | cut -d _ -f 1 | tr '[:upper:]' '[:lower:]')"
+PLATF_DIR="$(dirname $(readlink "${BASH_SOURCE[0]}"))/platform/"
+
+source "$PLATF_DIR/$PLATF.sh" 2>/dev/null # PLATFORM_FUNCTION_FILE
 
 #
 # END platform definable
-- 
2.3.0



More information about the Password-Store mailing list