#!/bin/bash
#
# Used by t-t2u-start-t2u-oracled
#
# When we appear to be running `ssh <manager> nc.openbsd <socket>`,
# simply cat to/and from the pipes, instead.
#
# So there *is* no AF_UNIX socket in this setup.

set -e

case "$*" in
*t2u-service-manager-host*not-really-the-manager-socket*)
	echo "ssh-t2u-manager faking: $*" >&2
	set -x
	echo 'ORACLED-MAKES-FRESH-CONNECTION' >&6
	cat <&5 5<&- 6<&- &
	kill_pid=$!
	trap 'kill $kill_pid' 0
	cat >&6 5<&- 6<&-
	;;
*)
	exec "$DGIT_TEST_TROOT"/ssh "$@"
	;;
esac
