[kde-linux/kde-linux] /: Ship /live as its own erofs partition on the ISO
Hadi Chokr <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 81c5a33240adcfcde3002055e3eea41917704161 by Hadi Chokr.
Committed on 28/07/2026 at 13:59.
Pushed by silverhadch into branch 'master'.
Ship /live as its own erofs partition on the ISO
Part of #578
M +2 -0 .gitignore
M +8 -0 build.sh
M +0 -4 mkosi.extra/live/usr/lib/live-setup
M +23 -0 mkosi.extra/usr/lib/systemd/system-generators/kde-linux-live-generator
M +0 -1 mkosi.extra/usr/lib/systemd/system-preset/00-kde-linux.preset
M +3 -8 mkosi.extra/usr/lib/systemd/system/kde-linux-live-setup.service
A +11 -0 mkosi.repart/20-live.conf
https://invent.kde.org/kde-linux/kde-linux/-/commit/81c5a33240adcfcde3002055e3eea41917704161
diff --git a/.gitignore b/.gitignore
index 881d6c79..2d336cc7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,6 +37,8 @@ kde-linux_*
/etc-factory
+/live-root/
+
install.tar.zst
debug.tar.zst
packages.txt
diff --git a/build.sh b/build.sh
index e7865ecf..682bb743 100755
--- a/build.sh
+++ b/build.sh
@@ -186,6 +186,14 @@ rm "${OUTPUT}/usr/share/factory/boot/EFI/Linux/$LIVE_EFI"
rm -rf "$OUTPUT/var/lib/flatpak"
mkdir "$OUTPUT/var/lib/flatpak" # but keep a mountpoint around for the live session
+# Split /live out of the rootfs into its own erofs image. It becomes an extra
+# partition on the ISO (mkosi.repart/20-live.conf) and is mounted as a sysext by
+# run-extensions-live.mount, so installed systems never carry it.
+rm --recursive --force live-root
+mv "$OUTPUT/live" live-root
+time mkfs.erofs -zzstd -C 65536 --chunksize 65536 \
+ kde-linux.cache/live.raw live-root > erofs-live.log 2>&1
+
time mkfs.erofs -zzstd -C 65536 --chunksize 65536 "$ROOTFS_EROFS" "$OUTPUT" > erofs.log 2>&1
cp --reflink=auto "$ROOTFS_EROFS" kde-linux.cache/root.raw
diff --git a/mkosi.extra/live/usr/lib/live-setup b/mkosi.extra/live/usr/lib/live-setup
index 75a05d8e..a0bae049 100755
--- a/mkosi.extra/live/usr/lib/live-setup
+++ b/mkosi.extra/live/usr/lib/live-setup
@@ -22,10 +22,6 @@ if [ "$BOOTED_LABEL" != "KDELinuxLive" ]; then
exit 1
fi
-mkdir --mode 0755 -p /run
-mkdir --mode 0755 -p /run/extensions/
-# Mind that /live is only available if the erofs is mounted as rootfs. On the final system we selectively only mount usr from the erofs!
-ln -s /live /run/extensions/live
systemd-sysext refresh
useradd --create-home --comment "Live User" live
diff --git a/mkosi.extra/usr/lib/systemd/system-generators/kde-linux-live-generator b/mkosi.extra/usr/lib/systemd/system-generators/kde-linux-live-generator
index 32959901..67ce77f7 100755
--- a/mkosi.extra/usr/lib/systemd/system-generators/kde-linux-live-generator
+++ b/mkosi.extra/usr/lib/systemd/system-generators/kde-linux-live-generator
@@ -39,3 +39,26 @@ EOF
mkdir "$normal_dir/multi-user.target.wants/" || true
ln -sf ../var-lib-flatpak.mount "$normal_dir/multi-user.target.wants/var-lib-flatpak.mount"
+
+cat <<- EOF > "$normal_dir/run-extensions-live.mount"
+# Generated by $(basename "$0")
+[Unit]
+Description=KDE Linux Live Session Sysext
+Before=kde-linux-live-setup.service
+
+[Mount]
+What=/dev/disk/by-partlabel/KDELinuxLiveExt
+Where=/run/extensions/live
+Type=erofs
+Options=ro
+EOF
+
+ln -sf ../run-extensions-live.mount "$normal_dir/multi-user.target.wants/run-extensions-live.mount"
+
+# Pull in live-setup here so it stays unreachable on installed systems.
+mkdir "$normal_dir/multi-user.target.requires/" || true
+mkdir "$normal_dir/display-manager.service.requires/" || true
+ln -sf /usr/lib/systemd/system/kde-linux-live-setup.service \
+ "$normal_dir/multi-user.target.requires/kde-linux-live-setup.service"
+ln -sf /usr/lib/systemd/system/kde-linux-live-setup.service \
+ "$normal_dir/display-manager.service.requires/kde-linux-live-setup.service"
diff --git a/mkosi.extra/usr/lib/systemd/system-preset/00-kde-linux.preset b/mkosi.extra/usr/lib/systemd/system-preset/00-kde-linux.preset
index 461c2daf..d67b4be0 100644
--- a/mkosi.extra/usr/lib/systemd/system-preset/00-kde-linux.preset
+++ b/mkosi.extra/usr/lib/systemd/system-preset/00-kde-linux.preset
@@ -42,7 +42,6 @@ enable kde-linux-bootloader-visibility.service
enable kde-linux-btrfs.service
enable kde-linux-configure-firefox.path
enable kde-linux-iw-set-regdomain.path
-enable kde-linux-live-setup.service
enable kde-linux-openqa-setup.service
enable kde-linux-powertop.service
enable kde-linux-volatile-var-lib-flatpak.service
diff --git a/mkosi.extra/usr/lib/systemd/system/kde-linux-live-setup.service b/mkosi.extra/usr/lib/systemd/system/kde-linux-live-setup.service
index 8d399bc1..cd59faac 100644
--- a/mkosi.extra/usr/lib/systemd/system/kde-linux-live-setup.service
+++ b/mkosi.extra/usr/lib/systemd/system/kde-linux-live-setup.service
@@ -5,15 +5,10 @@
Description=KDE Linux Live Session Setup
Requires=systemd-logind.service
Before=display-manager.service
-After=systemd-logind.service systemd-homed.service
-ConditionPathExists=/live/usr/lib/live-setup
+After=run-extensions-live.mount systemd-logind.service systemd-homed.service
+ConditionPathExists=/run/extensions/live/usr/lib/live-setup
ConditionKernelCommandLine=kde-linux.live=1
[Service]
Type=oneshot
-ExecStart=/live/usr/lib/live-setup
-ExecStartPost=/usr/bin/systemctl disable %n
-
-[Install]
-RequiredBy=multi-user.target
-RequiredBy=display-manager.service
+ExecStart=/run/extensions/live/usr/lib/live-setup
diff --git a/mkosi.repart/20-live.conf b/mkosi.repart/20-live.conf
new file mode 100644
index 00000000..8b4e0700
--- /dev/null
+++ b/mkosi.repart/20-live.conf
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
+# SPDX-FileCopyrightText: 2026 Hadi Chokr <[email protected]>
+
+# The live-session sysext. Type is linux-generic rather than anything from the
+# discoverable partitions spec so systemd-gpt-auto-generator leaves it alone.
+
+[Partition]
+Type=linux-generic
+# Load-bearing: kde-linux-live-generator mounts this by-partlabel.
+Label=KDELinuxLiveExt
+CopyBlocks=/live.raw