commit 7bced45c31d8d1725c5f8dd8f29dc08a957d99e1
parent f17bbd723a7218658bfeeb7ec91e226cc260d267
Author: Divan Visagie <me@divanv.com>
Date: Fri, 16 Oct 2026 00:39:29 +0200
vm/clean.sh: stop the VM and delete out/, podman's root-owned files through a container; --all also the registry and the image
Diffstat:
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/vm/README.md b/vm/README.md
@@ -13,6 +13,7 @@ vm/vm.sh ssh [cmd] a root shell, or a command
vm/vm.sh console boot it on this terminal instead (Ctrl-a x quits)
vm/vm.sh log follow the serial console
vm/vm.sh stop power it off
+vm/clean.sh stop it and delete out/ (--all: the registry and the image too)
```
Trying an update:
diff --git a/vm/clean.sh b/vm/clean.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+# Removes what the VM scripts made: stops the VM and deletes out/ (disks, key,
+# logs, and podman's storage, whose files belong to root, so they're deleted
+# from a container). With --all, also the registry, its images and the built
+# image.
+source "$(dirname "$0")/common.sh"
+
+"$ROOT/vm/vm.sh" stop
+if [[ -d "$OUT/containers" ]]; then
+ docker run --rm -v "$OUT:/out" docker.io/library/ubuntu:26.04 rm -rf /out/containers
+fi
+rm -rf "$OUT"
+say "removed out/"
+
+if [[ "${1:-}" == --all ]]; then
+ docker rm -f "$REGISTRY_NAME" >/dev/null 2>&1 || true
+ docker volume rm patina-os-registry >/dev/null 2>&1 || true
+ docker image rm "$IMAGE" >/dev/null 2>&1 || true
+ say "removed the registry and $IMAGE"
+fi