From dc906e08d33ef286d3cbf1a192c12349bc074902 Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 7 Oct 2025 04:13:01 +0200 Subject: [PATCH] fix: Detect macvlan --- src/print.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/print.sh b/src/print.sh index 4da6386..6a51b68 100644 --- a/src/print.sh +++ b/src/print.sh @@ -11,6 +11,7 @@ error () { printf "%b%s%b" "\E[1;31m❯ " "ERROR: $1" "\E[0m\n" >&2; } file="/run/shm/dsm.url" info="/run/shm/msg.html" +driver="/run/shm/qemu.nic" page="/run/shm/index.html" address="/run/shm/qemu.ip" shutdown="/run/shm/qemu.end" @@ -56,11 +57,7 @@ do (( rc != 0 )) && error "$jq_err $rc ( $json )" && continue [[ "$ip" == "null" ]] && error "$resp_err $json" && continue - if [ -z "$ip" ]; then - [[ "$DHCP" == [Yy1]* ]] && continue - ip="20.20.20.21" - fi - + [ -z "$ip" ] && continue echo "$ip:$port" > $file done @@ -69,7 +66,7 @@ done location=$(<"$file") -if [[ "$location" != "20.20"* ]]; then +if [[ "$DHCP" == [Yy1]* ]]; then msg="http://$location" title="Virtual DSM" @@ -88,10 +85,11 @@ if [[ "$location" != "20.20"* ]]; then else + nic=$(<"$driver") ip=$(<"$address") port="${location##*:}" - if [[ "$ip" == "172."* ]]; then + if [[ "${nic,,}" != "macvlan" ]]; then msg="port $port" else msg="http://$ip:$port"