From b196b29350aeac56d4a2819c43e28d0d60df4328 Mon Sep 17 00:00:00 2001 From: Leo Izen Date: Tue, 21 Feb 2023 11:20:23 -0500 Subject: [PATCH] hooks/waitForBooting.sh: retry upon OCR failure --- hooks/waitForBooting.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/hooks/waitForBooting.sh b/hooks/waitForBooting.sh index db85a98..7d89669 100644 --- a/hooks/waitForBooting.sh +++ b/hooks/waitForBooting.sh @@ -1,11 +1,16 @@ - - +#!/bin/sh echo "====> Wait for Boot Multi user" -if bash vbox.sh waitForText $VM_OS_NAME "Boot Multi user" 10 ; then - echo "====> OK, enter" - bash vbox.sh enter -fi - - +try_counter=0 +while ! bash vbox.sh waitForText "$VM_OS_NAME" "Boot Multi user" 10 ; do + if [ "$try_counter" -ge 10 ] ; then + echo "====> Too many tries... exiting." + exit 1 + fi + echo "====> Timed out, trying again..." + try_counter=$((1+try_counter)) + sleep 1 +done +echo "====> OK, enter" +bash vbox.sh enter