su only needed for root

This commit is contained in:
Bob Mottram 2018-02-05 12:59:28 +00:00
parent 66b8734b0c
commit 0da7162f90
1 changed files with 5 additions and 1 deletions

View File

@ -252,7 +252,11 @@ 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 [[ "$USER" == 'root' ]]; then
su -c "echo RELOADAGENT | gpg-connect-agent" - $gpg_username
else
echo RELOADAGENT | gpg-connect-agent
fi
fi
}