From: Mark Wooding Date: Wed, 6 May 2020 18:36:02 +0000 (+0100) Subject: bin/start-ssh-agent: Don't proceed if the SSH programs aren't around. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/d3e29c31df16ad479824cc9e2dac7897af7c9e9b?ds=inline bin/start-ssh-agent: Don't proceed if the SSH programs aren't around. Otherwise, when I enter an schroot session, there's no `ssh-add' installed, so the `is the agent running' test /fails/, we delete the socket, and then fail to start a replacement agent because `ssh-agent' doesn't exist either. The result is that I've now lost my socket for my (otherwise completely functional) agent, and there is sadness. --- diff --git a/bin/start-ssh-agent b/bin/start-ssh-agent index d5389d8..88fd657 100755 --- a/bin/start-ssh-agent +++ b/bin/start-ssh-agent @@ -29,6 +29,12 @@ case $chosen,$style in ;; esac +## Check that this stands a chance of working. +if ! type >/dev/null 2>&1 ssh-agent || ! type >/dev/null >&1 ssh-add; then + echo >&2 "$0: ssh not installed; chickening out" + exit 1 +fi + ## Some useful variables. hostname=${HOST-$(hostname)} user=${USER-${LOGNAME-$(id -un)}} uid=${UID-$(id -u)}