feat: Add option to disable networking

This commit is contained in:
Kroese 2024-03-11 11:31:36 +01:00 committed by GitHub
parent 693966a037
commit e80235cac2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,6 +5,7 @@ set -Eeuo pipefail
: "${MAC:=""}"
: "${DHCP:="N"}"
: "${NETWORK:="Y"}"
: "${HOST_PORTS:=""}"
: "${VM_NET_DEV:=""}"
@ -201,6 +202,8 @@ closeNetwork() {
nginx -s stop 2> /dev/null
fWait "nginx"
[[ "$NETWORK" != [Yy1]* ]] && return 0
exec 30<&- || true
exec 40<&- || true
@ -271,6 +274,11 @@ getInfo() {
# Configure Network
# ######################################
if [[ "$NETWORK" != [Yy1]* ]]; then
NET_OPTS=""
return 0
fi
if [ ! -c /dev/vhost-net ]; then
if mknod /dev/vhost-net c 10 238; then
chmod 660 /dev/vhost-net