summaryrefslogtreecommitdiffstats
path: root/lib/container/create
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-03-12 06:30:13 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-03-31 14:30:16 +0000
commit66663bd243ff29219b9f0090b6cb02be29b1d059 (patch)
tree1ec0136e3580f5473d1c2b40e1a72511d2bc22f7 /lib/container/create
parentAdding container-shell program. (diff)
downloadcompute-tools-66663bd243ff29219b9f0090b6cb02be29b1d059.tar.xz
compute-tools-66663bd243ff29219b9f0090b6cb02be29b1d059.zip
Adding container-autostart program.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'lib/container/create')
-rwxr-xr-xlib/container/create16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/container/create b/lib/container/create
index d267641..cfee91a 100755
--- a/lib/container/create
+++ b/lib/container/create
@@ -25,8 +25,8 @@ MACHINES="/var/lib/machines"
Parameters ()
{
- LONG_OPTIONS="name:,bind:,script:"
- OPTIONS="n:,b:,s:"
+ LONG_OPTIONS="name:,cnt.autostart:,bind:,script:"
+ OPTIONS="n:,b:,c:,d:,s:"
PARAMETERS="$(getopt --longoptions ${LONG_OPTIONS} --name=${COMMAND} --options ${OPTIONS} --shell sh -- ${@})"
@@ -46,6 +46,11 @@ Parameters ()
shift 2
;;
+ --cnt.autostart)
+ CNT_AUTOSTART="${2}"
+ shift 2
+ ;;
+
-b|--bind)
BIND="${2}"
shift 2
@@ -71,7 +76,7 @@ Parameters ()
Usage ()
{
- echo "Usage: container ${COMMAND} -n|--name NAME [-b|--bind DIRECTORY:DIRECTORY[:OPTIONS]] [-s|--script SCRIPT] [-- SCRIPT_OPTIONS]" >&2
+ echo "Usage: container ${COMMAND} -n|--name NAME [--cnt.autostart=true|false|FQDN] [-b|--bind DIRECTORY:DIRECTORY[:OPTIONS]] [-s|--script SCRIPT] [-- SCRIPT_OPTIONS]" >&2
exit 1
}
@@ -95,6 +100,8 @@ then
echo "'${SCRIPT}': no such script" >&2
fi
+CNT_AUTOSTART="${CNT_AUTOSTART:-$(hostname -f)}"
+
BINDS="$(echo ${BIND} | sed -e 's|;| |g')"
for ENTRY in ${BINDS}
@@ -110,7 +117,8 @@ done
# config
mkdir -p "${CONFIG}"
-sed -e "s|@NAME@|${NAME}|g" \
+sed -e "s|@CNT_AUTOSTART@|${CNT_AUTOSTART}|g" \
+ -e "s|@NAME@|${NAME}|g" \
-e "s|@BIND@|${BIND}|g" \
-e "s|@BOOT@|yes|g" \
-e "s|@DIRECTORY@|${MACHINES}/${NAME}|g" \