Refactor network string construction in build_container
Some checks failed
Bump build.func Revision / bump-revision (push) Has been cancelled
Some checks failed
Bump build.func Revision / bump-revision (push) Has been cancelled
Improves readability and flexibility by building the NET_STRING variable incrementally, using parameter expansion to include only set values for MAC, GATE, VLAN, and MTU. This change makes the network configuration more robust and easier to maintain.
This commit is contained in:
parent
2db707079b
commit
6373e16d44
@ -2108,7 +2108,12 @@ start() {
|
||||
build_container() {
|
||||
# if [ "$VERBOSE" == "yes" ]; then set -x; fi
|
||||
|
||||
NET_STRING="-net0 name=eth0,bridge=${BRG:-vmbr0}${MAC:-},ip=${NET:-dhcp}${GATE:-}${VLAN:-}${MTU:-}"
|
||||
NET_STRING="-net0 name=eth0,bridge=${BRG:-vmbr0}"
|
||||
NET_STRING+="${MAC:+,hwaddr=$MAC}"
|
||||
NET_STRING+=",ip=${NET:-dhcp}"
|
||||
NET_STRING+="${GATE:+,gw=$GATE}"
|
||||
NET_STRING+="${VLAN:+,tag=$VLAN}"
|
||||
NET_STRING+="${MTU:+,mtu=$MTU}"
|
||||
case "$IPV6_METHOD" in
|
||||
auto) NET_STRING="$NET_STRING,ip6=auto" ;;
|
||||
dhcp) NET_STRING="$NET_STRING,ip6=dhcp" ;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user