dropbear: Add back scp
[termux-packages] / packages / openssh / source-ssh-agent.sh
CommitLineData
6eeaf551 1#!/bin/sh
2f5fc713 2# source-ssh-agent: Script to source for ssh-agent to work.
59f0d218
FF
3
4# Check if accidentaly executed instead of sourced:
5if echo "$0" | grep -q source-ssh-agent; then
2f5fc713
FF
6 echo "source-ssh-agent: Do not execute directly - source me instead!"
7 exit 1
59f0d218
FF
8fi
9
2f5fc713 10export SSH_AUTH_SOCK=$PREFIX/tmp/ssh-agent
59f0d218
FF
11
12start_agent () {
2f5fc713
FF
13 rm -f $SSH_AUTH_SOCK
14 ssh-agent -a $SSH_AUTH_SOCK > /dev/null
15 ssh-add
59f0d218
FF
16}
17
2f5fc713
FF
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
59f0d218 25fi