Speedup pass on macOS and brew

Julien Laffaye jlaffaye at freebsd.org
Wed Oct 24 14:54:12 CEST 2018


Well, on my installation I have:

brew --prefix gnu-getopt
/Users/jlaffaye/homebrew/opt/gnu-getopt

So I think we should still use brew --prefix but only if it is not found on
standard locations.

I also want to suggest adding an environment variable to specify the
location to not run this discovery step, so people in my situation can
avoid calling brew each time they call pass.

On Tue, Oct 23, 2018 at 6:06 PM <pass-maillinglist at artursterz.de> wrote:

>
> The only thing that annoys me with the code above is that we always
> execute brew, though technically the overhead is the same or less than
> guarding it with a command -v brew statement (less for people who have
> the executable).
>
>
> Okay, I see your point. Maybe we can ditch this all together? As far as I
> can see from the documentation (https://docs.brew.sh/Installation), there
> are about no chances that the brew prefix is not /usr/local.
> It requires similar steps as for macports (
> https://www.macports.org/install.php) to install brew somewhere else then
> in its default path. But for macports, pass assumes the default path
> anyway, so we could do this for brew, could we?
> Additionally, this is a somewhat failsafe version. If neither of the three
> options is available the user will have trouble using pass anyways, so the
> test -x check should be enough.
>
> A patch based on Allans suggestions is appended.
>
>
> diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh
> index 342ecce..a984bec 100644
> --- a/src/platform/darwin.sh
> +++ b/src/platform/darwin.sh
> @@ -43,6 +43,10 @@ qrcode() {
>         fi
>  }
>
> -GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || { which port
> &>/dev/null && echo /opt/local; } || echo /usr/local)/bin/getopt"
> +for prefix in /usr/local/opt/gnu-getopt /opt/local /usr/local; do
> +    GETOPT="${prefix}/bin/getopt"
> +    test -x "$GETOPT" && break
> +done
> +
>  SHRED="srm -f -z"
>  BASE64="openssl base64"
> _______________________________________________
> Password-Store mailing list
> Password-Store at lists.zx2c4.com
> https://lists.zx2c4.com/mailman/listinfo/password-store
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20181024/a5cdea1e/attachment.html>


More information about the Password-Store mailing list