summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.forgejo/workflows/build-theme-send-core-repo.yml15
-rw-r--r--raveos-calamares-theme/PKGBUILD2
-rw-r--r--raveos-calamares-theme/etc/calamares/modules/calamares-create-snapshots-subvol.sh49
-rw-r--r--raveos-calamares-theme/etc/calamares/modules/calamares-normalize-subvolumes.sh88
-rw-r--r--raveos-calamares-theme/etc/calamares/modules/partition.conf33
-rw-r--r--raveos-calamares-theme/etc/calamares/modules/shellprocess-loader.conf12
6 files changed, 198 insertions, 1 deletions
diff --git a/.forgejo/workflows/build-theme-send-core-repo.yml b/.forgejo/workflows/build-theme-send-core-repo.yml
index 108dbfe..2dc65b4 100644
--- a/.forgejo/workflows/build-theme-send-core-repo.yml
+++ b/.forgejo/workflows/build-theme-send-core-repo.yml
@@ -226,6 +226,21 @@ jobs:
makepkg -s --noconfirm -f
cp -v build/raveos-welcome-*.pkg.tar.zst /tmp/builtpkgs/
+ - name: Build raveos-plymouth-theme
+ run: |
+ set -euo pipefail
+ CORE="/tmp/raveos-core-repo/x86_64"
+ cd raveos-plymouth-theme
+ PKGVER=$(grep '^pkgver=' PKGBUILD | cut -d= -f2)
+ PKGREL=$(grep '^pkgrel=' PKGBUILD | cut -d= -f2)
+ if ls "$CORE/raveos-plymouth-theme-${PKGVER}-${PKGREL}-"*.pkg.tar.zst 2>/dev/null | grep -q .; then
+ echo "raveos-plymouth-theme ${PKGVER}-${PKGREL} unchanged -> skip"
+ exit 0
+ fi
+ rm -f *.pkg.tar.zst || true
+ makepkg -s --noconfirm -f
+ cp -v raveos-plymouth-theme-*.pkg.tar.zst /tmp/builtpkgs/
+
- name: Sign built packages
run: |
set -euo pipefail
diff --git a/raveos-calamares-theme/PKGBUILD b/raveos-calamares-theme/PKGBUILD
index ef0933f..0500c0b 100644
--- a/raveos-calamares-theme/PKGBUILD
+++ b/raveos-calamares-theme/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: AlexC <alexc@alexc.hu>
pkgname=raveos-calamares-theme
pkgver=2.0.0
-pkgrel=40
+pkgrel=44
pkgdesc="RaveOS Calamares Theme"
arch=('any')
url="https://git.rp1.hu/RaveOS"
diff --git a/raveos-calamares-theme/etc/calamares/modules/calamares-create-snapshots-subvol.sh b/raveos-calamares-theme/etc/calamares/modules/calamares-create-snapshots-subvol.sh
new file mode 100644
index 0000000..092b7b9
--- /dev/null
+++ b/raveos-calamares-theme/etc/calamares/modules/calamares-create-snapshots-subvol.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+set -e
+
+echo ">>> [snapshots-subvol] Running INSIDE target system"
+
+# Calamares' partition module ignores our btrfsSubvolumes config here and
+# always creates its own hardcoded set (/home /root /srv /var/cache
+# /var/log /var/tmp as separate subvolumes) -- there's no ".snapshots"
+# subvolume among them, which grub-btrfs/Snapper need. Create it by hand
+# as a proper top-level (subvolid=5) sibling of the other subvolumes,
+# so snapshots of "/" don't recursively include the snapshot store itself.
+
+ROOT_DEV="$(findmnt -no SOURCE / | sed 's/\[.*\]//')"
+ROOT_FS="$(findmnt -no FSTYPE /)"
+
+if [ "$ROOT_FS" != "btrfs" ]; then
+ echo ">>> [snapshots-subvol] Root is not btrfs (${ROOT_FS}), skipping."
+ exit 0
+fi
+
+if [ -d /.snapshots ] && findmnt -no SOURCE /.snapshots >/dev/null 2>&1; then
+ echo ">>> [snapshots-subvol] /.snapshots already mounted, skipping."
+ exit 0
+fi
+
+mkdir -p /mnt/topvol
+mount -o subvolid=5 "${ROOT_DEV}" /mnt/topvol
+
+if [ ! -d /mnt/topvol/@snapshots ]; then
+ btrfs subvolume create /mnt/topvol/@snapshots
+ echo ">>> [snapshots-subvol] Created @snapshots subvolume"
+else
+ echo ">>> [snapshots-subvol] @snapshots subvolume already exists"
+fi
+
+umount /mnt/topvol
+rmdir /mnt/topvol
+
+mkdir -p /.snapshots
+
+ROOT_UUID="$(blkid -s UUID -o value "${ROOT_DEV}")"
+if ! grep -q '/.snapshots' /etc/fstab; then
+ echo "UUID=${ROOT_UUID} /.snapshots btrfs rw,noatime,compress=zstd:3,discard=async,space_cache=v2,subvol=/@snapshots 0 0" >> /etc/fstab
+ echo ">>> [snapshots-subvol] Added /.snapshots to fstab"
+fi
+
+mount /.snapshots
+
+echo ">>> [snapshots-subvol] Done."
diff --git a/raveos-calamares-theme/etc/calamares/modules/calamares-normalize-subvolumes.sh b/raveos-calamares-theme/etc/calamares/modules/calamares-normalize-subvolumes.sh
new file mode 100644
index 0000000..83b42c4
--- /dev/null
+++ b/raveos-calamares-theme/etc/calamares/modules/calamares-normalize-subvolumes.sh
@@ -0,0 +1,88 @@
+#!/bin/bash
+set -e
+
+echo ">>> [subvol-normalize] Running INSIDE target system"
+
+ROOT_DEV="$(findmnt -no SOURCE / | sed 's/\[.*\]//')"
+ROOT_FS="$(findmnt -no FSTYPE /)"
+
+if [ "$ROOT_FS" != "btrfs" ]; then
+ echo ">>> [subvol-normalize] Root is not btrfs (${ROOT_FS}), skipping."
+ exit 0
+fi
+
+# Calamares' partition module ignores our btrfsSubvolumes config entirely
+# and always creates its own hardcoded set: @, @home, @root, @srv, @cache,
+# @log, @tmp. We only want @, @home, @log, @pkg (just /var/cache/pacman/pkg,
+# not all of /var/cache) and @snapshots (created separately). Drop the rest
+# here, after everything else has already run, merging any content back
+# into the parent (@) subvolume first.
+
+mkdir -p /mnt/topvol
+mount -o subvolid=5 "${ROOT_DEV}" /mnt/topvol
+
+unmount_retry() {
+ local path="$1"
+ local i
+ for i in 1 2 3 4 5; do
+ if umount "$path" 2>/dev/null; then
+ return 0
+ fi
+ fuser -km "$path" >/dev/null 2>&1 || true
+ sleep 1
+ done
+ umount -l "$path" 2>/dev/null || true
+}
+
+for entry in "root:@root" "srv:@srv" "var/tmp:@tmp"; do
+ path="/${entry%%:*}"
+ subvol="${entry##*:}"
+ if findmnt -no SOURCE "$path" >/dev/null 2>&1; then
+ echo ">>> [subvol-normalize] Removing separate subvolume ${subvol} (${path})"
+ unmount_retry "$path"
+ # $path is now a plain empty dir in @ again -- copy the old
+ # subvolume's content back into it before deleting the subvolume.
+ if [ -d "/mnt/topvol/${subvol}" ] && ! findmnt -no SOURCE "$path" >/dev/null 2>&1; then
+ cp -a "/mnt/topvol/${subvol}/." "$path/" 2>/dev/null || true
+ btrfs subvolume delete "/mnt/topvol/${subvol}" || true
+ fi
+ fi
+ sed -i "\#[[:space:]]${path}[[:space:]]#d" /etc/fstab
+done
+
+# Narrow /var/cache: drop the whole-@cache subvolume (keep it as a plain
+# directory), and create a dedicated @pkg subvolume just for pacman's
+# package cache -- that's the only part of /var/cache archinstall separates.
+if findmnt -no SOURCE /var/cache >/dev/null 2>&1; then
+ echo ">>> [subvol-normalize] Narrowing /var/cache -> only pacman/pkg as @pkg"
+ unmount_retry /var/cache
+ if [ -d /mnt/topvol/@cache ] && ! findmnt -no SOURCE /var/cache >/dev/null 2>&1; then
+ cp -a /mnt/topvol/@cache/. /var/cache/ 2>/dev/null || true
+ btrfs subvolume delete /mnt/topvol/@cache || true
+ fi
+fi
+sed -i "\#[[:space:]]/var/cache[[:space:]]#d" /etc/fstab
+
+if [ ! -d /mnt/topvol/@pkg ]; then
+ btrfs subvolume create /mnt/topvol/@pkg
+ echo ">>> [subvol-normalize] Created @pkg subvolume"
+fi
+
+unmount_retry /mnt/topvol
+rmdir /mnt/topvol 2>/dev/null || true
+
+mkdir -p /var/cache/pacman
+rm -rf /var/cache/pacman/pkg
+mkdir -p /var/cache/pacman/pkg
+
+ROOT_UUID="$(blkid -s UUID -o value "${ROOT_DEV}")"
+MOUNT_OPTS="rw,noatime,compress=zstd:3,discard=async,space_cache=v2"
+if ! grep -q '/var/cache/pacman/pkg' /etc/fstab; then
+ echo "UUID=${ROOT_UUID} /var/cache/pacman/pkg btrfs ${MOUNT_OPTS},subvol=/@pkg 0 0" >> /etc/fstab
+ echo ">>> [subvol-normalize] Added /var/cache/pacman/pkg to fstab"
+fi
+
+mount /var/cache/pacman/pkg
+
+echo ">>> [subvol-normalize] Done. Final subvolume list:"
+btrfs subvolume list /
diff --git a/raveos-calamares-theme/etc/calamares/modules/partition.conf b/raveos-calamares-theme/etc/calamares/modules/partition.conf
index b0a9951..732a5df 100644
--- a/raveos-calamares-theme/etc/calamares/modules/partition.conf
+++ b/raveos-calamares-theme/etc/calamares/modules/partition.conf
@@ -158,6 +158,28 @@ defaultFileSystemType: "ext4"
# warning (this matches traditional no-choice-available behavior best).
availableFileSystemTypes: ["ext4","btrfs"]
+# Btrfs subvolume layout, used whenever btrfs is picked (erase mode).
+#
+# Without this, Calamares falls back to a single flat "@" subvolume for
+# the whole root filesystem -- no separate @home/@log/@pkg, and no
+# @.snapshots. That breaks tools that expect the standard Arch layout
+# (e.g. grub-btrfs, which looks for snapshot subvolumes to build its GRUB
+# submenu, and Snapper, which is picky about which subvolume it manages).
+#
+# This mirrors archinstall's default btrfs layout, see:
+# https://gitlab.archlinux.org/archlinux/archinstall/-/blob/master/archinstall/lib/disk/disk_menu.py
+btrfsSubvolumes:
+ - mountPoint: /
+ subvolume: /@
+ - mountPoint: /home
+ subvolume: /@home
+ - mountPoint: /var/log
+ subvolume: /@log
+ - mountPoint: /var/cache/pacman/pkg
+ subvolume: /@pkg
+ - mountPoint: /.snapshots
+ subvolume: /@snapshots
+
# Show/hide LUKS related functionality in automated partitioning modes.
# Disable this if you choose not to deploy early unlocking support in GRUB2
# and/or your distribution's initramfs solution.
@@ -217,6 +239,17 @@ availableFileSystemTypes: ["ext4","btrfs"]
# sectors-per-cluster: 128
# size: 100%
#
+
+# btrfsSubvolumes (above) is only honoured when a custom partitionLayout is
+# in effect -- Calamares' own hardcoded btrfs subvolume defaults are used
+# otherwise, even in plain "erase disk" automatic mode. "unknown" here means
+# the user's actual filesystem choice (ext4 or btrfs) is used, same as the
+# no-custom-layout default -- this just exists to make btrfsSubvolumes apply.
+partitionLayout:
+ - name: "rootfs"
+ filesystem: "unknown"
+ mountPoint: "/"
+ size: 100%
# There can be any number of partitions, each entry having the following attributes:
# - name: filesystem label
# and
diff --git a/raveos-calamares-theme/etc/calamares/modules/shellprocess-loader.conf b/raveos-calamares-theme/etc/calamares/modules/shellprocess-loader.conf
index 3b2fde0..62fd87d 100644
--- a/raveos-calamares-theme/etc/calamares/modules/shellprocess-loader.conf
+++ b/raveos-calamares-theme/etc/calamares/modules/shellprocess-loader.conf
@@ -11,6 +11,18 @@ script:
- command: "install -Dm755 /etc/calamares/modules/calamares-fix-bootentry.sh ${ROOT}/root/calamares-fix-bootentry.sh"
- command: "arch-chroot ${ROOT} /bin/bash /root/calamares-fix-bootentry.sh"
- command: "-rm ${ROOT}/root/calamares-fix-bootentry.sh"
+ # 3. Calamares' btrfsSubvolumes config is silently ignored -- it always
+ # creates its own hardcoded set (@, @home, @root, @srv, @cache, @log,
+ # @tmp). Drop the ones we don't want (@root, @srv, @tmp) and narrow
+ # @cache down to just /var/cache/pacman/pkg as @pkg.
+ - command: "install -Dm755 /etc/calamares/modules/calamares-normalize-subvolumes.sh ${ROOT}/root/calamares-normalize-subvolumes.sh"
+ - command: "arch-chroot ${ROOT} /bin/bash /root/calamares-normalize-subvolumes.sh"
+ - command: "-rm ${ROOT}/root/calamares-normalize-subvolumes.sh"
+ # 4. Calamares' hardcoded btrfs subvolume layout has no .snapshots --
+ # create it by hand (needed by grub-btrfs/Snapper).
+ - command: "install -Dm755 /etc/calamares/modules/calamares-create-snapshots-subvol.sh ${ROOT}/root/calamares-create-snapshots-subvol.sh"
+ - command: "arch-chroot ${ROOT} /bin/bash /root/calamares-create-snapshots-subvol.sh"
+ - command: "-rm ${ROOT}/root/calamares-create-snapshots-subvol.sh"
# - command: "install -Dm755 /etc/calamares/modules/calamares-microcode-fix.sh ${ROOT}/root/calamares-microcode-fix.sh"