فهرست منبع

Merge pull request #23 from tteck/wip

Fix issue where some networks were slow to assign IP address to container causing scripts to fail.
tteckster 3 سال پیش
والد
کامیت
83f6fa5e74

+ 16 - 0
setup/adguard_setup.sh

@@ -6,6 +6,11 @@ set -o nounset
 set -o pipefail 
 set -o pipefail 
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 alias die='EXIT=$? LINE=$LINENO error_exit'
+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 ERR
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
@@ -25,6 +30,17 @@ function msg() {
 msg "Setting up Container OS..."
 msg "Setting up Container OS..."
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
+while [ "$(hostname -I)" = "" ]; do
+  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)"
 
 
 msg "Updating Container OS..."
 msg "Updating Container OS..."
 apt update &>/dev/null
 apt update &>/dev/null

+ 13 - 5
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
 set -o pipefail #Pipe will exit with last non-zero status if applicable
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 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'
 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 ERR
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
@@ -28,12 +31,17 @@ function msg() {
 msg "Setting up container OS..."
 msg "Setting up container OS..."
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
-sleep 3
 while [ "$(hostname -I)" = "" ]; do
 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
 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..."
 msg "Updating container OS..."
 apt update &>/dev/null
 apt update &>/dev/null

+ 16 - 0
setup/esphome_setup.sh

@@ -7,6 +7,11 @@ set -o nounset  #Treat unset variables as an error
 set -o pipefail #Pipe will exit with last non-zero status if applicable
 set -o pipefail #Pipe will exit with last non-zero status if applicable
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 alias die='EXIT=$? LINE=$LINENO error_exit'
+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 ERR
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
@@ -27,6 +32,17 @@ function msg() {
 msg "Setting up Container OS..."
 msg "Setting up Container OS..."
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
+while [ "$(hostname -I)" = "" ]; do
+  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)"
 
 
 # Update container OS
 # Update container OS
 msg "Updating container OS..."
 msg "Updating container OS..."

+ 15 - 0
setup/ha_setup.sh

@@ -6,7 +6,11 @@ set -o nounset
 set -o pipefail 
 set -o pipefail 
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 alias die='EXIT=$? LINE=$LINENO error_exit'
+CROSS='\033[1;31m\xE2\x9D\x8C\033[0m'
 CHECKMARK='\033[0;32m\xE2\x9C\x94\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 ERR
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
@@ -26,6 +30,17 @@ function msg() {
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
+while [ "$(hostname -I)" = "" ]; do
+  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 Updating Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m"
 apt update &>/dev/null
 apt update &>/dev/null

+ 15 - 0
setup/jellyfin_setup.sh

@@ -7,7 +7,11 @@ set -o pipefail
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 alias die='EXIT=$? LINE=$LINENO error_exit'
 trap die ERR
 trap die ERR
+CROSS='\033[1;31m\xE2\x9D\x8C\033[0m'
 CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m'
 CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m'
+RETRY_NUM=5
+RETRY_EVERY=3
+NUM=$RETRY_NUM
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
 function error_exit() {
 function error_exit() {
@@ -26,6 +30,17 @@ function msg() {
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
+while [ "$(hostname -I)" = "" ]; do
+  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 Updating Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m"
 apt update &>/dev/null
 apt update &>/dev/null

+ 16 - 0
setup/mariadb_setup.sh

@@ -7,6 +7,11 @@ set -o nounset  #Treat unset variables as an error
 set -o pipefail #Pipe will exit with last non-zero status if applicable
 set -o pipefail #Pipe will exit with last non-zero status if applicable
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 alias die='EXIT=$? LINE=$LINENO error_exit'
+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 ERR
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
@@ -27,6 +32,17 @@ function msg() {
 msg "Setting up container OS..."
 msg "Setting up container OS..."
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
+while [ "$(hostname -I)" = "" ]; do
+  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)"
 
 
 # Update container OS
 # Update container OS
 msg "Updating container OS..."
 msg "Updating container OS..."

+ 16 - 0
setup/mqtt_setup.sh

@@ -7,6 +7,11 @@ set -o nounset  #Treat unset variables as an error
 set -o pipefail #Pipe will exit with last non-zero status if applicable
 set -o pipefail #Pipe will exit with last non-zero status if applicable
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 alias die='EXIT=$? LINE=$LINENO error_exit'
+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 ERR
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
@@ -27,6 +32,17 @@ function msg() {
 msg "Setting up Container OS..."
 msg "Setting up Container OS..."
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
+while [ "$(hostname -I)" = "" ]; do
+  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)"
 
 
 # Update container OS
 # Update container OS
 msg "Updating Container OS..."
 msg "Updating Container OS..."

+ 15 - 0
setup/node-red_setup.sh

@@ -6,7 +6,11 @@ set -o nounset
 set -o pipefail 
 set -o pipefail 
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 alias die='EXIT=$? LINE=$LINENO error_exit'
+CROSS='\033[1;31m\xE2\x9D\x8C\033[0m'
 CHECKMARK='\033[0;32m\xE2\x9C\x94\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 ERR
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
@@ -26,6 +30,17 @@ function msg() {
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
+while [ "$(hostname -I)" = "" ]; do
+  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 Updating Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m"
 apt update &>/dev/null
 apt update &>/dev/null

+ 14 - 5
setup/npm_setup.sh

@@ -6,8 +6,11 @@ set -o nounset
 set -o pipefail 
 set -o pipefail 
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 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'
 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 ERR
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
@@ -26,12 +29,18 @@ function msg() {
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
-sleep 3
 while [ "$(hostname -I)" = "" ]; do
 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
 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)"
+
 echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m"
 apt update &>/dev/null
 apt update &>/dev/null
 apt-get -qqy upgrade &>/dev/null
 apt-get -qqy upgrade &>/dev/null

+ 16 - 0
setup/pihole_setup.sh

@@ -6,6 +6,11 @@ set -o nounset
 set -o pipefail 
 set -o pipefail 
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 alias die='EXIT=$? LINE=$LINENO error_exit'
+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 ERR
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
@@ -25,6 +30,17 @@ function msg() {
 msg "Setting up LXC OS..."
 msg "Setting up LXC OS..."
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
+while [ "$(hostname -I)" = "" ]; do
+  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)"
 
 
 # Update container OS
 # Update container OS
 msg "Updating container OS..."
 msg "Updating container OS..."

+ 16 - 1
setup/plex_setup.sh

@@ -6,8 +6,12 @@ set -o nounset
 set -o pipefail 
 set -o pipefail 
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 alias die='EXIT=$? LINE=$LINENO error_exit'
-trap die ERR
+CROSS='\033[1;31m\xE2\x9D\x8C\033[0m'
 CHECKMARK='\033[0;32m\xE2\x9C\x94\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
 trap 'die "Script interrupted."' INT
 
 
 function error_exit() {
 function error_exit() {
@@ -26,6 +30,17 @@ function msg() {
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
+while [ "$(hostname -I)" = "" ]; do
+  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 Updating Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m"
 apt update &>/dev/null
 apt update &>/dev/null

+ 14 - 0
setup/podman_ha_setup.sh

@@ -6,7 +6,10 @@ set -o nounset
 set -o pipefail
 set -o pipefail
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 alias die='EXIT=$? LINE=$LINENO error_exit'
+CROSS='\033[1;31m\xE2\x9D\x8C\033[0m'
 CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m'
 CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m'
+RETRY_NUM=5
+RETRY_EVERY=3
 trap die ERR
 trap die ERR
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
@@ -26,6 +29,17 @@ function msg() {
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
+while [ "$(hostname -I)" = "" ]; do
+  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 Updating Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m"
 apt update &>/dev/null
 apt update &>/dev/null

+ 14 - 0
setup/ubuntu_setup.sh

@@ -6,7 +6,10 @@ set -o nounset
 set -o pipefail 
 set -o pipefail 
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 alias die='EXIT=$? LINE=$LINENO error_exit'
+CROSS='\033[1;31m\xE2\x9D\x8C\033[0m'
 CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m'
 CHECKMARK='\033[0;32m\xE2\x9C\x94\033[0m'
+RETRY_NUM=5
+RETRY_EVERY=3
 trap die ERR
 trap die ERR
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
@@ -26,6 +29,17 @@ function msg() {
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
+while [ "$(hostname -I)" = "" ]; do
+  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 Updating Container OS \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Updating Container OS \e[0m"
 apt update &>/dev/null
 apt update &>/dev/null

+ 15 - 0
setup/zigbee2mqtt_setup.sh

@@ -6,7 +6,11 @@ set -o nounset
 set -o pipefail
 set -o pipefail
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 alias die='EXIT=$? LINE=$LINENO error_exit'
+CROSS='\033[1;31m\xE2\x9D\x8C\033[0m'
 CHECKMARK='\033[0;32m\xE2\x9C\x94\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 ERR
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
@@ -26,6 +30,17 @@ function msg() {
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
+while [ "$(hostname -I)" = "" ]; do
+  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 Updating Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m"
 apt update &>/dev/null
 apt update &>/dev/null

+ 15 - 0
setup/zwavejs2mqtt_setup.sh

@@ -6,7 +6,11 @@ set -o nounset
 set -o pipefail
 set -o pipefail
 shopt -s expand_aliases
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 alias die='EXIT=$? LINE=$LINENO error_exit'
+CROSS='\033[1;31m\xE2\x9D\x8C\033[0m'
 CHECKMARK='\033[0;32m\xE2\x9C\x94\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 ERR
 trap 'die "Script interrupted."' INT
 trap 'die "Script interrupted."' INT
 
 
@@ -26,6 +30,17 @@ function msg() {
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Setting up Container OS... \e[0m"
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 locale-gen >/dev/null
+while [ "$(hostname -I)" = "" ]; do
+  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 Updating Container OS... \e[0m"
 echo -e "${CHECKMARK} \e[1;92m Updating Container OS... \e[0m"
 apt update &>/dev/null
 apt update &>/dev/null