summaryrefslogtreecommitdiffstats
path: root/lib/container/move
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2017-04-03 10:24:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2017-04-03 10:24:24 +0000
commitd013d5bcb55b4b0cd2f6b3cd1b7ea480f1c2f5a1 (patch)
tree575559903db372b4a37576838ce131a5c8dc118c /lib/container/move
parentAdding upstream version 20170101. (diff)
downloadopen-infrastructure-compute-tools-d013d5bcb55b4b0cd2f6b3cd1b7ea480f1c2f5a1.tar.xz
open-infrastructure-compute-tools-d013d5bcb55b4b0cd2f6b3cd1b7ea480f1c2f5a1.zip
Adding upstream version 20170401.upstream/20170401
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/container/move')
-rwxr-xr-xlib/container/move29
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/container/move b/lib/container/move
index 78b0c7f..4d64c8a 100755
--- a/lib/container/move
+++ b/lib/container/move
@@ -141,7 +141,7 @@ done
mv "${CONFIG}/${OLD}.conf" "${CONFIG}/${NEW}.conf"
mv "${MACHINES}/${OLD}" "${MACHINES}/${NEW}"
-# bind mounts
+# rw bind mounts
BIND="$(awk -F= '/^bind=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
if [ -n "${BIND}" ]
@@ -168,6 +168,33 @@ then
done
fi
+# 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
+ SOURCE_OLD="$(echo ${BIND_RO} | awk -F: '{ print $1 }')"
+ SOURCE_NEW="$(echo ${SOURCE_OLD} | sed -e "s|${OLD}|${NEW}|g")"
+
+ if [ "${SOURCE_OLD}" != "${SOURCE_NEW}" ]
+ then
+ mv "${SOURCE_OLD}" "${SOURCE_NEW}"
+ fi
+
+ TARGET_OLD="$(echo ${BIND_RO} | awk -F: '{ print $2 }')"
+ TARGET_NEW="$(echo ${TARGET_OLD} | sed -e "s|${OLD}|${NEW}|g")"
+
+ if [ "${TARGET_OLD}" != "${TARGET_NEW}" ]
+ then
+ mv "${MACHINES}/${NEW}/${TARGET_OLD}" "${MACHINES}/${NEW}/${TARGET_NEW}"
+ fi
+ done
+fi
+
# config
sed -i -e "s|${OLD}|${NEW}|g" "${CONFIG}/${NEW}.conf"