update calamares to support rootfsv1 and erofs

This commit is contained in:
Harald Sitter
2025-05-15 15:09:28 +02:00
parent aaf7eaab85
commit 1791c8a5e5
2 changed files with 50 additions and 19 deletions

View File

@@ -31,25 +31,44 @@ rm -rfv ./*
btrfs subvolume sync . || true
btrfs quota enable --simple .
btrfs send --compressed-data "/system/@kde-linux_$IMAGE_VERSION" | btrfs receive .
btrfs subvolume create @home
btrfs subvolume create @root
btrfs subvolume create @locale
btrfs subvolume create @snap
btrfs subvolume create @var-overlay
btrfs subvolume create @etc-overlay
mkdir @var-overlay/upper @var-overlay/work @etc-overlay/upper @etc-overlay/work
if grep "kde-linux.erofs=1" /proc/cmdline; then
btrfs subvolume create @system
mkdir @system/boot @system/proc @system/sys @system/dev @system/run @system/usr
cp /dev/gpt-auto-root kde-linux_$IMAGE_VERSION.erofs
# Overmount calamares' mount with the subvol mount
mount -o "subvol=@kde-linux_$IMAGE_VERSION" "$device" "$ROOT"
mount -t proc proc "$ROOT/proc"
mount -t sysfs sys "$ROOT/sys"
mount -o bind /dev "$ROOT/dev"
mount -t tmpfs tmpfs "$ROOT/run"
mkdir "$ROOT/run/udev"
mount -o bind /run/udev "$ROOT/run/udev"
mount -t efivarfs efivarfs "$ROOT/sys/firmware/efi/efivars"
_kde-linux-overlay "$device" "$ROOT"
# Overmount calamares' mount with the subvol mount
mount -o "subvol=@system" "$device" "$ROOT"
mount -t proc proc "$ROOT/proc"
mount -t sysfs sys "$ROOT/sys"
mount -o bind /dev "$ROOT/dev"
mount -t tmpfs tmpfs "$ROOT/run"
mkdir "$ROOT/run/udev" # This is not part of @system but rather the $ROOT (do not move this to the mkdir list of @system!)
mount -o bind /run/udev "$ROOT/run/udev"
mount -t efivarfs efivarfs "$ROOT/sys/firmware/efi/efivars"
mount -o ro,X-mount.subdir=usr /dev/gpt-auto-root "$ROOT/usr"
else
btrfs subvolume create @kde-linux_$IMAGE_VERSION
cp -ra /system/. @kde-linux_$IMAGE_VERSION
btrfs send --compressed-data "/system/@kde-linux_$IMAGE_VERSION" | btrfs receive .
btrfs subvolume create @home
btrfs subvolume create @root
btrfs subvolume create @locale
btrfs subvolume create @snap
btrfs subvolume create @var-overlay
btrfs subvolume create @etc-overlay
mkdir @var-overlay/upper @var-overlay/work @etc-overlay/upper @etc-overlay/work
# Overmount calamares' mount with the subvol mount
mount -o "subvol=@kde-linux_$IMAGE_VERSION" "$device" "$ROOT"
mount -t proc proc "$ROOT/proc"
mount -t sysfs sys "$ROOT/sys"
mount -o bind /dev "$ROOT/dev"
mount -t tmpfs tmpfs "$ROOT/run"
mkdir "$ROOT/run/udev" # This is not part of @system but rather the $ROOT (do not move this to the mkdir list of @system!)
mount -o bind /run/udev "$ROOT/run/udev"
mount -t efivarfs efivarfs "$ROOT/sys/firmware/efi/efivars"
_kde-linux-overlay "$device" "$ROOT"
fi
# ESP is a bit tricky. Find the block device of the root partition and then we'll ask systemd for an ESP on that device.
# ... and luks devices are even more tricky because we need to get the real device first
@@ -70,6 +89,18 @@ mount "$espdev" "$ROOT/boot"
# TODO: doing it this way means we can't factory reset flatpaks. Figure out what to do about that.
rm -rf "$ROOT/var/lib/flatpak"
cp -ra /system/@flatpak "$ROOT/var/lib/flatpak"
# TODO: fix in calamares (doesn't mkdir properly)
mkdir --parents "$ROOT/etc/sudoers.d/"
# Bit of a crutch to get systemd's base_filesystem_create() to run so the / gets populated with symlinks.
systemd-nspawn -D "$ROOT" "true" || true
# Initialize systemd stuff
systemd-sysusers --root="$ROOT"
# exclude /usr because some tmpfiles are rubbish and assume /usr is writable...
systemd-tmpfiles --root="$ROOT" --exclude-prefix=/usr --create
# Make sure presets are applied
systemctl --root="$ROOT" preset-all
systemctl --root="$ROOT" preset-all --global

View File

@@ -4,4 +4,4 @@
set -eux
flatpak install --noninteractive --assumeyes --sideload-repo=/system/@flatpak/.ostree/repo org.kde.dolphin org.kde.elisa org.kde.gwenview org.kde.okular org.kde.konsole org.kde.kate org.kde.kwrite org.kde.haruna org.kde.ark org.mozilla.firefox
flatpak install --noninteractive --assumeyes --sideload-repo=/usr/share/factory/var/lib/flatpak/.ostree/repo org.kde.dolphin org.kde.elisa org.kde.gwenview org.kde.okular org.kde.konsole org.kde.kate org.kde.kwrite org.kde.haruna org.kde.ark org.mozilla.firefox