Browse Source

pkg: fedora: Add support for boot-on-btrfs

When the /boot directory is not its own partition but a subvolume or
a subdirectory on a BTRFS partition, then the path that GRUB uses to
boot the kernel is different.

For example instead of /boot/vmlinuz-6.4.12-1.surface.fc38.x86_64 it
will now look like /@boot/vmlinuz-6.4.12-1.surface.fc38.x86_64.

grubby expects the path that is noted inside of the BLS file, so we
need to find the corresponding file and extact the correct path.
Dorian Stoll 1 year ago
parent
commit
23e76055f4
1 changed files with 8 additions and 1 deletions
  1. 8 1
      pkg/fedora/kernel-surface/files/linux-surface-default-watchdog.sh

+ 8 - 1
pkg/fedora/kernel-surface/files/linux-surface-default-watchdog.sh

@@ -15,8 +15,15 @@ VMLINUX="$(echo "${KERNELS}" | tail -n1 | cut -d' ' -f2)"
 
 echo "${VMLINUX}"
 
+# Find the BLS snipped associated with this kernel
+VERSION="$(basename "${VMLINUX}" | cut -d'-' -f2-)"
+BLS="$(find /boot/loader/entries -maxdepth 1 -name "*${VERSION}*")"
+
+# Find the path that the bootloader uses to boot the kernel
+BOOTPATH="$(grep linux "${BLS}" | cut -d' ' -f2-)"
+
 # update GRUB config
-grubby --set-default "${VMLINUX}"
+grubby --set-default "${BOOTPATH}"
 
 # Update timestamp for rEFInd
 # Ensure it's marked as latest across all kernels, not just surface ones