Skip to content

Commit 4f3db6f

Browse files
authored
Merge pull request #38 from rupor-github/vbrozik-feature-agent-relay-no-test
Vbrozik feature - add flag to not test for ssh-agent communication.
2 parents 7bc5e1f + 81ca5b4 commit 4f3db6f

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

docs/wsl-ssh-agent-relay

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
# ${HOME}/.local/bin/wsl-ssh-agent-relay start
55
# export SSH_AUTH_SOCK=${HOME}/.ssh/wsl-ssh-agent.sock
66

7+
# If you do not want the ssh agent relay require your ssh agent
8+
# to be running at the time relay is started add the option -c
9+
# to wsl-ssh-agent-relay.
10+
711
# For debugging startup problems uncomment next line
812
# exec 2> >(tee -a -i "$HOME/error.log")
913

@@ -47,9 +51,11 @@ usage() {
4751
log " To debug use foreground command"
4852
log ""
4953
log " OPTIONS:"
50-
log " -h|--help this page"
54+
log " -h|--help this page"
55+
log ""
56+
log " -v|--verbose verbose mode"
5157
log ""
52-
log " -v|--verbose verbose mode"
58+
log " -s|--skip-test skip ssh-agent communication test"
5359
log ""
5460
log " COMMAND: start, stop, foreground"
5561
}
@@ -60,19 +66,28 @@ fg_opts() {
6066
if [[ -n "$VERBOSE" ]]; then
6167
FG_OPTS+=("-v")
6268
fi
69+
if [[ -n "$NO_COM_TEST" ]]; then
70+
FG_OPTS+=("-c")
71+
fi
6372
}
6473

6574
main() {
6675

6776
POSITIONAL=()
6877
VERBOSE=""
78+
SKIP_SSH_TEST=""
6979
while (($# > 0)); do
7080
case "$1" in
7181
-v | --verbose)
7282
VERBOSE="ENABLED"
7383
shift # shift once since flags have no values
7484
;;
7585

86+
-s | --skip-test)
87+
SKIP_SSH_TEST="TRUE"
88+
shift
89+
;;
90+
7691
-h | --help)
7792
usage
7893
exit 0
@@ -151,11 +166,13 @@ relay() {
151166
fi
152167
log "Relay is running with PID: ${SOCAT_WSL_AGENT_SSH_PID}"
153168

154-
log -n "Polling remote ssh-agent..."
155-
SSH_AUTH_SOCK="${WSL_AGENT_SSH_SOCK}" ssh-add -L >/dev/null 2>&1 || die "[$?] Failure communicating with ssh-agent"
156-
log "OK"
169+
if [[ -z "$SKIP_SSH_TEST" ]]; then
170+
log -n "Polling remote ssh-agent..."
171+
SSH_AUTH_SOCK="${WSL_AGENT_SSH_SOCK}" ssh-add -L >/dev/null 2>&1 || die "[$?] Failure communicating with ssh-agent"
172+
log "OK"
173+
fi
157174

158-
# Everything checks, we are ready for actions
175+
# Everything necessary checks, we are ready for actions
159176
log "Entering wait..."
160177
wait ${SOCAT_WSL_AGENT_SSH_PID}
161178
}

0 commit comments

Comments
 (0)