From 0916d4f1f7d35bb7420054fd148be500a678ea91 Mon Sep 17 00:00:00 2001
From: Jamie Couture <jamie.couture@gmail.com>
Date: Tue, 9 Sep 2014 21:39:01 -0400
Subject: platform: find getopt in alternate osx locations

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@gmail.com>
---
 src/platform/darwin.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/platform')

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"
-- 
cgit v1.2.3