[pass] Making password-store portable: Solved at last! (OSX, FreeBSD, others...)

Jason A. Donenfeld Jason at zx2c4.com
Tue Sep 18 00:38:14 CEST 2012


Hi everyone,

Inspired by milki's "Consolidate command paths to bash variables"
patch [1], I've finally devised a decent way at dealing with
portability.

The password-store.sh script is still basically the same, and still
runs unmodified on GNU/Linux. The trivial changes made are that
instead of calling "gpg" or "getopt", we call "$GPG" and "$GETOPT",
and the secure temporary file logic has been moved into a function,
just like the clip() function. After GPG, GETOPT, tmpdir, and clip are
defined, there is a comment that looks like this:

# source /path/to/platform-specific/functions

Meanwhile, inside of src/, there's now a subfolder called platform/.
If the makefile discovers that src/platform/$(uname|tolowercase).sh
exists, then it copies it to LIBDIR (usually /usr/lib) as
password-store.platform.sh, and then replaces the aformentioned
comment with "source /usr/lib/password-store.platform.sh".

Currently, darwin.sh exists in src/platform/. To add more platforms,
all that's required is adding a freebsd.sh or solaris.sh, or whichever
platform.

milki: if you'd like to add a freebsd.sh, send it on over, and I can
give you proper commit access for maintaining it.

rupa: likewise, if you would like to maintain the current darwin.sh,
please let me know.

Here's the commit [2], if anyone has any suggestions or criticisms.

Jason

[1] http://lists.zx2c4.com/pipermail/password-store-zx2c4.com/2012-September/000061.html
[2] http://git.zx2c4.com/password-store/commit/?id=7ea239e376bbdf88e2a2c9eb2f77363eafa7a612



More information about the Password-Store mailing list