diff options
Diffstat (limited to 'libexec')
-rwxr-xr-x | libexec/container/stop | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libexec/container/stop b/libexec/container/stop index 8ca98ce..06bf769 100755 --- a/libexec/container/stop +++ b/libexec/container/stop @@ -34,7 +34,7 @@ Parameters () { OPTIONS_ALL="" - GETOPT_LONGOPTIONS="name:,force,interactive,kill,clean,stateless,verbose," + GETOPT_LONGOPTIONS="name:,force,interactive,kill,clean,stateless,verbose,vm," GETOPT_OPTIONS="n:,f,i,k,v," PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})" @@ -99,6 +99,11 @@ Parameters () OPTIONS_ALL="${OPTIONS_ALL} --verbose" ;; + --vm) + VM="true" + shift 1 + ;; + --) shift 1 break @@ -114,7 +119,7 @@ Parameters () Usage () { - echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force] [-i|--interactive] [-v|--verbose]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} -n|--name NAME [-f|--force] [-i|--interactive] [-v|--verbose] [--vm]" >&2 echo echo "See ${COMMAND}(1), ${PROGRAM}(1) and ${PROJECT}(7) for more information." @@ -162,6 +167,13 @@ case "${NAME}" in ;; esac +case "${VM}" in + true) + systemctl stop "qemu@${NAME}.service" || exit 1 + exit 0 + ;; +esac + if [ ! -e "${MACHINES}/${NAME}" ] then echo "'${NAME}': no such container" >&2 |