Since lsvm ignores empty directories, we can just leave them around to prevent mktemp -d from reusing the name. Fixes: b51a97f ("host/rootfs: add run-appimage program") Signed-off-by: Alyssa Ross <hi@alyssa.is> --- host/rootfs/image/usr/bin/run-appimage | 7 ++++--- host/rootfs/image/usr/bin/run-flatpak | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/host/rootfs/image/usr/bin/run-appimage b/host/rootfs/image/usr/bin/run-appimage index d61a79c6..27c6e093 100755 --- a/host/rootfs/image/usr/bin/run-appimage +++ b/host/rootfs/image/usr/bin/run-appimage @@ -44,8 +44,9 @@ if { s6-instance-delete /run/service/vm-services $id } if { umount ${dir}/mount } # mount namespace if { umount ${dir}/mount } # private bind mount -# Atomically swap the VM directory with an empty one, which will be ignored by -# lsvm, then remove it, so we never have half a VM directory. +# Atomically replace the VM directory with an empty one, +# which will keep holding the ID so it's not reused, +# but be ignored by lsvm. if { mkdir /run/vm/by-id/.${id} } if { exch /run/vm/by-id/.${id} $dir } -background { rm -rf /run/vm/by-id/.${id} $dir } +background { rm -rf /run/vm/by-id/.${id} } diff --git a/host/rootfs/image/usr/bin/run-flatpak b/host/rootfs/image/usr/bin/run-flatpak index 6be21075..0cb236f4 100755 --- a/host/rootfs/image/usr/bin/run-flatpak +++ b/host/rootfs/image/usr/bin/run-flatpak @@ -46,8 +46,9 @@ if { s6-instance-delete -- /run/service/vm-services $id } if { umount ${dir}/mount } # mount namespace if { umount ${dir}/mount } # private bind mount -# Atomically swap the VM directory with an empty one, which will be ignored by -# lsvm, then remove it, so we never have half a VM directory. +# Atomically replace the VM directory with an empty one, +# which will keep holding the ID so it's not reused, +# but be ignored by lsvm. if { mkdir /run/vm/by-id/.${id} } if { exch /run/vm/by-id/.${id} $dir } -background { rm -rf /run/vm/by-id/.${id} $dir } +background { rm -rf /run/vm/by-id/.${id} } -- 2.51.0