summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-12-12 18:13:57 +0100
committerAhmed Abdelhalim <[email protected]>2025-12-12 18:13:57 +0100
commit58ae6ebbf455e64b430a6c62fa45d3c674829250 (patch)
treee67d3f2e29092294c81b0be508d4c54a158a5719
parenta0045c2bf54524762733895d9e36354444f20a1a (diff)
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
-rw-r--r--.gitignore1
-rw-r--r--.gnupg/gpg-agent.conf.template (renamed from .gnupg/gpg-agent.conf)2
-rw-r--r--README.md11
3 files changed, 9 insertions, 5 deletions
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.template
index 6d38770..4d52149 100644
--- a/.gnupg/gpg-agent.conf
+++ b/.gnupg/gpg-agent.conf.template
@@ -1,4 +1,4 @@
-pinentry-program /usr/local/bin/pinentry-wrapper
+pinentry-program ${HOME}/.local/bin/pinentry-wrapper
default-cache-ttl 3600
default-cache-ttl-ssh 3600
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 [email protected]:~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: