From d3e29c31df16ad479824cc9e2dac7897af7c9e9b Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Wed, 6 May 2020 19:36:02 +0100 Subject: [PATCH] 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. --- bin/start-ssh-agent | 6 ++++++ 1 file changed, 6 insertions(+) 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)} -- 2.11.0