summaryrefslogtreecommitdiffstats
path: root/lib/container/stop
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2016-06-01 13:56:36 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2016-06-01 13:56:36 +0000
commitac9d7da1d6f69a0a6fbb8e3729a24b9fa775f923 (patch)
tree38a95003274e9ae485abef49d36501d078fe0bf4 /lib/container/stop
parentAdding upstream version 20160515. (diff)
downloadopen-infrastructure-compute-tools-ac9d7da1d6f69a0a6fbb8e3729a24b9fa775f923.tar.xz
open-infrastructure-compute-tools-ac9d7da1d6f69a0a6fbb8e3729a24b9fa775f923.zip
Adding upstream version 20160601.upstream/20160601
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'lib/container/stop')
-rwxr-xr-xlib/container/stop17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/container/stop b/lib/container/stop
index 67cc403..fb470f6 100755
--- a/lib/container/stop
+++ b/lib/container/stop
@@ -92,9 +92,24 @@ fi
STATE="$(machinectl show ${NAME} 2>&1 | awk -F= '/^State=/ { print $2 }')"
-# Removing network configuration
case "${CLEAN}" in
true)
+ # Removing bind mounts
+ BIND="$(awk -F= '/^bind=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
+
+ if [ -n "${BIND}" ]
+ then
+ BINDS="$(echo ${BIND} | sed -e 's|;| |g')"
+
+ for BIND in ${BINDS}
+ do
+ DIRECTORY="$(echo ${BIND} | awk -F: '{ print $1 }')"
+
+ rmdir --ignore-fail-on-non-empty --parents ${DIRECTORY} > /dev/null 2>&1 || true
+ done
+ fi
+
+ # Removing network configuration
NETWORK_VETH_EXTRA_CONF="$(awk -F= '/^network-veth-extra=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
case "${NETWORK_VETH_EXTRA_CONF}" in