From 3dec7889b06cd0b5a0d6c07574e7d9dfde9be4bc Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 17 Feb 2018 14:29:17 +0000 Subject: [PATCH] Use agent --- src/freedombone-utils-gpg | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/freedombone-utils-gpg b/src/freedombone-utils-gpg index 42e985e4..637986de 100755 --- a/src/freedombone-utils-gpg +++ b/src/freedombone-utils-gpg @@ -228,6 +228,9 @@ function gpg_agent_setup { echo 'GPG_TTY=$(tty)' >> /root/.bashrc echo 'export GPG_TTY' >> /root/.bashrc fi + if grep -q '# use-agent' /root/.gnupg/gpg.conf; then + sed -i 's|# use-agent|use-agent|g' /root/.gnupg/gpg.conf + fi if ! grep -q 'use-agent' /root/.gnupg/gpg.conf; then echo 'use-agent' >> /root/.gnupg/gpg.conf fi @@ -240,6 +243,9 @@ function gpg_agent_setup { if ! grep -q 'allow-loopback-pinentry' /root/.gnupg/gpg-agent.conf; then echo 'allow-loopback-pinentry' >> /root/.gnupg/gpg-agent.conf fi + if [ -f /root/.gnupg/S.dirmngr ]; then + rm /root/.gnupg/S.dirmngr + fi echo RELOADAGENT | gpg-connect-agent else if ! grep -q 'GPG_TTY' /home/$gpg_username/.bashrc; then @@ -248,6 +254,9 @@ function gpg_agent_setup { echo 'export GPG_TTY' >> /home/$gpg_username/.bashrc chown $gpg_username:$gpg_username /home/$gpg_username/.bashrc fi + if grep -q '# use-agent' /home/$gpg_username/.gnupg/gpg.conf; then + sed -i 's|# use-agent|use-agent|g' /home/$gpg_username/.gnupg/gpg.conf + fi if ! grep -q 'use-agent' /home/$gpg_username/.gnupg/gpg.conf; then echo 'use-agent' >> /home/$gpg_username/.gnupg/gpg.conf fi @@ -260,6 +269,9 @@ function gpg_agent_setup { if ! grep -q 'allow-loopback-pinentry' /home/$gpg_username/.gnupg/gpg-agent.conf; then echo 'allow-loopback-pinentry' >> /home/$gpg_username/.gnupg/gpg-agent.conf fi + if [ -f /home/$gpg_username/.gnupg/S.dirmngr ]; then + rm /home/$gpg_username/.gnupg/S.dirmngr + fi if [[ "$gpg_username" != "$USER" ]]; then su -c "echo RELOADAGENT | gpg-connect-agent" - $gpg_username else