From e875db60a1505d3ecec6fc18b45e014ac2d1746d Mon Sep 17 00:00:00 2001 From: Matheson Steplock Date: Thu, 23 Sep 2021 15:33:22 +0000 Subject: [PATCH] Check network connection --- homeassistant-supervised/DEBIAN/postinst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/homeassistant-supervised/DEBIAN/postinst b/homeassistant-supervised/DEBIAN/postinst index a7dae2f..60ce26e 100755 --- a/homeassistant-supervised/DEBIAN/postinst +++ b/homeassistant-supervised/DEBIAN/postinst @@ -13,6 +13,7 @@ SERVICE_DOCKER="docker.service" SERVICE_NM="NetworkManager.service" # Read infos from web +URL_VERSION_HOST="version.home-assistant.io" URL_VERSION="https://version.home-assistant.io/stable.json" HASSIO_VERSION=$(curl -s $URL_VERSION | jq -e -r '.supervisor') URL_APPARMOR_PROFILE="https://version.home-assistant.io/apparmor.txt" @@ -26,6 +27,12 @@ systemctl restart "${SERVICE_NM}" info "Restarting docker service" systemctl restart "$SERVICE_DOCKER" +# Check network connection +while ! ping -c 1 -W 1 ${URL_VERSION_HOST}; do + info "Waiting for ${URL_VERSION_HOST} - network interface might be down..." + sleep 2 +done + case $ARCH in "i386" | "i686") MACHINE=${MACHINE:=qemux86}