pinentry-wrapper 972 B

1234567891011121314151617181920212223
  1. #!/bin/sh
  2. # Pick a working pinentry for this machine/session.
  3. # Preference order: Emacs pinentry (if in Emacs), mac GUI pinentry, GTK/QT, curses.
  4. # If you use pinentry-emacs and want it when Emacs is running:
  5. if command -v pinentry-emacs >/dev/null 2>&1; then
  6. exec pinentry-emacs "$@"
  7. fi
  8. # macOS GUI pinentry (Homebrew paths)
  9. if [ "$(uname -s)" = "Darwin" ]; then
  10. if [ -x /opt/homebrew/bin/pinentry-mac ]; then exec /opt/homebrew/bin/pinentry-mac "$@"; fi
  11. if [ -x /usr/local/bin/pinentry-mac ]; then exec /usr/local/bin/pinentry-mac "$@"; fi
  12. fi
  13. # Common Linux GUI pinentries
  14. if command -v pinentry-gnome3 >/dev/null 2>&1; then exec pinentry-gnome3 "$@"; fi
  15. if command -v pinentry-gtk-2 >/dev/null 2>&1; then exec pinentry-gtk-2 "$@"; fi
  16. if command -v pinentry-qt >/dev/null 2>&1; then exec pinentry-qt "$@"; fi
  17. # Fallback (may fail in dumb/no-tty contexts)
  18. if command -v pinentry-curses >/dev/null 2>&1; then exec pinentry-curses "$@"; fi
  19. exec pinentry "$@"