diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2016-07-01 09:53:24 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2016-07-01 09:54:30 +0000 |
commit | 98e646a8fb214023ab99f661a6ad2550157c6b95 (patch) | |
tree | 0430656e1e16ec50b9eeede978c85e156a036d8a /lib/container/create | |
parent | Releasing debian version 20160615-2. (diff) | |
download | open-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/create')
-rwxr-xr-x | lib/container/create | 32 |
1 files changed, 17 insertions, 15 deletions
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| -- | |') |