]> git.madduck.net Git - etc/pass.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

add wrapper for passphrase preseeding
authormartin f. krafft <madduck@madduck.net>
Fri, 8 Dec 2023 13:06:01 +0000 (14:06 +0100)
committermartin f. krafft <madduck@madduck.net>
Fri, 8 Dec 2023 13:06:01 +0000 (14:06 +0100)
.bin/pass [new file with mode: 0755]
.gitignore.d/pass

diff --git a/.bin/pass b/.bin/pass
new file mode 100755 (executable)
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 "$@"
index 61a21a140e08853ebe8190285850e0c3fe80f197..6d0a4686d27f057b97660e55045b04438e051b94 100644 (file)
@@ -1,5 +1,6 @@
 *
 !/.bin/genpw-editor
+!/.bin/pass
 !/.gitignore.d/pass
 !/.zsh/aliases/genpw
 !/.zsh/aliases/getpw