Use agent
This commit is contained in:
parent
a34b251cb9
commit
3dec7889b0
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue