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-46c... 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 {};