summaryrefslogtreecommitdiffstats
path: root/lib/container/remove
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2016-07-01 09:53:24 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2016-07-01 09:54:30 +0000
commit98e646a8fb214023ab99f661a6ad2550157c6b95 (patch)
tree0430656e1e16ec50b9eeede978c85e156a036d8a /lib/container/remove
parentReleasing debian version 20160615-2. (diff)
downloadopen-infrastructure-compute-tools-98e646a8fb214023ab99f661a6ad2550157c6b95.tar.xz
open-infrastructure-compute-tools-98e646a8fb214023ab99f661a6ad2550157c6b95.zip
Merging upstream version 20160701.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'lib/container/remove')
-rwxr-xr-xlib/container/remove18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/container/remove b/lib/container/remove
index 4f26d43..e4bb20c 100755
--- a/lib/container/remove
+++ b/lib/container/remove
@@ -25,8 +25,8 @@ MACHINES="/var/lib/machines"
Parameters ()
{
- LONG_OPTIONS="name:,force"
- OPTIONS="n:,f"
+ LONG_OPTIONS="name:,force,"
+ OPTIONS="n:,f,"
PARAMETERS="$(getopt --longoptions ${LONG_OPTIONS} --name=${COMMAND} --options ${OPTIONS} --shell sh -- ${@})"
@@ -116,13 +116,19 @@ esac
# data
if [ -e "${CONFIG}/${NAME}.conf" ]
then
+ # Removing bind mounts
BIND="$(awk -F= '/^bind=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
- DIRECTORY="$(echo ${BIND} | awk -F: '{ print $1 }')"
-
- if [ -e "${DIRECTORY}" ]
+ if [ -n "${BIND}" ]
then
- rmdir --ignore-fail-on-non-empty --parents ${DIRECTORY} || true
+ 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
fi