From bf8972deffaf5732f824d772acbf98a4e0d69e81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sp=C3=B6hel?= Date: Thu, 24 Aug 2023 16:24:18 +0200 Subject: Poor cnt stop for vms (by killing them). --- libexec/container/stop | 16 ++++++++++++++-- 1 file 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 -- cgit v1.2.3