summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-05-26 08:56:10 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-06-03 11:37:19 +0000
commita35c42b60e08c6cd0719da017975a7a8eee17ae2 (patch)
treea09cada69b52b0b3e04d6fa24980c86de730f16e /lib
parentMounting bind mounts for the duration of the debconf script. (diff)
downloadcompute-tools-a35c42b60e08c6cd0719da017975a7a8eee17ae2.tar.xz
compute-tools-a35c42b60e08c6cd0719da017975a7a8eee17ae2.zip
Removing empty source directory of bind mounts in container stop command.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-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