diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2016-07-01 09:53:17 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2016-07-01 09:53:17 +0000 |
commit | a18674d73d1ef3472897c0f2049bf8131b9e4eb6 (patch) | |
tree | 0910f1df6e4648f6866cc06910314b845bf99bf1 /lib/container/create | |
parent | Adding upstream version 20160615. (diff) | |
download | open-infrastructure-compute-tools-a18674d73d1ef3472897c0f2049bf8131b9e4eb6.tar.xz open-infrastructure-compute-tools-a18674d73d1ef3472897c0f2049bf8131b9e4eb6.zip |
Adding upstream version 20160701.upstream/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| -- | |') |