[pass] [PATCH] Team pass: enable multiple keys and per directory
Josh Cartwright
joshc at eso.teric.us
Wed Mar 19 23:36:29 CET 2014
On Wed, Mar 19, 2014 at 03:16:28PM -0700, Brian Shore wrote:
> On Wed, Mar 19, 2014 at 11:35 AM, Jason A. Donenfeld <Jason at zx2c4.com> wrote:
> > On Wed, Mar 19, 2014 at 12:31 PM, Brian Shore <brian at networkredux.com>
> > wrote:
> >> Also, I don't see any realpath(1) on RHEL6, so this could introduce
> >> some compatibility issues.
> >
> > Thanks for pointing this out! I'd like to use "readlink -f", but this isn't
> > available on the BSDs. Any suggestion for something broadly supported?
>
> RHEL is probably the only "large" Linux distribution that doesn't have
> it yet (realpath(1) was added in v8.15).
>
> FreeBSD has a realpath(1) but OS X doesn't. OSX can install gnu
> coreutils to provide greadlink.
>
> I think there are enough variations to justify adding this as a shell
> function in the platform-specific code. Each platform can define
> "real_path" and implement it as desired (possibly even in pure sh).
>
> I would aim for the syntax of realpath(1) without parameters (because
> they differ between platforms).
>
> realpath FILE...
>
> If using shell functions as a fall-back, this page seems a good place to start:
> https://sites.google.com/site/jdisnard/realpath
I don't think any of this realpath nonsense is necessary at all. Instead of
tacking '/..' to the end of current, just use a parameter expansion to strip
off '/*'. Since you know that 'current' will always have "$PREFIX" as a
prefix, you're guaranteed to terminate.
current="$PREFIX/$1"
while true; do
[[ "$(realpath -q "$current")" == "$(realpath -q "$PREFIX")" ]] && break
[[ -f "$current/.gpg-id" ]] && break
current="$current/.."
done
becomes:
current="$PREFIX/$1"
while [[ $current != "$PREFIX" ]]; do
if [[ -f $current/.gpg-id ]]; then
break
fi
current=${current%/*}
done
Josh
More information about the Password-Store
mailing list