24 lines
454 B
Bash
24 lines
454 B
Bash
|
|
if [[ $SSH_CLIENT != "" ]]; then
|
|
|
|
mkfifo "/tmp/ssh_test.$$"
|
|
exec 3<> "/tmp/ssh_test.$$"
|
|
unlink "/tmp/ssh_test.$$"
|
|
|
|
ps -o ppid= -p $$ | sed 's/ //g' 1>&3
|
|
|
|
read -u3 ppid
|
|
|
|
if ls /tmp | grep ssh- 1> /dev/null 2>&1; then
|
|
for dir in /tmp/ssh-*; do
|
|
if [[ -e $dir/agent.$ppid ]]; then
|
|
export SSH_AUTH_SOCK=$dir/agent.$ppid
|
|
fi
|
|
done
|
|
fi
|
|
else
|
|
|
|
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
|
|
|
fi
|