openssh: make using other agents easier (#7494)
This commit is contained in:
parent
2dbdbd23f3
commit
5e7a8ec9fe
@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine"
|
||||
TERMUX_PKG_LICENSE="BSD"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION=8.6p1
|
||||
TERMUX_PKG_REVISION=2
|
||||
TERMUX_PKG_REVISION=3
|
||||
TERMUX_PKG_SRCURL=https://fastly.cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${TERMUX_PKG_VERSION}.tar.gz
|
||||
TERMUX_PKG_SHA256=c3e6e4da1621762c850d03b47eed1e48dff4cc9608ddeb547202a234df8ed7ae
|
||||
TERMUX_PKG_DEPENDS="libandroid-support, ldns, openssl, libedit, termux-auth, krb5, zlib"
|
||||
|
@ -1,19 +1,24 @@
|
||||
#!/bin/sh
|
||||
# source-ssh-agent: Script to source for ssh-agent to work.
|
||||
|
||||
export SSH_AUTH_SOCK=$PREFIX/var/run/ssh-agent
|
||||
|
||||
start_agent() {
|
||||
rm -f $SSH_AUTH_SOCK
|
||||
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
|
||||
ssh-agent -a "$1" > /dev/null
|
||||
ssh-add
|
||||
}
|
||||
|
||||
# Allow overriding the start_agent function easily.
|
||||
if [ -r "${PREFIX}/etc/ssh/start_agent.sh" ]; then
|
||||
. "${PREFIX}/etc/ssh/start_agent.sh"
|
||||
fi
|
||||
|
||||
export SSH_AUTH_SOCK="${PREFIX}/var/run/ssh-agent"
|
||||
|
||||
MESSAGE=$(ssh-add -L 2>&1)
|
||||
if [ "$MESSAGE" = 'Could not open a connection to your authentication agent.' -o \
|
||||
"$MESSAGE" = 'Error connecting to agent: Connection refused' -o \
|
||||
"$MESSAGE" = 'Error connecting to agent: No such file or directory' ]; then
|
||||
start_agent
|
||||
rm -f "${SSH_AUTH_SOCK}"
|
||||
start_agent "${SSH_AUTH_SOCK}"
|
||||
elif [ "$MESSAGE" = "The agent has no identities." ]; then
|
||||
ssh-add
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user