Skip to content

Commit c797b37

Browse files
cgwaltersJohan-Liebert1
authored andcommitted
composefs/boot: Clean up BLS sort-key and filename ordering
Improve boot entry ordering to work correctly across both Grub and systemd-boot bootloaders, which have fundamentally different sorting behaviors. Background: Grub does not read BLS fields - it parses the filename as an RPM package name using split_package_string(). The parsing splits on `-` from right to left: 1. Strip .conf suffix 2. Find LAST `-` → extract "release" field 3. Find SECOND-TO-LAST `-` → extract "version" field 4. Remainder → "name" field 5. Sort by (name, version, release) in DESCENDING order See: ostreedev/ostree#2961 Changes: - Add comprehensive module documentation explaining bootloader sorting behaviors - Parse os-release to extract ID field (e.g., "fedora", "rhel") - Filename format: `bootc_{os_id}-{version}-{priority}.conf` * Replace `-` with `_` in os_id to prevent Grub mis-parsing * Priority in release position for Grub compatibility * Primary: `bootc_fedora-41.20251125.0-1.conf` * Secondary: `bootc_fedora-41.20251124.0-0.conf` - Sort-key format for systemd-boot: * Primary: `bootc-{os_id}-0` (sorts first) * Secondary: `bootc-{os_id}-1` (sorts second) - Update rollback logic for new filename format - Add comprehensive unit tests Boot entry ordering after upgrade (both bootloaders): 1. Primary: New/upgraded deployment (default boot target) 2. Secondary: Currently booted deployment (rollback option) Sorting behavior: - Grub: Descending by (name, version, release) from filename parsing - Systemd-boot: Ascending by sort-key field, filename mostly irrelevant Fixes: #1777 Related: ostreedev/ostree#2961 Signed-off-by: Colin Walters <walters@verbum.org> Assisted-by: Claude Code (Sonnet 4.5) Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 0a36eb1 commit c797b37

File tree

2 files changed

+301
-50
lines changed

2 files changed

+301
-50
lines changed

0 commit comments

Comments
 (0)