From 98e646a8fb214023ab99f661a6ad2550157c6b95 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 1 Jul 2016 11:53:24 +0200 Subject: Merging upstream version 20160701. Signed-off-by: Daniel Baumann --- lib/container/create | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'lib/container/create') diff --git a/lib/container/create b/lib/container/create index dea1e76..8080ffa 100755 --- a/lib/container/create +++ b/lib/container/create @@ -22,11 +22,12 @@ COMMAND="$(basename ${0})" CONFIG="/etc/container-tools/config" MACHINES="/var/lib/machines" +SCRIPTS="/usr/share/container-tools/scripts" Parameters () { - LONG_OPTIONS="name:,cnt.auto:,bind:,capability:,drop-capability:script:" - OPTIONS="n:,b:,c:,d:,s:" + LONG_OPTIONS="name:,cnt.auto:,bind:,capability:,drop-capability:script:," + OPTIONS="n:,b:,c:,d:,s:," PARAMETERS="$(getopt --longoptions ${LONG_OPTIONS} --name=${COMMAND} --options ${OPTIONS} --shell sh -- ${@})" @@ -105,9 +106,9 @@ fi if [ -z "${SCRIPT}" ] then - if [ -e /usr/share/container-tools/scripts/default ] + if [ -e "${SCRIPTS}/default" ] then - TARGET="$(basename $(readlink /usr/share/container-tools/scripts/default))" + TARGET="$(basename $(readlink ${SCRIPTS}/default))" case "${TARGET}" in container-tools_script) @@ -115,7 +116,7 @@ then ;; esac - if [ -e "/usr/share/container-tools/scripts/${TARGET}" ] + if [ -e "${SCRIPTS}/${TARGET}" ] then SCRIPT="${TARGET}" else @@ -126,7 +127,7 @@ then SCRIPT="debian" fi else - if [ ! -e "/usr/share/container-tools/scripts/${SCRIPT}" ] + if [ ! -e "${SCRIPTS}/${SCRIPT}" ] then echo "'${SCRIPT}': no such script" >&2 exit 1 @@ -135,17 +136,18 @@ fi CNT_AUTO="${CNT_AUTO:-$(hostname -f)}" -BINDS="$(echo ${BIND} | sed -e 's|;| |g')" +# Creating bind mounts +if [ -n "${BIND}" ] +then + BINDS="$(echo ${BIND} | sed -e 's|;| |g')" -for ENTRY in ${BINDS} -do - DIRECTORY="$(echo ${ENTRY} | awk -F: '{ print $1 }')" + for BIND in ${BINDS} + do + DIRECTORY="$(echo ${BIND} | awk -F: '{ print $1 }')" - if [ ! -e "${DIRECTORY}" ] - then mkdir -p "${DIRECTORY}" - fi -done + done +fi # config mkdir -p "${CONFIG}" @@ -165,4 +167,4 @@ sed -e "s|@CNT_AUTO@|${CNT_AUTO}|g" \ /usr/share/container-tools/config/container.conf.in > "${CONFIG}/${NAME}.conf" # Run -"/usr/share/container-tools/scripts/${SCRIPT}" $(echo "${@}" | sed -e 's| -- | |') +"${SCRIPTS}/${SCRIPT}" $(echo "${@}" | sed -e 's| -- | |') -- cgit v1.2.3