From 58ae6ebbf455e64b430a6c62fa45d3c674829250 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Fri, 12 Dec 2025 18:13:57 +0100 Subject: Workaround gpg-agent.conf doesn't allow relative path to be called gpg-agent.conf doesn't permit the usage of $PATH or $HOME in the pinentry-program (https://dev.gnupg.org/T4588) So the work around is to template that file and expand the path correctly using the setup script (which is also copying the file correctly) This is favored over the use of /usr/local/bin because it doesn't need privileged execution of the setup script --- .gitignore | 1 + .gnupg/gpg-agent.conf | 7 ------- .gnupg/gpg-agent.conf.template | 7 +++++++ README.md | 11 +++++++---- 4 files changed, 15 insertions(+), 11 deletions(-) delete mode 100644 .gnupg/gpg-agent.conf create mode 100644 .gnupg/gpg-agent.conf.template diff --git a/.gitignore b/.gitignore index 55acb54..6f28434 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +.gnupg/gpg-agent.conf Brewfile.lock.json diff --git a/.gnupg/gpg-agent.conf b/.gnupg/gpg-agent.conf deleted file mode 100644 index 6d38770..0000000 --- a/.gnupg/gpg-agent.conf +++ /dev/null @@ -1,7 +0,0 @@ -pinentry-program /usr/local/bin/pinentry-wrapper - -default-cache-ttl 3600 -default-cache-ttl-ssh 3600 -max-cache-ttl 3600 -max-cache-ttl-ssh 3600 -enable-ssh-support diff --git a/.gnupg/gpg-agent.conf.template b/.gnupg/gpg-agent.conf.template new file mode 100644 index 0000000..4d52149 --- /dev/null +++ b/.gnupg/gpg-agent.conf.template @@ -0,0 +1,7 @@ +pinentry-program ${HOME}/.local/bin/pinentry-wrapper + +default-cache-ttl 3600 +default-cache-ttl-ssh 3600 +max-cache-ttl 3600 +max-cache-ttl-ssh 3600 +enable-ssh-support diff --git a/README.md b/README.md index feb95d3..fcc161a 100644 --- a/README.md +++ b/README.md @@ -10,15 +10,18 @@ ### Essentials ```bash -git clone https://git.sr.ht/~a14m/.rc -sudo ln -sf ~/.rc/.gnupg/pinentry-wrapper /usr/local/bin/pinentry-wrapper +git clone https://git.sr.ht/~a14m/.rc ~/.rc + cd ~/.rc stow --no-folding --adopt . git restore . git remote set-url origin git@git.sr.ht:~a14m/.rc + +ln -sf ~/.rc/.gnupg/pinentry-wrapper ~/.local/bin/pinentry-wrapper +envsubst < ~/.gnupg/gpg-agent.conf.template > ~/.gnupg/gpg-agent.conf chmod 0700 ~/.gnupg -gpgconf --kill gpg-agent -gpg-connect-agent /bye +gpgconf --kill gpg-agent 2>/dev/null || true +gpg-connect-agent /bye 2>/dev/null || true ``` Extra configurations for different distro families: -- cgit v1.2.3