diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/container/stop | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/container/stop b/lib/container/stop index cd3de10..18d154c 100755 --- a/lib/container/stop +++ b/lib/container/stop @@ -20,6 +20,7 @@ set -e COMMAND="$(basename ${0})" +CONFIG="/etc/container-tools/config" MACHINES="/var/lib/machines" Parameters () @@ -105,3 +106,24 @@ esac # Run machinectl ${MODE} ${NAME} + +# Removing network configuration +NETWORK_VETH_EXTRA_CONF="$(awk -F= '/^network-veth-extra=/ { print $2 }' ${CONFIG}/${NAME}.conf)" + +case "${NETWORK_VETH_EXTRA_CONF}" in + "") + ;; + + *) + for VETH in ${NETWORK_VETH_EXTRA_CONF} + do + INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')" + FILE="/etc/network/interfaces.d/${INTERFACE}" + + if [ -f "${FILE}"] + then + rm -f "${FILE}" + fi + done + ;; +esac |