summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinvoke_session_debian18
1 files changed, 16 insertions, 2 deletions
diff --git a/invoke_session_debian b/invoke_session_debian
index e860a67..a9c8d50 100755
--- a/invoke_session_debian
+++ b/invoke_session_debian
@@ -79,8 +79,15 @@ if ! ssh -i ~/data/onetime -o StrictHostKeyChecking=no localhost true; then
fi
#This would be two agents if we wanted one for source, one for job
-echo "*** WAITING FOR AGENT: ${ip_addr}"
-while ! ssh-add -l &> /dev/null; do inotifywait -e create /tmp; done
+mkdir ~/data || exit 1
+chmod 700 ~/data || exit 1
+echo "*** WAITING FOR KEY: ${ip_addr}"
+while ! test -e ~/data/targetkey; do
+ inotifywait -e create ~/data
+done
+chmod 600 ~/data/targetkey || exit 1
+eval `ssh-agent`
+ssh-add ~/data/targetkey || exit 1
echo ""
mkdir -p /run
mkdir -p /run/hacking
@@ -98,6 +105,13 @@ for lava_name in `lava-group | grep -v '[[:blank:]]*host$' | awk '{print $1}'`;
if test $? -ne 0; then echo "Failed to find IP for ${lava_name}"; sleep infinity; exit 1; fi
if test -z "${target_ip}"; then echo "Failed to find IP for ${lava_name}"; sleep infinity; exit 1; fi
echo "IP ${target_ip}"
+
+ #Check that target is accessible, add to known_hosts
+ if ! ssh -o StrictHostKeyChecking=no true; then
+ echo "Could not access target ${target_ip} (${lava_name})" >&2
+ exit 1
+ fi
+
target_base="$(echo ${lava_name} | sed 's/[[:digit:]]*$//')" #TODO: HACK
if test $? -ne 0; then echo "Failed to find target type from ${lava_name}"; exit 1; fi
echo "TYPE ${target_base}"