chiark / gitweb /
bin/start-ssh-agent: Don't proceed if the SSH programs aren't around.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 6 May 2020 18:36:02 +0000 (19:36 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 6 May 2020 18:38:13 +0000 (19:38 +0100)
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

index d5389d8c03861072ea5018989b41970d8cdf5271..88fd657fcd22c039769e531677aaf85108e50b61 100755 (executable)
@@ -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)}