#! /bin/sh -e case $# in 1) ;; *) echo >&2 "usage: $0 HOST"; exit 2 ;; esac host=$1; shift case $host in *[!-a-zA-Z0-9]*) echo >&2 "$0: bad host name \`$host'"; exit 2 ;; esac cd "$HOME/.disorder" if ! [ -f "passwd.$host" ] || ! grep -q "^connect -unix /.*/\.disorder/sock/disorder@$host" \ "passwd.$host" then echo >&2 "$0: unknown disorder host \`$host'"; exit 2; fi if [ -S "sock/ssh@$host" ]; then ssh -oControlPath="sock/ssh@$host" -Oexit "$host" fi rm -f "sock/disorder@$host" ssh -oControlMaster=yes -oControlPath="sock/ssh@$host" -fnN \ -L"sock/disorder@$host:/var/lib/disorder/socket" \ "$host"