From d79ea23c2be5d520ee3782e5a2025fcd129ba956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Sp=C3=B6rk?= Date: Thu, 23 Jun 2022 02:57:51 +0200 Subject: [PATCH] multiple default routes mess up installation (#210) In case multiple default routes on different network interfaces are defined, installation is messed up exiting awk script after first hit should resolve this issue --- homeassistant-supervised/DEBIAN/postinst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant-supervised/DEBIAN/postinst b/homeassistant-supervised/DEBIAN/postinst index 4c3aad7..84bb964 100755 --- a/homeassistant-supervised/DEBIAN/postinst +++ b/homeassistant-supervised/DEBIAN/postinst @@ -42,7 +42,7 @@ while ! ping -c 1 -W 1 ${URL_VERSION_HOST}; do done # Get primary network interface -PRIMARY_INTERFACE=$(ip route | awk '/^default/ { print $5 }') +PRIMARY_INTERFACE=$(ip route | awk '/^default/ { print $5; exit }') IP_ADDRESS=$(ip -4 addr show dev "${PRIMARY_INTERFACE}" | awk '/inet / { sub("/.*", "", $2); print $2 }') case ${ARCH} in @@ -160,4 +160,4 @@ info "machine: http://${IP_ADDRESS}:8123" if [ -f /var/run/reboot-required ] then warn "A reboot is required to apply changes to grub." -fi \ No newline at end of file +fi