From 31c84f6309e7c5268f85c28020985f8de4f63ab5 Mon Sep 17 00:00:00 2001 From: tteckster Date: Tue, 1 Feb 2022 21:46:45 -0500 Subject: [PATCH] Update debian11_setup.sh --- setup/debian11_setup.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/setup/debian11_setup.sh b/setup/debian11_setup.sh index 142ca428..5b2c1f0b 100644 --- a/setup/debian11_setup.sh +++ b/setup/debian11_setup.sh @@ -7,8 +7,11 @@ set -o nounset #Treat unset variables as an error set -o pipefail #Pipe will exit with last non-zero status if applicable shopt -s expand_aliases alias die='EXIT=$? LINE=$LINENO error_exit' -CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' CROSS='\033[1;31m\xE2\x9D\x8C\033[0m' +CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m' +RETRY_NUM=5 +RETRY_EVERY=3 +NUM=$RETRY_NUM trap die ERR trap 'die "Script interrupted."' INT @@ -28,12 +31,17 @@ function msg() { msg "Setting up container OS..." sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen locale-gen >/dev/null -sleep 3 while [ "$(hostname -I)" = "" ]; do - echo -e "${CROSS} \e[1;31m No network: \e[0m $(date)" - sleep 3 + 1>&2 echo -e "${CROSS} \e[1;31m No Network: \e[0m $(date)" + sleep $RETRY_EVERY + ((NUM--)) + if [ $NUM -eq 0 ] + then + 1>&2 echo -e "${CROSS} \e[1;31m No Network After $RETRY_NUM Tries \e[0m" + exit 1 + fi done - echo -e "${CHECKMARK} \e[1;92m Network connected: \e[0m $(hostname -I)" + echo -e "${CHECKMARK} \e[1;92m Network Connected: \e[0m $(hostname -I)" msg "Updating container OS..." apt update &>/dev/null