[PATCH 3/4] host/rootfs: clean up obsolete tmp dirs on VM exit

Alyssa Ross
2025-12-13T16:17:17Z

host/rootfs/image/usr/bin/run-appimage | 7 +++++--
host/rootfs/image/usr/bin/run-flatpak | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/host/rootfs/image/usr/bin/run-appimage b/host/rootfs/image/usr/bin/run-appimage
index f62844f8..de851c52 100755
--- a/host/rootfs/image/usr/bin/run-appimage
+++ b/host/rootfs/image/usr/bin/run-appimage
@@ -57,7 +57,10 @@ if {
mount --bind -- $diskdir disk
}

-importas -Siu id
+multisubstitute {
+ importas -Siu diskdir
+ importas -Siu id
+}

piperw 4 3
background {
@@ -76,4 +79,4 @@ fdclose 3
if { s6-instance-delete /run/service/vm-services $id }

if { umount -R /run/vm/by-id/${id}/ns }
-rm -r /run/vm/by-id/${id} /run/configs/${id}
+rm -r -- $diskdir /run/vm/by-id/${id} /run/configs/${id}
diff --git a/host/rootfs/image/usr/bin/run-flatpak b/host/rootfs/image/usr/bin/run-flatpak
index 9a7ffa33..b47204c9 100755
--- a/host/rootfs/image/usr/bin/run-flatpak
+++ b/host/rootfs/image/usr/bin/run-flatpak
@@ -55,7 +55,10 @@ if {
mount --bind -- $diskdir /run/fs/${id}/disk
}

-importas -Siu id
+multisubstitute {
+ importas -Siu diskdir
+ importas -Siu id
+}

if {
piperw 4 3
@@ -75,4 +78,4 @@ if {
if { s6-instance-delete -- /run/service/vm-services $id }

if { umount -R /run/vm/by-id/${id}/ns }
-rm -r /run/vm/by-id/${id} /run/configs/${id}
+rm -r -- $diskdir /run/vm/by-id/${id} /run/configs/${id}
--
2.51.0