summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtct/conf/conf.sh43
-rwxr-xr-xtct/minnow_prepare_flash_conf.sh37
2 files changed, 44 insertions, 36 deletions
diff --git a/tct/conf/conf.sh b/tct/conf/conf.sh
index b8d8d00..26f0d21 100755
--- a/tct/conf/conf.sh
+++ b/tct/conf/conf.sh
@@ -77,6 +77,49 @@ copy_ssh() {
done
}
+wait_ssh() {
+ SDMUX="$1"
+ test -n "${SDMUX}" || die "Missing argument: sdmux"
+
+ CONNECT_CNT=0
+ SLEEP=${INIT_SLEEP}
+
+ sleep "${SLEEP}"
+
+ while ! ping -c 1 "${IP}" -W 1 | grep -q icmp_seq
+ do
+ printf ","
+ if [ ${SLEEP} -ge ${MAX_SLEEP} ]
+ then
+ die "Timeout: host not found in the network!"
+ fi
+ if [ ${SLEEP} -ge ${RESTART_SLEEP} ]
+ then
+ echo "Restarting ${SDMUX}" >&2
+ restart_device "${SDMUX}"
+ fi
+ sleep "${SLEEP}"
+ SLEEP=$((SLEEP+INC_SLEEP))
+ CONNECT_CNT=$((CONNECT_CNT+1))
+ done
+
+ printf "\n" >&2
+
+ SLEEP=10
+
+ while ! nc -q 1 "${IP}" 22 </dev/null
+ do
+ printf "."
+ if [ ${SLEEP} -ge ${MAX_SLEEP} ]
+ then
+ die "Timeout: ssh port not open!"
+ fi
+ SLEEP=$((SLEEP+INC_SLEEP))
+ CONNECT_CNT=$((CONNECT_CNT+1))
+ done
+ echo "${CONNECT_CNT}"
+}
+
copy_sdb() {
ID="$1"
FILE="$2"
diff --git a/tct/minnow_prepare_flash_conf.sh b/tct/minnow_prepare_flash_conf.sh
index 8f7308d..09a4a42 100755
--- a/tct/minnow_prepare_flash_conf.sh
+++ b/tct/minnow_prepare_flash_conf.sh
@@ -63,42 +63,7 @@ restart_device "${SDMUX}"
echo "### conf ###"
-CONNECT_CNT=0
-SLEEP=${INIT_SLEEP}
-
-sleep "${SLEEP}"
-
-while ! ping -c 1 "${IP}" -W 1 | grep -q icmp_seq
-do
- printf ","
- if [ ${SLEEP} -ge ${MAX_SLEEP} ]
- then
- die "Timeout: host not found in the network!"
- fi
- if [ ${SLEEP} -ge ${RESTART_SLEEP} ]
- then
- echo "Restarting MINNOW" >&2
- restart_device "${SDMUX}"
- fi
- sleep "${SLEEP}"
- SLEEP=$((SLEEP+INC_SLEEP))
- CONNECT_CNT=$((CONNECT_CNT+1))
-done
-
-printf "\n"
-
-SLEEP=10
-
-while ! nc -q 1 "${IP}" 22 </dev/null
-do
- printf "."
- if [ ${SLEEP} -ge 60 ]
- then
- die "Timeout: ssh port not open!"
- fi
- SLEEP=$((SLEEP+10))
- CONNECT_CNT=$((CONNECT_CNT+1))
-done
+CONNECT_CNT="$(wait_ssh "${SDMUX}")"
printf "\n"
echo "CONNECT_CNT $CONNECT_CNT" > sysctl.result