[pass] [PATCH] platform: find getopt in alternate osx locations
Jamie Couture
jamie.couture at gmail.com
Wed Sep 10 03:39:01 CEST 2014
Some users may use MacPorts instead of Homebrew. If brew fails to
return a prefix for getopt, check if the user has 'port' installed and
use the MacPort ${prefix} /opt/local.
Avoids an issue where pass terminates because getopt cannot be resolved
in the assumed location /usr/local/bin. Provide support to resolve
absolute path of getopt from a MacPorts installation.
Signed-off-by: Jamie Couture <jamie.couture at gmail.com>
---
Normally 'which' would be sufficient to resolve a command's location in
PATH, but we cannot use 'which' in this case. We do not want to resolve
/usr/bin/getopt if users have not installed MacPorts and getopt via
'port install getopt'.
After we determine a user has indeed installed MacPorts we also know the
path so we echo the default MacPorts install ${prefix}. There is no way
to use _port_ to help resolve the prefix, and most users will not use a
different path anyway. It is safe to assume /opt/local is a sane
prefix.
src/platform/darwin.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh
index e4519ed..ce4bb29 100644
--- a/src/platform/darwin.sh
+++ b/src/platform/darwin.sh
@@ -31,5 +31,5 @@ tmpdir() {
mount -t hfs -o noatime -o nobrowse "$DARWIN_RAMDISK_DEV" "$SECURE_TMPDIR" || die "Error: could not mount filesystem on ramdisk."
}
-GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || echo /usr/local)/bin/getopt"
+GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || which port 2>/dev/null && echo /opt/local || echo /usr/local)/bin/getopt"
SHRED="srm -f -z"
--
1.9.3
More information about the Password-Store
mailing list