From 0fca311aecbe2d112bb844a4c861bc8be0f653ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sp=C3=B6hel?= Date: Thu, 24 Aug 2023 16:36:59 +0200 Subject: basic cnt rm support. --- libexec/container/remove | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'libexec') diff --git a/libexec/container/remove b/libexec/container/remove index 4cb5d48..fe9b18b 100755 --- a/libexec/container/remove +++ b/libexec/container/remove @@ -27,12 +27,13 @@ COMMAND="$(basename ${0})" CONFIG="/etc/${SOFTWARE}/config" HOOKS="/etc/${SOFTWARE}/hooks" MACHINES="/var/lib/machines" +VMS="/srv/container/vms" Parameters () { OPTIONS_ALL="" - GETOPT_LONGOPTIONS="name:,allow-stop,force,verbose," + GETOPT_LONGOPTIONS="name:,allow-stop,force,verbose,vm" GETOPT_OPTIONS="n:,f,v," PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${COMMAND} --options ${GETOPT_OPTIONS} --shell sh -- ${@})" @@ -74,6 +75,11 @@ Parameters () OPTIONS_ALL="${OPTIONS_ALL} --verbose" ;; + --vm) + VM="true" + shift 1 + ;; + --) shift 1 break @@ -243,6 +249,13 @@ case "${VERBOSE}" in esac rm --preserve-root --one-file-system -rf ${RM_OPTIONS} "${MACHINES}/${NAME}" + +case ${VM} in + true) + rm --preserve-root --one-file-system -rf ${RM_OPTIONS} "${VMS}/${NAME}" + ;; +esac + rm -f ${RM_OPTIONS} "${CONFIG}/${NAME}.conf" case "${VERBOSE}" in -- cgit v1.2.3