mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-11-08 02:53:45 +08:00
feat: Detect default interface
* feat: Detect default interface
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
: ${VM_NET_DEV:='eth0'}
|
||||
|
||||
[ -f "/run/qemu.end" ] && echo "QEMU is shutting down.." && exit 1
|
||||
[ ! -f "/run/qemu.pid" ] && echo "QEMU is not running yet.." && exit 0
|
||||
|
||||
file="/run/dsm.url"
|
||||
address="/run/qemu.ip"
|
||||
|
||||
[ ! -f "$file" ] && echo "DSM has not enabled networking yet.." && exit 1
|
||||
|
||||
location=$(cat "$file")
|
||||
@@ -19,7 +19,7 @@ if ! curl -m 20 -ILfSs "http://$location/" > /dev/null; then
|
||||
echo "Failed to reach DSM at port $port"
|
||||
else
|
||||
echo "Failed to reach DSM at http://$location"
|
||||
ip=$(ip address show dev "$VM_NET_DEV" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/)
|
||||
ip="$(cat "$address")"
|
||||
fi
|
||||
|
||||
echo "You might need to whitelist IP $ip in the DSM firewall." && exit 1
|
||||
|
||||
Reference in New Issue
Block a user