1
0
Fork 0

Add variables to BLS entries only if grub is used

The bootloader plugin needs patched BLS entries with the TuneD variables.
It seems variables in the BLS entries is grub extension which is not
described in the BLS specification. It can cause boot problems with e.g.
systemd-boot, thus add variables to BLS entries only if the BLS entries
were generated by grub.

Resolves: rhbz#2323514

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
Jaroslav Škarvada 2024-11-04 20:20:43 +01:00
parent 35eed3ca3e
commit 3c3d1b21a1
No known key found for this signature in database
GPG key ID: D8E1C00E076E840B

View file

@ -5,6 +5,9 @@ KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3" BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4" KERNEL_IMAGE="$4"
# skip if systemd-boot is used
[ "$KERNEL_INSTALL_LAYOUT" = "bls" ] && exit 0
if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
exit 0 exit 0
fi fi
@ -32,16 +35,17 @@ for f in `basename "$MACHINE_ID"`-*.conf; do
continue continue
fi fi
if [ "${ARCH:0:4}" = "s390" ]; then if grep -q '\(\s*grub_\)\|\($grub\)' "$f" && [ "${ARCH:0:4}" != "s390" ]; then
# On s390(x), the zipl bootloader doesn't support variables, # grub generated BLS entries detected and not on s390(x) where zipl is used,
# unpatch TuneD variables which could be there from the previous TuneD # there is high chance that variables in BLS entries will be supported (grub
# versions # extension is unsupported by zipl)
grep -q '^\s*options\s\+.*\$tuned_params' "$f" && sed -i '/^\s*options\s\+/ s/\s\+\$tuned_params\b//g' "$f"
grep -q '^\s*initrd\s\+.*\$tuned_initrd' "$f" && sed -i '/^\s*initrd\s\+/ s/\s\+\$tuned_initrd\b//g' "$f"
else
# Not on s390(x), add TuneD variables if they are not there
grep -q '^\s*options\s\+.*\$tuned_params' "$f" || sed -i '/^\s*options\s\+/ s/\(.*\)/\1 \$tuned_params/' "$f" grep -q '^\s*options\s\+.*\$tuned_params' "$f" || sed -i '/^\s*options\s\+/ s/\(.*\)/\1 \$tuned_params/' "$f"
grep -q '^\s*initrd\s\+.*\$tuned_initrd' "$f" || sed -i '/^\s*initrd\s\+/ s/\(.*\)/\1 \$tuned_initrd/' "$f" grep -q '^\s*initrd\s\+.*\$tuned_initrd' "$f" || sed -i '/^\s*initrd\s\+/ s/\(.*\)/\1 \$tuned_initrd/' "$f"
else
# BLS entries generated by some unsupported tool or on s390x, unpatch TuneD
# variables which could be there from the previous TuneD versions
grep -q '^\s*options\s\+.*\$tuned_params' "$f" && sed -i '/^\s*options\s\+/ s/\s\+\$tuned_params\b//g' "$f"
grep -q '^\s*initrd\s\+.*\$tuned_initrd' "$f" && sed -i '/^\s*initrd\s\+/ s/\s\+\$tuned_initrd\b//g' "$f"
fi fi
done done
popd &> /dev/null popd &> /dev/null