commit 64e66af0ebad24a873486d4ceaae56f76ae30467 Author: randogoth Date: Mon Oct 13 16:40:30 2025 +0300 init diff --git a/bls-add-bluefin.sh b/bls-add-bluefin.sh new file mode 100755 index 0000000..aae1797 --- /dev/null +++ b/bls-add-bluefin.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -euo pipefail +shopt -s nullglob + +entries_dir="/boot/loader/entries" + +for f in "$entries_dir"/ostree-*.conf "$entries_dir"/*-ostree-*.conf; do + [ -f "$f" ] || continue + + # Already correct? skip + if grep -qxE 'grub_class[[:space:]]+bluefin' "$f"; then + continue + fi + + tmp="$(mktemp)" + if grep -qE '^grub_class[[:space:]]+' "$f"; then + sed -E 's/^grub_class[[:space:]].*/grub_class bluefin/' "$f" >"$tmp" + else + awk '1; /^title[[:space:]]/{print "grub_class bluefin";}' "$f" >"$tmp" + fi + + if ! cmp -s "$f" "$tmp"; then + chmod --reference="$f" "$tmp" + chown --reference="$f" "$tmp" + command -v chcon >/dev/null 2>&1 && chcon --reference="$f" "$tmp" 2>/dev/null || true + mv -f "$tmp" "$f" + else + rm -f "$tmp" + fi +done diff --git a/bluefin-icons.conf b/bluefin-icons.conf new file mode 100644 index 0000000..c21ab4c --- /dev/null +++ b/bluefin-icons.conf @@ -0,0 +1,6 @@ +[Service] +ExecStartPost= +ExecStopPost=/usr/bin/bash --noprofile --norc -lc '/usr/local/sbin/bls-add-bluefin.sh' +StandardOutput=journal +StandardError=journal +Environment=STARSHIP_LOG=off diff --git a/bluefin.png b/bluefin.png new file mode 100644 index 0000000..3cd982b Binary files /dev/null and b/bluefin.png differ diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e4a1f9e --- /dev/null +++ b/readme.md @@ -0,0 +1,64 @@ + + +# Auto GRUB Class Setup for Bluefin + +## Introduction + +GRUB themes display icons according to each entry's class. On some rpm-ostree systems, including Bluefin, new boot entries are created without a class, which means no icon is shown in the menu. + +This setup fixes that by adding a dedicated Bluefin icon to your active GRUB theme and installing a helper script that ensures every BootLoaderSpec (BLS) entry includes `grub_class bluefin`. With this in place, GRUB automatically picks up the correct icon and your Bluefin deployments appear with their own distinctive symbol in the boot menu. + +(Developed and tested on `bluefin-dx:latest-42.20251012.1`) + +## Acknowledgements + +This setup borrows the icon for the Bluefin GRUB [theme created by Raindrac](https://github.com/Raindrac/Banner/) and is inspired by and meant as a replacement for a previous [solution by Tomasz Drozdz](https://codeberg.org/TomaszDrozdz/Fedora-Silverblue-rpm-ostree-generate-grub-theme-icon-class). + +## Installation + +If you don't have a GRUB theme installed, [check these out](https://www.gnome-look.org/browse?cat=109&ord=latest). I am currently using [this one](https://www.gnome-look.org/p/2227016). + +### 1. Find the icons folder of your currently used GRUB theme + +```bash +sudo awk -F= '/set theme=/ {f=$2; sub(/\/[^/]*$/, "", f); print f "/icons"}' /boot/grub2/user.cfg +``` + +should print something like `"/boot/grub2/themes//icons` + +### 2. Copy bluefin icon to that folder + +```bash +sudo cp bluefin.png /boot/grub2/themes//icons/ +``` + +### 3. Install helper script + +```bash +sudo cp bls-add-bluefin.sh /usr/local/sbin/ +sudo chmod 755 /usr/local/sbin/bls-add-bluefin.sh +``` + +### 4. Install rpm-ostree hook + +```bash +sudo mkdir -p /etc/systemd/system/ostree-finalize-staged.service.d +sudo cp bluefin-icons.conf /etc/systemd/system/ostree-finalize-staged.service.d/ +``` + +### 5. (Optional) Test helper script + +```bash +sudo /usr/local/sbin/bls-add-bluefin.sh +grep -n '^grub_class' /boot/loader/entries/ostree*.conf + +# Expected Result + +/boot/loader/entries/ostree-1.conf + 2: grub_class bluefin + +/boot/loader/entries/ostree-2.conf + 2: grub_class bluefin + +``` +