Add on/off option to gpg_ssh

This commit is contained in:
Sam A. 2023-03-14 16:24:32 +01:00
parent ac2287dbfc
commit 3b25addae0
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA

View file

@ -28,7 +28,13 @@ get_ip() {
}
gpg_ssh() {
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
if [[ $1 == "on" ]]; then
export SSH_AUTH_SOCK_OLD="$SSH_AUTH_SOCK"
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
elif [[ $1 == "off" ]]; then
[[ -n $SSH_AUTH_SOCK_OLD ]] && export SSH_AUTH_SOCK="$SSH_AUTH_SOCK_OLD"
unset SSH_AUTH_SOCK_OLD
fi
}
http() {