summaryrefslogtreecommitdiffstats
path: root/libexec/container/restart
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2022-09-17 04:58:14 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2022-09-17 04:58:40 +0000
commit5d023bb8b502df8c95f0096cafe050de349e82c2 (patch)
tree3388345058a791648a45c5d4fb559bec90db8f65 /libexec/container/restart
parentReleasing version 20220721. (diff)
downloadcompute-tools-5d023bb8b502df8c95f0096cafe050de349e82c2.tar.xz
compute-tools-5d023bb8b502df8c95f0096cafe050de349e82c2.zip
Adding force and interactive options to container restart command.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'libexec/container/restart')
-rwxr-xr-xlibexec/container/restart37
1 files changed, 34 insertions, 3 deletions
diff --git a/libexec/container/restart b/libexec/container/restart
index fcb28b8..0eb753c 100755
--- a/libexec/container/restart
+++ b/libexec/container/restart
@@ -31,8 +31,8 @@ Parameters ()
{
OPTIONS_ALL=""
- GETOPT_LONGOPTIONS="name:,verbose,"
- GETOPT_OPTIONS="n:,v,"
+ GETOPT_LONGOPTIONS="name:,force,interactive,verbose,"
+ GETOPT_OPTIONS="n:,f,i,v,"
PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})"
@@ -52,6 +52,20 @@ Parameters ()
shift 2
;;
+ -f|--force)
+ FORCE="true"
+ shift 1
+
+ OPTIONS_ALL="${OPTIONS_ALL} --force"
+ ;;
+
+ -i|--interactive)
+ INTERACTIVE="true"
+ shift 1
+
+ OPTIONS_ALL="${OPTIONS_ALL} --interactive"
+ ;;
+
-v|--verbose)
VERBOSE="true"
shift 1
@@ -74,7 +88,7 @@ Parameters ()
Usage ()
{
- echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-v|--verbose]" >&2
+ echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force] [-i|--interactive] [-v|--verbose]" >&2
echo
echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information."
@@ -107,6 +121,23 @@ then
exit 1
fi
+if [ "${FORCE}" != "true" ] || [ "${INTERACTIVE}" = "true" ]
+then
+ echo -n "'${NAME}': restart container '${NAME}' [y|N]? "
+ read STOP
+
+ STOP="$(echo ${STOP} | tr '[A-Z]' '[a-z]')"
+
+ case "${STOP}" in
+ y|yes)
+ ;;
+
+ *)
+ exit 1
+ ;;
+ esac
+fi
+
# Pre hooks
for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}"
do