Browse Source

[gnupg] Add gpg-agent config to dotfiles

Colin Powell 15 giờ trước cách đây
mục cha
commit
700790645e
2 tập tin đã thay đổi với 27 bổ sung0 xóa
  1. 23 0
      bin/.bin/pinentry-wrapper
  2. 4 0
      gnupg/.gnupg/gpg-agent.conf

+ 23 - 0
bin/.bin/pinentry-wrapper

@@ -0,0 +1,23 @@
+#!/bin/sh
+# Pick a working pinentry for this machine/session.
+# Preference order: Emacs pinentry (if in Emacs), mac GUI pinentry, GTK/QT, curses.
+
+# If you use pinentry-emacs and want it when Emacs is running:
+if command -v pinentry-emacs >/dev/null 2>&1; then
+  exec pinentry-emacs "$@"
+fi
+
+# macOS GUI pinentry (Homebrew paths)
+if [ "$(uname -s)" = "Darwin" ]; then
+  if [ -x /opt/homebrew/bin/pinentry-mac ]; then exec /opt/homebrew/bin/pinentry-mac "$@"; fi
+  if [ -x /usr/local/bin/pinentry-mac ]; then exec /usr/local/bin/pinentry-mac "$@"; fi
+fi
+
+# Common Linux GUI pinentries
+if command -v pinentry-gnome3 >/dev/null 2>&1; then exec pinentry-gnome3 "$@"; fi
+if command -v pinentry-gtk-2  >/dev/null 2>&1; then exec pinentry-gtk-2 "$@"; fi
+if command -v pinentry-qt    >/dev/null 2>&1; then exec pinentry-qt "$@"; fi
+
+# Fallback (may fail in dumb/no-tty contexts)
+if command -v pinentry-curses >/dev/null 2>&1; then exec pinentry-curses "$@"; fi
+exec pinentry "$@"

+ 4 - 0
gnupg/.gnupg/gpg-agent.conf

@@ -0,0 +1,4 @@
+default-cache-ttl 3456000
+max-cache-ttl 3456000
+enable-ssh-support
+pinentry-program ~/.bin/pinentry-wrapper