Fix building tsocks for 32 bit architectures
[termux-packages] / packages / openssh / source-ssh-agent.sh
... / ...
CommitLineData
1#!/data/data/com.termux/files/usr/bin/sh
2# source-ssh-agent: Script to source for ssh-agent to work.
3
4# Check if accidentaly executed instead of sourced:
5if echo "$0" | grep -q source-ssh-agent; then
6 echo "source-ssh-agent: Do not execute directly - source me instead!"
7 exit 1
8fi
9
10export SSH_AUTH_SOCK=$PREFIX/tmp/ssh-agent
11
12start_agent () {
13 rm -f $SSH_AUTH_SOCK
14 ssh-agent -a $SSH_AUTH_SOCK > /dev/null
15 ssh-add
16}
17
18MESSAGE=`ssh-add -L 2>&1`
19if [ "$MESSAGE" = 'Could not open a connection to your authentication agent.' -o \
20 "$MESSAGE" = 'Error connecting to agent: Connection refused' -o \
21 "$MESSAGE" = 'Error connecting to agent: No such file or directory' ]; then
22 start_agent
23elif [ "$MESSAGE" = "The agent has no identities." ]; then
24 ssh-add
25fi