aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2014-06-11 16:22:19 +0100
committerAlex Bennée <alex.bennee@linaro.org>2014-07-10 09:17:21 +0100
commit6818e4c00058bead8ddff94303373aab37c18fbf (patch)
treed7cc9b404a3b50580df773c2bdfb864262bd3aba
parentd894fa61d2bcfe4b6d48f2faeea2781ecf3a7036 (diff)
hacking-session-debian: auto-detect gateway if $GATEWAY not set
This attempts to make the hacking session scripts do the right thing if no gateway is specified. This is marginally easier than relying on the user knowing the correct gateway address for non LAVA lab boxen. Change-Id: I4d76c334d9769bb04ebad7268084532b4e43076a Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
-rw-r--r--hacking-session-debian.yaml1
-rwxr-xr-xinvoke_session_debian9
2 files changed, 7 insertions, 3 deletions
diff --git a/hacking-session-debian.yaml b/hacking-session-debian.yaml
index c39f65b..c8be181 100644
--- a/hacking-session-debian.yaml
+++ b/hacking-session-debian.yaml
@@ -6,7 +6,6 @@ metadata:
params:
PUB_KEY: None
- GATEWAY: 10.0.0.1
install:
deps:
diff --git a/invoke_session_debian b/invoke_session_debian
index e71189d..10e72e5 100755
--- a/invoke_session_debian
+++ b/invoke_session_debian
@@ -1,8 +1,13 @@
#!/bin/bash
# Usage ./invoke_session <gateway>
-# Hack for now until lava-test-shell is smart enough to know it's dispatcher ip
-gateway=$1
+# If gateway isn't set we will guess it based on the default route
+if [ -z "$1" ]; then
+ gateway=`ip route get 8.8.8.8 | cut -d ' ' -f3`
+else
+ gateway=$1
+fi
+
echo "Target's Gateway: $gateway"
if ! grep 'invoke_session' /etc/rc.local