Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variables to BLS entries only if grub is used #705

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions 92-tuned.install
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"

# skip if systemd-boot is used
[ "$KERNEL_INSTALL_LAYOUT" = "bls" ] && exit 0

if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
exit 0
fi
Expand Down Expand Up @@ -32,16 +35,17 @@ for f in `basename "$MACHINE_ID"`-*.conf; do
continue
fi

if [ "${ARCH:0:4}" = "s390" ]; then
# On s390(x), the zipl bootloader doesn't support variables,
# 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"
else
# Not on s390(x), add TuneD variables if they are not there
if grep -q '\(\s*grub_\)\|\($grub\)' "$f" && [ "${ARCH:0:4}" != "s390" ]; then
# grub generated BLS entries detected and not on s390(x) where zipl is used,
# there is high chance that variables in BLS entries will be supported (grub
# extension is unsupported by zipl)
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"
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
done
popd &> /dev/null
Expand Down
Loading