Add more options to gpg-agent-spawn.sh, and remove GPG_TTY environment var.
authorW. Trevor King <wking@drexel.edu>
Sun, 25 Mar 2012 13:10:19 +0000 (09:10 -0400)
committerW. Trevor King <wking@drexel.edu>
Sun, 25 Mar 2012 13:10:19 +0000 (09:10 -0400)
The point of GPG_TTY is to tell gpg-agent what terminal to steal with
the pinentry program.  Because I like to keep my pinentry bound to the
terminal from which I ran gpg-agent-spawn.sh, it's easier to lock
gpg-agent into that terminal when I spawn it, and avoid reliance on
other terminals setting GPG_TTY appropriately.  This should also avoid
problems with GPGME, which seems to ignore GPG_TTY.

posts/gpg-agent/gpg-agent-spawn.sh

index 282f247047df6c1c14ce2b21eb55310e4c63718e..1df2b9f1983ae95b375f194c5600475a4a520687 100755 (executable)
@@ -2,8 +2,13 @@
 # source me!
 
 FILE="${HOME}/.gnupg/agent-info"
-GPG_TTY=$(tty)
-#gpg-agent --daemon --enable-ssh-support --write-env-file "${FILE}" --pinentry-program "/usr/bin/pinentry.py"
-gpg-agent --daemon --write-env-file "${FILE}" --pinentry-program "/usr/bin/pinentry.py"
-echo "export GPG_AGENT_INFO; GPG_TTY='${GPG_TTY}'; export GPG_TTY" >> "${FILE}"
+#todo: --enable-ssh-support
+gpg-agent --daemon \
+       --display "${DISPLAY}" \
+       --ttyname "$(tty)" \
+       --keep-tty \
+       --keep-display \
+       --write-env-file "${FILE}" \
+       --pinentry-program "/usr/bin/pinentry.py"
+echo "export GPG_AGENT_INFO" >> "${FILE}"
 source "${FILE}"