init
This commit is contained in:
commit
64e66af0eb
4 changed files with 100 additions and 0 deletions
30
bls-add-bluefin.sh
Executable file
30
bls-add-bluefin.sh
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue