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 'GPG_TTY=$(tty)' >> /root/.bashrc
|
||||||
echo 'export GPG_TTY' >> /root/.bashrc
|
echo 'export GPG_TTY' >> /root/.bashrc
|
||||||
fi
|
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
|
if ! grep -q 'use-agent' /root/.gnupg/gpg.conf; then
|
||||||
echo 'use-agent' >> /root/.gnupg/gpg.conf
|
echo 'use-agent' >> /root/.gnupg/gpg.conf
|
||||||
fi
|
fi
|
||||||
|
@ -240,6 +243,9 @@ function gpg_agent_setup {
|
||||||
if ! grep -q 'allow-loopback-pinentry' /root/.gnupg/gpg-agent.conf; then
|
if ! grep -q 'allow-loopback-pinentry' /root/.gnupg/gpg-agent.conf; then
|
||||||
echo 'allow-loopback-pinentry' >> /root/.gnupg/gpg-agent.conf
|
echo 'allow-loopback-pinentry' >> /root/.gnupg/gpg-agent.conf
|
||||||
fi
|
fi
|
||||||
|
if [ -f /root/.gnupg/S.dirmngr ]; then
|
||||||
|
rm /root/.gnupg/S.dirmngr
|
||||||
|
fi
|
||||||
echo RELOADAGENT | gpg-connect-agent
|
echo RELOADAGENT | gpg-connect-agent
|
||||||
else
|
else
|
||||||
if ! grep -q 'GPG_TTY' /home/$gpg_username/.bashrc; then
|
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
|
echo 'export GPG_TTY' >> /home/$gpg_username/.bashrc
|
||||||
chown $gpg_username:$gpg_username /home/$gpg_username/.bashrc
|
chown $gpg_username:$gpg_username /home/$gpg_username/.bashrc
|
||||||
fi
|
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
|
if ! grep -q 'use-agent' /home/$gpg_username/.gnupg/gpg.conf; then
|
||||||
echo 'use-agent' >> /home/$gpg_username/.gnupg/gpg.conf
|
echo 'use-agent' >> /home/$gpg_username/.gnupg/gpg.conf
|
||||||
fi
|
fi
|
||||||
|
@ -260,6 +269,9 @@ function gpg_agent_setup {
|
||||||
if ! grep -q 'allow-loopback-pinentry' /home/$gpg_username/.gnupg/gpg-agent.conf; then
|
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
|
echo 'allow-loopback-pinentry' >> /home/$gpg_username/.gnupg/gpg-agent.conf
|
||||||
fi
|
fi
|
||||||
|
if [ -f /home/$gpg_username/.gnupg/S.dirmngr ]; then
|
||||||
|
rm /home/$gpg_username/.gnupg/S.dirmngr
|
||||||
|
fi
|
||||||
if [[ "$gpg_username" != "$USER" ]]; then
|
if [[ "$gpg_username" != "$USER" ]]; then
|
||||||
su -c "echo RELOADAGENT | gpg-connect-agent" - $gpg_username
|
su -c "echo RELOADAGENT | gpg-connect-agent" - $gpg_username
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue