feat: Add option to disable networking
This commit is contained in:
parent
693966a037
commit
e80235cac2
1 changed files with 8 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ set -Eeuo pipefail
|
||||||
|
|
||||||
: "${MAC:=""}"
|
: "${MAC:=""}"
|
||||||
: "${DHCP:="N"}"
|
: "${DHCP:="N"}"
|
||||||
|
: "${NETWORK:="Y"}"
|
||||||
: "${HOST_PORTS:=""}"
|
: "${HOST_PORTS:=""}"
|
||||||
|
|
||||||
: "${VM_NET_DEV:=""}"
|
: "${VM_NET_DEV:=""}"
|
||||||
|
|
@ -201,6 +202,8 @@ closeNetwork() {
|
||||||
nginx -s stop 2> /dev/null
|
nginx -s stop 2> /dev/null
|
||||||
fWait "nginx"
|
fWait "nginx"
|
||||||
|
|
||||||
|
[[ "$NETWORK" != [Yy1]* ]] && return 0
|
||||||
|
|
||||||
exec 30<&- || true
|
exec 30<&- || true
|
||||||
exec 40<&- || true
|
exec 40<&- || true
|
||||||
|
|
||||||
|
|
@ -271,6 +274,11 @@ getInfo() {
|
||||||
# Configure Network
|
# Configure Network
|
||||||
# ######################################
|
# ######################################
|
||||||
|
|
||||||
|
if [[ "$NETWORK" != [Yy1]* ]]; then
|
||||||
|
NET_OPTS=""
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -c /dev/vhost-net ]; then
|
if [ ! -c /dev/vhost-net ]; then
|
||||||
if mknod /dev/vhost-net c 10 238; then
|
if mknod /dev/vhost-net c 10 238; then
|
||||||
chmod 660 /dev/vhost-net
|
chmod 660 /dev/vhost-net
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue