From: martin f. krafft Date: Fri, 8 Dec 2023 13:06:01 +0000 (+0100) Subject: add wrapper for passphrase preseeding X-Git-Url: https://git.madduck.net/etc/pass.git/commitdiff_plain/18a8cbec3b4f7bcd41ab0136e79099294c3d9dc3?hp=7a4b1e3a23607da3e669529c6640284ad481d068 add wrapper for passphrase preseeding --- diff --git a/.bin/pass b/.bin/pass new file mode 100755 index 0000000..c15a218 --- /dev/null +++ b/.bin/pass @@ -0,0 +1,31 @@ +#!/bin/sh +set -eu + +real_pass() { + local OLDIFS; OLDIFS="$IFS" + IFS=: + local SELF; SELF="$(realpath $0)" + local CMD; CMD="$(basename "$SELF")" + local ret; ret=127 + for p in $PATH; do + case "$SELF" in ($p/*) continue;; esac + if [ -x "$p/$CMD" ]; then + ${exec:-} "$p/$CMD" "$@" + ret=$? + break + fi + done + IFS="$OLDIFS" + return $ret +} + +KEYGRIP=083F1106EEDD459ED7761C825FDB3E60FA7D8F3F + +gpg-connect-agent "keyinfo $KEYGRIP" /bye | while read a b c d e f g h; do + if [ "$g" != 1 ]; then + real_pass .meta/pass-key | /usr/lib/gnupg/gpg-preset-passphrase -c $KEYGRIP + fi + break +done + +exec=exec real_pass "$@" diff --git a/.gitignore.d/pass b/.gitignore.d/pass index 61a21a1..6d0a468 100644 --- a/.gitignore.d/pass +++ b/.gitignore.d/pass @@ -1,5 +1,6 @@ * !/.bin/genpw-editor +!/.bin/pass !/.gitignore.d/pass !/.zsh/aliases/genpw !/.zsh/aliases/getpw