diff options
author | Katharina Drexel <katharina.drexel@bfh.ch> | 2020-10-06 14:44:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2020-10-30 04:03:21 +0000 |
commit | ccd0b9b040a9c49a83b9999f6cbff9fe421d30f5 (patch) | |
tree | 870f47d63c8dc064872ab1d0af7f76c0dddcc450 | |
parent | Adding overlay options to container create command. (diff) | |
download | compute-tools-ccd0b9b040a9c49a83b9999f6cbff9fe421d30f5.tar.xz compute-tools-ccd0b9b040a9c49a83b9999f6cbff9fe421d30f5.zip |
Adding overlay options to container start command.
Signed-off-by: Katharina Drexel <katharina.drexel@bfh.ch>
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
-rwxr-xr-x | lib/container/start | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/container/start b/lib/container/start index 5938193..f972983 100755 --- a/lib/container/start +++ b/lib/container/start @@ -204,11 +204,13 @@ esac if [ -e "${CONFIG}/${NAME}.conf" ] then CNT_OVERLAY="$(awk -F= '/^cnt.overlay=/ { print $2 }' ${CONFIG}/${NAME}.conf)" + CNT_OVERLAY_OPTIONS="$(awk -Fcnt.overlay-options= '/^cnt.overlay-options=/ { print $2 }' ${CONFIG}/${NAME}.conf)" if [ -n "${CNT_OVERLAY}" ] then CNT_OVERLAYS="$(echo ${CNT_OVERLAY} | sed -e 's|;| |g')" + COUNT="0" for CNT_OVERLAY in ${CNT_OVERLAYS} do DIRECTORY_LOWER="$(echo ${CNT_OVERLAY} | awk -F: '{ print $1 }')" @@ -216,6 +218,9 @@ then DIRECTORY_WORK="$(echo ${CNT_OVERLAY} | awk -F: '{ print $3 }')" DIRECTORY_MERGED="$(echo ${CNT_OVERLAY} | awk -F: '{ print $4 }')" + COUNT="$((${COUNT} + 1))" + CNT_OVERLAY_OPTION="$(echo ${CNT_OVERLAY_OPTIONS} | awk -F ';' "{ print \$${COUNT} }")" + for DIRECTORY in "${DIRECTORY_LOWER}" "${DIRECTORY_UPPER}" "${DIRECTORY_WORK}" "${DIRECTORY_MERGED}" do mkdir -p "${DIRECTORY}" @@ -223,7 +228,12 @@ then if ! findmnt -n -o SOURCE "${DIRECTORY_MERGED}" | grep -qs '^cnt.overlay-' then - mount cnt.overlay-${NAME} -t overlay -olowerdir="${DIRECTORY_LOWER}",upperdir="${DIRECTORY_UPPER}",workdir="${DIRECTORY_WORK}",default_permissions "${DIRECTORY_MERGED}" + if [ -n "${CNT_OVERLAY_OPTION}" ] + then + CNT_OVERLAY_OPTION="-o ${CNT_OVERLAY_OPTION}" + fi + + mount cnt.overlay-${NAME} -t overlay ${CNT_OVERLAY_OPTION} -olowerdir="${DIRECTORY_LOWER}",upperdir="${DIRECTORY_UPPER}",workdir="${DIRECTORY_WORK}",default_permissions "${DIRECTORY_MERGED}" fi done fi |