No dejar ssh-agents flotando

This commit is contained in:
f 2021-09-28 12:52:02 -03:00
parent c1525d9e0f
commit 1af786a9e1

View file

@ -8,6 +8,7 @@ uname -m | grep -q x86_64 || exit 1
DIR="$(dirname "$(realpath "$0")")" DIR="$(dirname "$(realpath "$0")")"
ROOT="$(dirname "$DIR")" ROOT="$(dirname "$DIR")"
SELF="$(basename "$0")" SELF="$(basename "$0")"
SSH_ADHOC=false
# Sólo se puede correr desde el directorio de Sutty # Sólo se puede correr desde el directorio de Sutty
if test "$ROOT" != "$(dirname "$PWD")" && test "$ROOT" != "$PWD"; then if test "$ROOT" != "$(dirname "$PWD")" && test "$ROOT" != "$PWD"; then
@ -234,6 +235,8 @@ if test "$HAIN_ENV"; then
${*:-$DEFAULT} ${*:-$DEFAULT}
else else
if test -z "${SSH_AUTH_SOCK}"; then if test -z "${SSH_AUTH_SOCK}"; then
SSH_ADHOC=true
echo "Iniciando un ssh-agent temporal, te recomendamos instalarlo en tu terminal." >&2 echo "Iniciando un ssh-agent temporal, te recomendamos instalarlo en tu terminal." >&2
eval "$(ssh-agent)" eval "$(ssh-agent)"
ssh-add ssh-add
@ -241,4 +244,6 @@ else
crear_entorno crear_entorno
stdin=/dev/stdin correr "${*:-$DEFAULT}" stdin=/dev/stdin correr "${*:-$DEFAULT}"
${SSH_ADHOC} && ssh-agent -k
fi fi