summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/container/create2
-rwxr-xr-xlib/container/start25
2 files changed, 19 insertions, 8 deletions
diff --git a/lib/container/create b/lib/container/create
index fab9f5b..4d1d19b 100755
--- a/lib/container/create
+++ b/lib/container/create
@@ -135,7 +135,7 @@ sed -e "s|@CNT_AUTOSTART@|${CNT_AUTOSTART}|g" \
-e "s|@DIRECTORY@|${MACHINES}/${NAME}|g" \
-e "s|@DROP_CAPABILITY@|${DROP_CAPABILITY}|g" \
-e "s|@MACHINE@|${NAME}|g" \
- -e "s|@NETWORK_VETH@|yes|g" \
+ -e "s|@NETWORK_VETH_EXTRA@|${NETWORK_VETH_EXTRA}|g" \
-e "s|@NETWORK_BRIDGE@|br0|g" \
-e "s|@LINK_JOURNAL@|no|g" \
-e "s|@REGISTER@|yes|g" \
diff --git a/lib/container/start b/lib/container/start
index 8d5429b..fa717dd 100755
--- a/lib/container/start
+++ b/lib/container/start
@@ -197,15 +197,26 @@ then
;;
esac
- NETWORK_VETH="$(awk -F= '/^network-veth=/ { print $2 }' ${CONFIG}/${NAME}.conf || echo yes)"
+ NETWORK_VETH_EXTRA_CONF="$(awk -F= '/^network-veth-extra=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
+ NETWORK_VETH_EXTRA=""
- case "${NETWORK_VETH}" in
- yes)
- NETWORK_VETH="--network-veth"
+ case "${NETWORK_VETH_EXTRA_CONF}" in
+ "")
;;
*)
- NETWORK_VETH=""
+ for VETH in ${NETWORK_VETH_EXTRA_CONF}
+ do
+ NETWORK_VETH_EXTRA="${NETWORK_VETH_EXTRA} --network-veth-extra=${VETH}"
+ INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')"
+
+cat > "/etc/network/interfaces.d/${INTERFACE}" << EOF
+iface ${INTERFACE} inet manual
+ pre-up ifconfig ${INTERFACE} up
+ post-down ifconfig ${INTERFACE} down
+EOF
+
+ done
;;
esac
@@ -301,11 +312,11 @@ fi
# Run
case "${SET_PROPERTY}" in
true)
- ${SETARCH} systemd-nspawn ${BIND} ${BOOT} ${CAPABILITY} ${DIRECTORY} ${DROP_CAPABILITY} ${MACHINE} ${NETWORK_BRIDGE} ${NETWORK_VETH} ${LINK_JOURNAL} ${REGISTER} & \
+ ${SETARCH} systemd-nspawn ${BIND} ${BOOT} ${CAPABILITY} ${DIRECTORY} ${DROP_CAPABILITY} ${MACHINE} ${NETWORK_BRIDGE} ${NETWORK_VETH_EXTRA} ${LINK_JOURNAL} ${REGISTER} & \
systemctl --runtime set-property ${NAME} ${BLOCK_IO_DEVICE_WEIGHT} ${BLOCK_IO_READ_BANDWITH} ${BLOCK_IO_WEIGHT} ${BLOCK_IO_WRITE_BANDWITH} ${CPU_QUOTA} ${CPU_SHARES} ${MEMORY_LIMIT} ${TASKS_MAX}
;;
*)
- ${SETARCH} systemd-nspawn ${BIND} ${BOOT} ${CAPABILITY} ${DIRECTORY} ${DROP_CAPABILITY} ${MACHINE} ${NETWORK_BRIDGE} ${NETWORK_VETH} ${LINK_JOURNAL} ${REGISTER}
+ ${SETARCH} systemd-nspawn ${BIND} ${BOOT} ${CAPABILITY} ${DIRECTORY} ${DROP_CAPABILITY} ${MACHINE} ${NETWORK_BRIDGE} ${NETWORK_VETH_EXTRA} ${LINK_JOURNAL} ${REGISTER}
;;
esac