From: Alyssa Ross <hi@alyssa.is>
To: devel@spectrum-os.org
Cc: Demi Marie Obenour <demiobenour@gmail.com>
Subject: [PATCH v2 6/7] host/rootfs: run transient VMs with persistence
Date: Sun, 14 Dec 2025 02:42:34 +0100 [thread overview]
Message-ID: <20251214014229.775825-12-hi@alyssa.is> (raw)
In-Reply-To: <20251214014229.775825-2-hi@alyssa.is>
This allows run-appimage and run-flatpak to be given the name of a
previously saved persistent directory. Further writes by the
application to that directory will also be persisted.
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
v2: new this round
host/rootfs/image/usr/bin/run-appimage | 16 +++++++++++++---
host/rootfs/image/usr/bin/run-flatpak | 15 +++++++++++++--
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/host/rootfs/image/usr/bin/run-appimage b/host/rootfs/image/usr/bin/run-appimage
index de851c52..24621065 100755
--- a/host/rootfs/image/usr/bin/run-appimage
+++ b/host/rootfs/image/usr/bin/run-appimage
@@ -26,13 +26,23 @@ if {
}
backtick diskdir {
- s6-setuidgid fs
-
- backtick -E mountpoint {
+ backtick mountpoint {
importas -Siu 1
findmnt -no TARGET -T $1
}
+ if -tn {
+ redirfd -w 2 /dev/null
+ multisubstitute {
+ importas -Siu mountpoint
+ importas -Siu 2
+ }
+ printf "%s/Spectrum/data/spectrum/storage/persist.%s\n" $mountpoint $2
+ }
+
+ s6-setuidgid fs
+
+ importas -Siu mountpoint
if { mkdir -p -- ${mountpoint}/Spectrum/data/spectrum/storage }
mktemp -d -- ${mountpoint}/Spectrum/data/spectrum/storage/tmp.XXXXXX
}
diff --git a/host/rootfs/image/usr/bin/run-flatpak b/host/rootfs/image/usr/bin/run-flatpak
index b47204c9..4123d329 100755
--- a/host/rootfs/image/usr/bin/run-flatpak
+++ b/host/rootfs/image/usr/bin/run-flatpak
@@ -26,6 +26,15 @@ if {
}
backtick diskdir {
+ if -tn {
+ redirfd -w 2 /dev/null
+ multisubstitute {
+ importas -Siu 1
+ importas -Siu 4
+ }
+ printf "%s/Spectrum/data/spectrum/storage/persist.%s\n" $1 $4
+ }
+
s6-setuidgid fs
importas -Siu 1
@@ -41,7 +50,9 @@ if {
multisubstitute {
importas -Siu id
importas -Siu diskdir
- elgetpositionals
+ importas -Siu 1
+ importas -Siu 2
+ importas -Siu 3
}
nsenter --preserve-credentials -S0
@@ -50,7 +61,7 @@ if {
cd /run/fs/${id}/config
if { redirfd -w 1 type echo flatpak }
- if { mount-flatpak $@ }
+ if { mount-flatpak $1 $2 $3 }
mount --bind -- $diskdir /run/fs/${id}/disk
}
--
2.51.0
next prev parent reply other threads:[~2025-12-14 1:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-14 1:42 [PATCH v2 1/7] host/rootfs: make fs root directories shared Alyssa Ross
2025-12-14 1:42 ` [PATCH v2 2/7] host/rootfs: give VMs a disk-backed directory Alyssa Ross
2025-12-14 12:55 ` Alyssa Ross
2025-12-14 1:42 ` [PATCH v2 3/7] host/rootfs: clean up obsolete tmp dirs on VM exit Alyssa Ross
2025-12-14 12:55 ` Alyssa Ross
2025-12-14 1:42 ` [PATCH v2 4/7] host/rootfs: clean up obsolete tmp dirs on mount Alyssa Ross
2025-12-14 12:55 ` Alyssa Ross
2025-12-14 1:42 ` [PATCH v2 5/7] tools/vm-set-persist.c: init Alyssa Ross
2025-12-14 4:52 ` Demi Marie Obenour
2025-12-14 10:49 ` Alyssa Ross
2025-12-14 12:55 ` Alyssa Ross
2025-12-14 1:42 ` Alyssa Ross [this message]
2025-12-14 12:55 ` [PATCH v2 6/7] host/rootfs: run transient VMs with persistence Alyssa Ross
2025-12-14 1:42 ` [PATCH v2 7/7] Documentation: document persistence Alyssa Ross
2025-12-14 12:55 ` Alyssa Ross
2025-12-14 12:55 ` [PATCH v2 1/7] host/rootfs: make fs root directories shared Alyssa Ross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251214014229.775825-12-hi@alyssa.is \
--to=hi@alyssa.is \
--cc=demiobenour@gmail.com \
--cc=devel@spectrum-os.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).