summaryrefslogtreecommitdiffstats
path: root/lib/container/create
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-17 17:40:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-23 16:29:28 +0000
commit13175dfc19dbac8d7024f3f5fb3d838a4bc7a0a1 (patch)
treea033edc5f91aa71f29e5f5688d56ac6f48c97d26 /lib/container/create
parentAdding upstream version 20180825. (diff)
downloadopen-infrastructure-compute-tools-13175dfc19dbac8d7024f3f5fb3d838a4bc7a0a1.tar.xz
open-infrastructure-compute-tools-13175dfc19dbac8d7024f3f5fb3d838a4bc7a0a1.zip
Adding upstream version 20190222.upstream/20190222
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/container/create')
-rwxr-xr-xlib/container/create22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/container/create b/lib/container/create
index 561584c..43cad9b 100755
--- a/lib/container/create
+++ b/lib/container/create
@@ -1,7 +1,6 @@
#!/bin/sh
-# container-tools - Manage systemd-nspawn containers
-# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -20,12 +19,15 @@
set -e
+PROJECT="open-infrastructure"
+PROGRAM="container"
COMMAND="$(basename ${0})"
-CONFIG="/etc/container-tools/config"
-HOOKS="/etc/container-tools/hooks"
+CONFIG="/etc/${PROJECT}/${PROGRAM}/config"
+HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks"
MACHINES="/var/lib/machines"
-SCRIPTS="/usr/share/container-tools/scripts"
+SCRIPTS="/usr/share/${PROJECT}/${PROGRAM}/scripts"
+CONFIG_TEMPLATE="/usr/share/${PROJECT}/${PROGRAM}/config/container.conf.in"
Parameters ()
{
@@ -110,7 +112,7 @@ Parameters ()
Usage ()
{
- echo "Usage: container ${COMMAND} -n|--name NAME [--cnt.container-server=true|false|FQDN] [--cnt.overlay=DIRECTORY_LOWER:DIRECTORY_UPPER:DIRECTORY_WORK:DIRECTORY_MERGED] [-b|--bind DIRECTORY:DIRECTORY[:OPTIONS]] [--bind-ro DIRECTORY:DIRECTORY[:OPTIONS]] [-c|--capability CAPABILITY[,CAPABILITY]] [-d|--drop-capability DROP_CAPABILITY[,DROP_CAPABILITY]] [-s|--script SCRIPT] [-v|--verbose] [-- SCRIPT_OPTIONS]" >&2
+ echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [--cnt.container-server=true|false|FQDN] [--cnt.overlay=DIRECTORY_LOWER:DIRECTORY_UPPER:DIRECTORY_WORK:DIRECTORY_MERGED] [-b|--bind DIRECTORY:DIRECTORY[:OPTIONS]] [--bind-ro DIRECTORY:DIRECTORY[:OPTIONS]] [-c|--capability CAPABILITY[,CAPABILITY]] [-d|--drop-capability DROP_CAPABILITY[,DROP_CAPABILITY]] [-s|--script SCRIPT] [-v|--verbose] [-- SCRIPT_OPTIONS]" >&2
exit 1
}
@@ -141,8 +143,8 @@ then
TARGET="$(basename $(readlink ${SCRIPTS}/default))"
case "${TARGET}" in
- container-tools_script)
- TARGET="$(basename $(readlink /etc/alternatives/container-tools_script))"
+ container_script)
+ TARGET="$(basename $(readlink /etc/alternatives/container_script))"
;;
esac
@@ -176,7 +178,7 @@ EOF
;;
esac
-CNT_CONTAINER_SERVER="${CNT_CONTAINER_SERVER:-$(hostname -f)}"
+CNT_CONTAINER_SERVER="${CNT_CONTAINER_SERVER:-$(hostname -f 2> /dev/null || hostname)}"
# Pre hooks
for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}"
@@ -251,7 +253,7 @@ sed -e "s|@CNT_AUTO@|${CNT_AUTO}|g" \
-e "s|@NETWORK_VETH_EXTRA@|${NETWORK_VETH_EXTRA}|g" \
-e "s|@PRIVATE_USERS@|no|g" \
-e "s|@REGISTER@|yes|g" \
-/usr/share/container-tools/config/container.conf.in > "${CONFIG}/${NAME}.conf"
+"${CONFIG_TEMPLATE}" > "${CONFIG}/${NAME}.conf"
# Run
"${SCRIPTS}/${SCRIPT}" $(echo "${@}" | sed -e 's| -- | |')