summaryrefslogtreecommitdiffstats
path: root/lib/container/stop
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2016-08-04 13:45:49 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2016-08-04 13:50:13 +0000
commite1ac8c36854fbeb60a53a5090fbb673b2a7b9d09 (patch)
treecc969c8a612fe7412f9d14759e6dc64c77b2a5a1 /lib/container/stop
parentReleasing debian version 20160701-1. (diff)
downloadopen-infrastructure-compute-tools-e1ac8c36854fbeb60a53a5090fbb673b2a7b9d09.tar.xz
open-infrastructure-compute-tools-e1ac8c36854fbeb60a53a5090fbb673b2a7b9d09.zip
Merging upstream version 20160801.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'lib/container/stop')
-rwxr-xr-xlib/container/stop23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/container/stop b/lib/container/stop
index dc78f05..ec24d51 100755
--- a/lib/container/stop
+++ b/lib/container/stop
@@ -94,6 +94,29 @@ STATE="$(machinectl show ${NAME} 2>&1 | awk -F= '/^State=/ { print $2 }')"
case "${CLEAN}" in
true)
+ # Removing overlay mounts
+ CNT_OVERLAY="$(awk -F= '/^cnt.overlay=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
+
+ if [ -n "${CNT_OVERLAY}" ]
+ then
+ CNT_OVERLAYS="$(echo ${CNT_OVERLAY} | sed -e 's|;| |g')"
+
+ for CNT_OVERLAY in ${CNT_OVERLAYS}
+ do
+ DIRECTORY_LOWER="$(echo ${CNT_OVERLAY} | awk -F: '{ print $1 }')"
+ DIRECTORY_UPPER="$(echo ${CNT_OVERLAY} | awk -F: '{ print $2 }')"
+ DIRECTORY_WORK="$(echo ${CNT_OVERLAY} | awk -F: '{ print $3 }')"
+ DIRECTORY_MERGED="$(echo ${CNT_OVERLAY} | awk -F: '{ print $4 }')"
+
+ umount -f "${DIRECTORY_MERGED}"
+
+ for DIRECTORY in "${DIRECTORY_LOWER}" "${DIRECTORY_UPPER}" "${DIRECTORY_WORK}" "${DIRECTORY_MERGED}"
+ do
+ rmdir --ignore-fail-on-non-empty --parents ${DIRECTORY} > /dev/null 2>&1 || true
+ done
+ done
+ fi
+
# Removing bind mounts
BIND="$(awk -F= '/^bind=/ { print $2 }' ${CONFIG}/${NAME}.conf)"