0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-05-11 16:43:53 +00:00
Files
termux-packages/packages/openssh/sv/ssh-agent.run.in

21 lines
696 B
Bash

#!@TERMUX_PREFIX@/bin/sh
# Run `sv-enable ssh-agent` and add the following to your bashrc (or
# equivalent) to use ssh-agent:
# export SSH_AUTH_SOCK="$PREFIX"/var/run/ssh-agent.socket
# After that you can add your key to the agent with `ssh-add`, and
# then make use of the credentials across all terminal sessions
service_agent() {
exec ssh-agent -D -a "$1" 2>&1
}
# Allow overriding the service_agent function easily.
if [ -r "${TERMUX__PREFIX:-"${PREFIX}"}"/etc/ssh/start_agent.sh ]; then
. "${TERMUX__PREFIX:-"${PREFIX}"}"/etc/ssh/start_agent.sh
fi
export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR:-"${TERMUX__PREFIX:-"${PREFIX}"}/var/run"}"/ssh-agent.socket
service_agent "${SSH_AUTH_SOCK}"