This commit is contained in:
randogoth 2025-10-13 16:40:30 +03:00
commit 64e66af0eb
4 changed files with 100 additions and 0 deletions

30
bls-add-bluefin.sh Executable file
View file

@ -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