summaryrefslogtreecommitdiffstats
path: root/lib/container/auto
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2017-01-04 10:41:50 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2017-01-04 10:41:50 +0000
commit9c257ffef25f49b1ca6ac4b0eea325eecbec52c8 (patch)
tree6d20a6605f2d454f634212dd58f12a2535a8b6eb /lib/container/auto
parentAdding upstream version 20161220. (diff)
downloadopen-infrastructure-compute-tools-9c257ffef25f49b1ca6ac4b0eea325eecbec52c8.tar.xz
open-infrastructure-compute-tools-9c257ffef25f49b1ca6ac4b0eea325eecbec52c8.zip
Adding upstream version 20170101.upstream/20170101
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'lib/container/auto')
-rwxr-xr-xlib/container/auto23
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/container/auto b/lib/container/auto
index 969ce0a..45aa68f 100755
--- a/lib/container/auto
+++ b/lib/container/auto
@@ -1,7 +1,7 @@
#!/bin/sh
# container-tools - Manage systemd-nspawn containers
-# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2017 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,8 +25,8 @@ HOOKS="/etc/container-tools/hooks"
Parameters ()
{
- GETOPT_LONGOPTIONS="start,stop,"
- GETOPT_OPTIONS="s,t,"
+ GETOPT_LONGOPTIONS="force,start,stop,"
+ GETOPT_OPTIONS="f,s,t,"
PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})"
@@ -41,6 +41,11 @@ Parameters ()
while true
do
case "${1}" in
+ -f|--force)
+ FORCE="true"
+ shift 1
+ ;;
+
-s|--start)
ACTION="start"
shift 1
@@ -66,7 +71,7 @@ Parameters ()
Usage ()
{
- echo "Usage: container ${COMMAND} -s|--start -t|--stop" >&2
+ echo "Usage: container ${COMMAND} -f|--force -s|--start -t|--stop" >&2
exit 1
}
@@ -89,13 +94,21 @@ do
done
# Run
+OPTIONS=""
+
+case "${FORCE}" in
+ true)
+ OPTIONS="${OPTIONS} -f"
+ ;;
+esac
+
for FILE in "${CONFIG}"/*.conf
do
if grep -Eqs "^ *cnt.auto=true" "${FILE}" || grep -Eqs "^ *cnt.auto=${HOST}" "${FILE}"
then
CONTAINER="$(basename ${FILE} .conf)"
- cnt ${ACTION} -n ${CONTAINER} || true
+ cnt ${ACTION} -n ${CONTAINER} ${OPTIONS} || true
fi
done