Commit | Line | Data |
---|---|---|
a10bf242 MW |
1 | #! /bin/sh -e |
2 | case $# in 1) ;; *) echo >&2 "usage: $0 HOST"; exit 2 ;; esac | |
3 | host=$1; shift | |
4 | case $host in | |
5 | *[!-a-zA-Z0-9]*) echo >&2 "$0: bad host name \`$host'"; exit 2 ;; | |
6 | esac | |
7 | cd "$HOME/.disorder" | |
8 | if ! [ -f "passwd.$host" ] || | |
9 | ! grep -q "^connect -unix /.*/\.disorder/sock/disorder@$host" \ | |
10 | "passwd.$host" | |
11 | then echo >&2 "$0: unknown disorder host \`$host'"; exit 2; fi | |
12 | if [ -S "sock/ssh@$host" ]; then | |
13 | ssh -oControlPath="sock/ssh@$host" -Oexit "$host" | |
14 | fi | |
15 | rm -f "sock/disorder@$host" | |
16 | ssh -oControlMaster=yes -oControlPath="sock/ssh@$host" -fnN \ | |
17 | -L"sock/disorder@$host:/var/lib/disorder/socket" \ | |
18 | "$host" |