summaryrefslogtreecommitdiffstats
path: root/lib/container/start
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xlib/container/start38
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/container/start b/lib/container/start
index 112ee9b..d0e7e6e 100755
--- a/lib/container/start
+++ b/lib/container/start
@@ -185,57 +185,57 @@ then
MACHINE="--machine=${NAME}"
- NETWORK_BRIDGES="$(awk -F= '/^cnt.network-bridge=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
+ NETWORK_VETH_EXTRA_CONF="$(awk -F= '/^network-veth-extra=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
+ NETWORK_VETH_EXTRA=""
- case "${NETWORK_BRIDGES}" in
+ case "${NETWORK_VETH_EXTRA_CONF}" in
"")
;;
*)
- for BRIDGE_DEFINITION in ${NETWORK_BRIDGES}
+ for VETH in ${NETWORK_VETH_EXTRA_CONF}
do
- INTERFACE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $1 }')"
- BRIDGE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $2 }')"
-
- if [ -n "${BRIDGE}" ] && [ -n "${INTERFACE}" ]
- then
+ NETWORK_VETH_EXTRA="${NETWORK_VETH_EXTRA} --network-veth-extra=${VETH}"
+ INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')"
cat > "/etc/network/interfaces.d/${INTERFACE}" << EOF
allow-hotplug ${INTERFACE}
iface ${INTERFACE} inet manual
pre-up ifconfig ${INTERFACE} up
- post-up brctl addif ${BRIDGE} ${INTERFACE}
- pre-down brctl delif ${BRIDGE} ${INTERFACE}
post-down ifconfig ${INTERFACE} down
EOF
- else
- echo "'${BRIDGE_DEFINITION}': no such devices, ignoring" >&2
- fi
done
;;
esac
- NETWORK_VETH_EXTRA_CONF="$(awk -F= '/^network-veth-extra=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
- NETWORK_VETH_EXTRA=""
+ NETWORK_BRIDGES="$(awk -F= '/^cnt.network-bridge=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
- case "${NETWORK_VETH_EXTRA_CONF}" in
+ case "${NETWORK_BRIDGES}" in
"")
;;
*)
- for VETH in ${NETWORK_VETH_EXTRA_CONF}
+ for BRIDGE_DEFINITION in ${NETWORK_BRIDGES}
do
- NETWORK_VETH_EXTRA="${NETWORK_VETH_EXTRA} --network-veth-extra=${VETH}"
- INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')"
+ INTERFACE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $1 }')"
+ BRIDGE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $2 }')"
+
+ if [ -n "${BRIDGE}" ] && [ -n "${INTERFACE}" ]
+ then
cat > "/etc/network/interfaces.d/${INTERFACE}" << EOF
allow-hotplug ${INTERFACE}
iface ${INTERFACE} inet manual
pre-up ifconfig ${INTERFACE} up
+ post-up brctl addif ${BRIDGE} ${INTERFACE}
+ pre-down brctl delif ${BRIDGE} ${INTERFACE}
post-down ifconfig ${INTERFACE} down
EOF
+ else
+ echo "Warning bridge definition '${BRIDGE_DEFINITION}' not recognized (expected <bridge>:<interface>): Ignoring"
+ fi
done
;;
esac