[pass] [PATCH] platform: find getopt in alternate osx locations

Jamie Couture jamie.couture at gmail.com
Tue Sep 30 15:35:19 CEST 2014


On Sun, Sep 28, 2014 at 07:54:31PM +0200, Allan Odgaard wrote:
> On 10 Sep 2014, at 3:39, Jamie Couture wrote:
> 
> >-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"
> 
> In bash && and || have equal precedence so the above should instead be:
> 
>     GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || { which port
> 2>/dev/null && echo /opt/local; } || echo /usr/local)/bin/getopt"

Ah yes.  I also noticed I wasn't completely silencing 'which' as
well; how about this fixup instead:


-- 8< --

diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh
index ce4bb29..d788129 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 || which port 2>/dev/null && echo /opt/local || echo /usr/local)/bin/getopt"
+GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || { which port >/dev/null 2>&1 && echo /opt/local; } || echo /usr/local)/bin/getopt"
 SHRED="srm -f -z"


More information about the Password-Store mailing list