summaryrefslogtreecommitdiffstats
path: root/libexec/container/stop
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xlibexec/container/stop30
1 files changed, 27 insertions, 3 deletions
diff --git a/libexec/container/stop b/libexec/container/stop
index cb85c8d..59c8b76 100755
--- a/libexec/container/stop
+++ b/libexec/container/stop
@@ -34,8 +34,8 @@ Parameters ()
{
OPTIONS_ALL=""
- GETOPT_LONGOPTIONS="name:,force,clean,verbose,"
- GETOPT_OPTIONS="n:,f,v,"
+ GETOPT_LONGOPTIONS="name:,force,interactive,clean,verbose,"
+ GETOPT_OPTIONS="n:,f,i,v,"
PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})"
@@ -62,6 +62,13 @@ Parameters ()
OPTIONS_ALL="${OPTIONS_ALL} --force"
;;
+ -i|--interactive)
+ INTERACTIVE="true"
+ shift 1
+
+ OPTIONS_ALL="${OPTIONS_ALL} --interactive"
+ ;;
+
--clean)
# internal option
CLEAN="true"
@@ -92,7 +99,7 @@ Parameters ()
Usage ()
{
- echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force] [-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."
@@ -273,6 +280,23 @@ case "${FORCE}" in
;;
esac
+if [ "${FORCE}" != "true" ] || [ "${INTERACTIVE}" = "true" ]
+then
+ echo -n "'${NAME}': stop container '${NAME}' [y|N]? "
+ read STOP
+
+ STOP="$(echo ${STOP} | tr '[A-Z]' '[a-z]')"
+
+ case "${STOP}" in
+ y|yes)
+ ;;
+
+ *)
+ exit 1
+ ;;
+ esac
+fi
+
# Run
case "${VERBOSE}" in
true)