From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 6D0291EABB; Thu, 13 Nov 2025 12:05:18 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id D43B61EA18; Thu, 13 Nov 2025 12:05:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_MISSING,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 Received: from fhigh-a2-smtp.messagingengine.com (fhigh-a2-smtp.messagingengine.com [103.168.172.153]) by atuin.qyliss.net (Postfix) with ESMTPS id 334C21EA16 for ; Thu, 13 Nov 2025 12:05:10 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 28C9F140020E for ; Thu, 13 Nov 2025 07:05:09 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Thu, 13 Nov 2025 07:05:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1763035509; x= 1763121909; bh=N8My8ztsr0UGYwHyUcfpJKqKxl4ssAuvZZpHnOOw4EE=; b=I fsI6ZWmboCmAxTS0O5yeXlJW0NTJqlXr3wJgQqFQ1LPKD0GaQ3eWAwg7xId6n/Jo JmCaVX72Zt/aDOlmU0tvAqKiHhyzeJNJOlbl0M/1OcJC5SXN9/gv2GrU27Mbrv1z casSPhfDfQg4NOyOmLp4n71uEKD6p3/hqFTl1rmQwpikHkN0KoK66Z2TdnTyeKkD 5Z/NAlYOuVOeoP+uTU/fLh+66BWmQq9Dm/02cNfiv5fWGjveD3ZeHlylvdsODWGx 0owwN26wdtKu1oKhOWCuB1Q85T8nu37SN2uBOYPKBXS7SbLkMbTjL6BmKeGzN8R8 lIXz1apCNpoI7uczl21Ew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1763035509; x=1763121909; bh=N8My8ztsr0UGYwHyUcfpJKqKxl4s sAuvZZpHnOOw4EE=; b=w34og1ACkGihhAZwIn/B3dcvLdmPl6J8tWpyQVbAFMOt jGIU4fDdQtHddwnxIjSTqnwQ+vCmU3Eshih32yVQsqtfsOj+y5B/v7EtDyuzjjYm MuMiMCmKmqnA0wpq6DQfjER9sOMjrKwUKrZpyNToB8ANGOSFGCanGs05YevK/F5i tK+ti14ykhabXnSN1jeT267OqZ0a1AlxU2N0o63EW5qN9RJyd9U7o/GanSCOVBC5 pdJJOlT9x1I8+vReoE77KKBjutoATTWsRrW96V5ri2lMgJ1K5Wm8Je5X5HATlJB0 DwKMjvrNgPe/gMSFQ0Lpz30tFbVlMQXaK57L3deQvg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvtdeikeelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekredtre dttdenucfhrhhomheptehlhihsshgrucftohhsshcuoehhihesrghlhihsshgrrdhisheq necuggftrfgrthhtvghrnhepgfefudekvdelieelledufeevheeglefggedvudejvddtff euueevffehleejkedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhephhhisegrlhihshhsrgdrihhspdhnsggprhgtphhtthhopedupdhmohguvg epshhmthhpohhuthdprhgtphhtthhopeguvghvvghlsehsphgvtghtrhhumhdqohhsrdho rhhg X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 13 Nov 2025 07:05:08 -0500 (EST) Received: by fw12.qyliss.net (Postfix, from userid 1000) id 056C8139BE59; Thu, 13 Nov 2025 13:05:08 +0100 (CET) From: Alyssa Ross To: devel@spectrum-os.org Subject: [PATCH 3/3] host/rootfs: add run-flatpak script Date: Thu, 13 Nov 2025 13:04:52 +0100 Message-ID: <20251113120452.65711-3-hi@alyssa.is> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251113120452.65711-1-hi@alyssa.is> References: <20251113120452.65711-1-hi@alyssa.is> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: L5W7A6DPNFJS47XFKQTS74AQZHRKEV4V X-Message-ID-Hash: L5W7A6DPNFJS47XFKQTS74AQZHRKEV4V X-MailFrom: hi@alyssa.is X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; header-match-devel.spectrum-os.org-3; header-match-devel.spectrum-os.org-4; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This is the entrypoint for running Flatpak applications. It would be good to only add mounts for the VM in virtiofsd's mount namespace, so we don't need to do lots of manual unmounts, but that's a wider change affecting more than just Flatpak. Signed-off-by: Alyssa Ross --- host/rootfs/file-list.mk | 1 + host/rootfs/image/usr/bin/run-flatpak | 56 +++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100755 host/rootfs/image/usr/bin/run-flatpak diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk index 9acaa1d..a796b90 100644 --- a/host/rootfs/file-list.mk +++ b/host/rootfs/file-list.mk @@ -48,6 +48,7 @@ FILES = \ image/usr/bin/assign-devices \ image/usr/bin/create-vm-dependencies \ image/usr/bin/run-appimage \ + image/usr/bin/run-flatpak \ image/usr/bin/run-vmm \ image/usr/bin/vm-console \ image/usr/bin/vm-import \ diff --git a/host/rootfs/image/usr/bin/run-flatpak b/host/rootfs/image/usr/bin/run-flatpak new file mode 100755 index 0000000..39ee17b --- /dev/null +++ b/host/rootfs/image/usr/bin/run-flatpak @@ -0,0 +1,56 @@ +#!/bin/execlineb -S2 +# SPDX-License-Identifier: EUPL-1.2+ +# SPDX-FileCopyrightText: 2024 Alyssa Ross + +backtick -E dir { mktemp -d /run/vm/by-id/XXXXXX } +backtick -E id { basename -- $dir } + +if { mkdir -p /run/configs/${id}/fs } +if { redirfd -w 1 /run/configs/${id}/fs/type echo flatpak } +if { cd /run/configs/${id}/fs mount-flatpak $1 $2 } +if { + ln -s /usr/lib/spectrum/img/appvm/blk /usr/lib/spectrum/img/appvm/vmlinux + /run/configs/${id} +} + +if { ln -s /run/configs/${id} ${dir}/config } + +if { create-vm-dependencies $id } + +piperw 4 3 +background { + fdclose 3 + fdmove 0 4 + + # Wait for the VMM to be up, then start the VM. + if { redirfd -w 1 /dev/null head -1 } + vm-start $id +} +fdclose 4 + +foreground { run-vmm $id } +fdclose 3 + +if { + forx -pE service { + dbus + vhost-user-fs + vhost-user-gpu + xdg-desktop-portal-spectrum-host + } + s6-instance-delete /run/service/${service} $id +} + +if { + elglob -0 flatpak_dir_mounts /run/configs/${id}/fs/flatpak/*/*/*/*/* + forx -E mount { + ${dir}/fs/doc + /run/configs/${id}/fs/flatpak/repo/config + $flatpak_dir_mounts + /run/configs/${id}/fs/flatpak + ${dir}/fs/config + } + umount $mount +} + +rm -r $dir /run/configs/${id} -- 2.51.0