From 622fe63eb37f957ee5c29684e24f1d2d636fd086 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 3 Apr 2017 11:57:55 +0200 Subject: Adding support for bind-ro nspawn option for read-only bind mounts. Signed-off-by: Daniel Baumann --- lib/container/remove | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'lib/container/remove') diff --git a/lib/container/remove b/lib/container/remove index 03549a4..1b1ba7d 100755 --- a/lib/container/remove +++ b/lib/container/remove @@ -141,7 +141,7 @@ done # data if [ -e "${CONFIG}/${NAME}.conf" ] then - # Removing bind mounts + # Removing rw bind mounts BIND="$(awk -F= '/^bind=/ { print $2 }' ${CONFIG}/${NAME}.conf)" if [ -n "${BIND}" ] @@ -155,6 +155,21 @@ then rmdir --ignore-fail-on-non-empty --parents ${DIRECTORY} > /dev/null 2>&1 || true done fi + + # Removing ro bind mounts + BIND_RO="$(awk -F= '/^bind-ro=/ { print $2 }' ${CONFIG}/${NAME}.conf)" + + if [ -n "${BIND_RO}" ] + then + BINDS_RO="$(echo ${BIND_RO} | sed -e 's|;| |g')" + + for BIND_RO in ${BINDS_RO} + do + DIRECTORY="$(echo ${BIND_RO} | awk -F: '{ print $1 }')" + + rmdir --ignore-fail-on-non-empty --parents ${DIRECTORY} > /dev/null 2>&1 || true + done + fi fi # Run -- cgit v1.2.3