summaryrefslogtreecommitdiffstats
path: root/lib/container/stop
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-09 16:18:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-09 16:18:22 +0000
commitc011654fff348560957804ce4db060b8f1b40f89 (patch)
tree9065f9029812e692f8ed9c6d6696e58a624ff29c /lib/container/stop
parentAdding upstream version 20201030. (diff)
downloadopen-infrastructure-compute-tools-c011654fff348560957804ce4db060b8f1b40f89.tar.xz
open-infrastructure-compute-tools-c011654fff348560957804ce4db060b8f1b40f89.zip
Adding upstream version 20210101.upstream/20210101
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/container/stop')
-rwxr-xr-xlib/container/stop33
1 files changed, 23 insertions, 10 deletions
diff --git a/lib/container/stop b/lib/container/stop
index a299cb1..6b8caee 100755
--- a/lib/container/stop
+++ b/lib/container/stop
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2014-2020 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2021 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -33,8 +33,8 @@ Parameters ()
{
OPTIONS_ALL=""
- GETOPT_LONGOPTIONS="name:,force,clean,"
- GETOPT_OPTIONS="n:,f,"
+ GETOPT_LONGOPTIONS="name:,force,clean,verbose,"
+ GETOPT_OPTIONS="n:,f,v,"
PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})"
@@ -69,6 +69,13 @@ Parameters ()
OPTONS_ALL="${OPTIONS_ALL} --clean"
;;
+ -v|--verbose)
+ VERBOSE="true"
+ shift 1
+
+ OPTIONS_ALL="${OPTIONS_ALL} --verbose"
+ ;;
+
--)
shift 1
break
@@ -84,7 +91,7 @@ Parameters ()
Usage ()
{
- echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force]" >&2
+ echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force] [-v|--verbose]" >&2
exit 1
}
@@ -122,12 +129,6 @@ case "${NAME}" in
for NAME in ${NAMES}
do
- case "${VERBOSE}" in
- true)
- echo "Stopping container ${NAME}..."
- ;;
- esac
-
${PROGRAM} stop --name ${NAME} ${OPTIONS_ALL} || true
done
@@ -253,6 +254,12 @@ case "${FORCE}" in
esac
# Run
+case "${VERBOSE}" in
+ true)
+ echo -n "Stopping container ${NAME}..."
+ ;;
+esac
+
machinectl ${MODE} ${NAME}
case "${FORCE}" in
@@ -266,6 +273,12 @@ case "${FORCE}" in
;;
esac
+case "${VERBOSE}" in
+ true)
+ echo " done."
+ ;;
+esac
+
# Post hooks
for FILE in "${HOOKS}/post-${COMMAND}".* "${HOOKS}/${NAME}.post-${COMMAND}"
do