patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: "Johannes Süllner" <johannes.suellner@mailbox.org>
To: devel@spectrum-os.org
Cc: "Johannes Süllner" <johannes.suellner@mailbox.org>
Subject: [PATCH 2/4] host/rootfs: integrate spectrum-installer
Date: Sun,  4 Jan 2026 15:00:21 +0100	[thread overview]
Message-ID: <20260104140102.106960-6-johannes.suellner@mailbox.org> (raw)
In-Reply-To: <20260104140102.106960-5-johannes.suellner@mailbox.org>

The installer needs to run as root, so that `systemd-repart` can write
to disks. Since Weston is not running as root (since b26f59e), just as
with the root terminal, we add a s6-sudod service for the installer.

Signed-off-by: Johannes Süllner <johannes.suellner@mailbox.org>
---
 host/rootfs/default.nix                         |  4 ++--
 host/rootfs/file-list.mk                        |  3 +++
 .../spectrum-installer-as-root/notification-fd  |  1 +
 .../notification-fd.license                     |  2 ++
 .../service/spectrum-installer-as-root/run      | 17 +++++++++++++++++
 host/rootfs/image/etc/s6-rc/weston/run          |  1 +
 host/rootfs/image/etc/xdg/weston/weston.ini     |  5 +++++
 .../image/usr/bin/spectrum-installer-as-root    |  5 +++++
 pkgs/default.nix                                |  2 ++
 9 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 host/rootfs/image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/notification-fd
 create mode 100644 host/rootfs/image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/notification-fd.license
 create mode 100755 host/rootfs/image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/run
 create mode 100755 host/rootfs/image/usr/bin/spectrum-installer-as-root

diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
index 66aa366..f53d3e3 100644
--- a/host/rootfs/default.nix
+++ b/host/rootfs/default.nix
@@ -4,7 +4,7 @@
 
 import ../../lib/call-package.nix (
 { callSpectrumPackage, config, spectrum-build-tools
-, src, pkgsMusl, inkscape, linux_latest, xorg
+, src, pkgsMusl, inkscape, linux_latest, spectrum-installer, xorg
 }:
 pkgsMusl.callPackage (
 
@@ -62,7 +62,7 @@ let
   # https://inbox.vuxu.org/musl/20251017-dlopen-use-rpath-of-caller-dso-v1-1-46c69eda1473@iscas.ac.cn/
   usrPackages = [
     appvm dejavu_fonts firmware kernel.modules kmod.lib lvm2 mesa
-    netvm systemd westonLite
+    netvm spectrum-installer systemd westonLite
   ];
 
   appvms = {
diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk
index 3899d62..54d8e00 100644
--- a/host/rootfs/file-list.mk
+++ b/host/rootfs/file-list.mk
@@ -25,6 +25,8 @@ FILES = \
 	image/etc/s6-linux-init/run-image/service/serial-getty/notification-fd \
 	image/etc/s6-linux-init/run-image/service/serial-getty/run \
 	image/etc/s6-linux-init/run-image/service/serial-getty/template/run \
+	image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/notification-fd \
+	image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/run \
 	image/etc/s6-linux-init/run-image/service/vm-services/notification-fd \
 	image/etc/s6-linux-init/run-image/service/vm-services/run \
 	image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/dbus/notification-fd \
@@ -62,6 +64,7 @@ FILES = \
 	image/usr/bin/run-appimage \
 	image/usr/bin/run-flatpak \
 	image/usr/bin/run-vmm \
+	image/usr/bin/spectrum-installer-as-root \
 	image/usr/bin/spectrum-update \
 	image/usr/bin/vm-console \
 	image/usr/bin/vm-import \
diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/notification-fd b/host/rootfs/image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/notification-fd
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/host/rootfs/image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/notification-fd
@@ -0,0 +1 @@
+3
diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/notification-fd.license b/host/rootfs/image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/notification-fd.license
new file mode 100644
index 0000000..0d3d47c
--- /dev/null
+++ b/host/rootfs/image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/notification-fd.license
@@ -0,0 +1,2 @@
+SPDX-License-Identifier: CC0-1.0
+SPDX-FileCopyrightText: 2025 Alyssa Ross <hi@alyssa.is>
diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/run
new file mode 100755
index 0000000..a8ab652
--- /dev/null
+++ b/host/rootfs/image/etc/s6-linux-init/run-image/service/spectrum-installer-as-root/run
@@ -0,0 +1,17 @@
+#!/bin/execlineb -PW
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Alyssa Ross <hi@alyssa.is>
+
+s6-ipcserver-socketbinder -a 0700 /run/spectrum-installer-as-root
+
+if { chown wayland /run/spectrum-installer-as-root }
+
+fdmove 1 3
+s6-ipcserverd -1P
+
+exec -c
+/bin/export PATH /usr/bin
+/bin/export WAYLAND_DISPLAY ""
+s6-sudod
+cd /
+spectrum-installer
diff --git a/host/rootfs/image/etc/s6-rc/weston/run b/host/rootfs/image/etc/s6-rc/weston/run
index 364c032..e677ec4 100644
--- a/host/rootfs/image/etc/s6-rc/weston/run
+++ b/host/rootfs/image/etc/s6-rc/weston/run
@@ -63,6 +63,7 @@ bwrap
   # For udev
   --ro-bind /run/udev /run/udev
   --bind /run/root-terminal /run/root-terminal
+  --bind /run/spectrum-installer-as-root /run/spectrum-installer-as-root
   --tmpfs /tmp
   --tmpfs /dev/shm
   # Filtered /proc (without nasty stuff)
diff --git a/host/rootfs/image/etc/xdg/weston/weston.ini b/host/rootfs/image/etc/xdg/weston/weston.ini
index a4763c6..f21041e 100644
--- a/host/rootfs/image/etc/xdg/weston/weston.ini
+++ b/host/rootfs/image/etc/xdg/weston/weston.ini
@@ -13,3 +13,8 @@ path=/bin/root-terminal
 icon=/usr/share/icons/hicolor/20x20/apps/com.system76.CosmicFiles.png
 displayname=Files
 path=/bin/cosmic-files
+
+[launcher]
+icon=/usr/share/icons/hicolor/22x22/apps/spectrum-installer.png
+displayname=Spectrum installer
+path=/bin/spectrum-installer-as-root
diff --git a/host/rootfs/image/usr/bin/spectrum-installer-as-root b/host/rootfs/image/usr/bin/spectrum-installer-as-root
new file mode 100755
index 0000000..c03d3ac
--- /dev/null
+++ b/host/rootfs/image/usr/bin/spectrum-installer-as-root
@@ -0,0 +1,5 @@
+#!/bin/execlineb -Ws0
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2025 Alyssa Ross <hi@alyssa.is>
+
+s6-sudo -- /run/spectrum-installer-as-root $@
diff --git a/pkgs/default.nix b/pkgs/default.nix
index a80c5b3..5849e58 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -50,6 +50,8 @@ let
       appSupport = false;
       driverSupport = true;
     };
+    spectrum-installer =
+      self.callSpectrumPackage ../tools/spectrum-installer {};
     spectrum-router = self.callSpectrumPackage ../tools/router {};
     xdg-desktop-portal-spectrum-host =
       self.callSpectrumPackage ../tools/xdg-desktop-portal-spectrum-host {};

  reply	other threads:[~2026-01-04 14:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-04 14:00 [PATCH 1/4] tools: add spectrum-installer Johannes Süllner
2026-01-04 14:00 ` Johannes Süllner [this message]
2026-01-04 14:00 ` [PATCH 3/4] release: drop combined and installer image Johannes Süllner
2026-01-04 14:00 ` [PATCH 4/4] release/live: remove B slot from live image and reduce A slot size Johannes Süllner
2026-01-04 21:16   ` Demi Marie Obenour
2026-01-04 21:13 ` [PATCH 1/4] tools: add spectrum-installer Demi Marie Obenour
2026-01-11 18:30   ` Johannes Süllner
2026-01-10 21:04 ` Alyssa Ross
2026-01-18  8:54   ` Johannes Süllner

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=20260104140102.106960-6-johannes.suellner@mailbox.org \
    --to=johannes.suellner@mailbox.org \
    --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).