From c1869b5773e44a781f6615ff395071f5610708f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Sp=C3=B6rk?= Date: Tue, 5 Apr 2022 14:25:06 -0600 Subject: [PATCH] multiple default routes mess up installation 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 1eebc0f..a3e3d02 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 @@ -152,4 +152,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