run_armds_script.sh: Ask user which DSTREAM to connect to
Previously the script to run the EL3 payload on Juno would connect to
the first DSTREAM it detected, without even asking the user's consent.
Change-Id: I1586957094cc3247c1dadf0adac263af0256e03d
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
diff --git a/el3_payload/scripts/juno/run_armds_script.sh b/el3_payload/scripts/juno/run_armds_script.sh
index b2d6b17..d9763b4 100755
--- a/el3_payload/scripts/juno/run_armds_script.sh
+++ b/el3_payload/scripts/juno/run_armds_script.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
set -e
@@ -31,16 +31,28 @@
tail -n +2 $connections_list > ${connections_list}_stripped
mv ${connections_list}_stripped ${connections_list}
-# Use first available connection
-read connection < $connections_list || true
-rm $connections_list
-
-if [ -z "$connection" ] ; then
- echo "ERROR: Found no connection"
- exit 1
+if [ ! -s $connections_list ] ; then
+ echo "ERROR: Found no connection"
+ exit 1
fi
+# Ask the user which connection to use.
+echo
+cat -n $connections_list
+echo -n "Which one do you want to connect to? "
+read connection_id
+
+# Extract the corresponding connection name from the file.
+connection=$(((sed -n "${connection_id}p") | sed 's/^ *//') < $connections_list)
+if [ -z "$connection" ] ; then
+ echo "ERROR: Invalid connection"
+ exit 1
+fi
+
+rm $connections_list
+
# Run DS-5 script
+echo
echo "Connecting to $connection..."
armdbg \
--cdb-entry "$juno_cdb_entry" \