1
0
Fork 0

plugin_bootloader: do not add tuned boot command line parameters to rescue kernels

Accomplished by switch from GRUB_CMDLINE_LINUX to GRUB_CMDLINE_LINUX_DEFAULT
in /etc/default/grub

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
Jaroslav Škarvada 2015-05-21 13:47:04 +02:00
parent 8cdf443cd0
commit 0bfeee763a
2 changed files with 8 additions and 2 deletions

View file

@ -110,6 +110,10 @@ rmdir %{buildroot}%{_sysconfdir}/grub.d
# convert active_profile from full path to name (if needed)
sed -i 's|.*/\([^/]\+\)/[^\.]\+\.conf|\1|' /etc/tuned/active_profile
# convert GRUB_CMDLINE_LINUX to GRUB_CMDLINE_LINUX_DEFAULT
sed -i 's/GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX \\$tuned_params"/GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT \\$tuned_params"/' \
%{_sysconfdir}/default/grub
%preun
%systemd_preun tuned.service
@ -122,6 +126,8 @@ sed -i 's|.*/\([^/]\+\)/[^\.]\+\.conf|\1|' /etc/tuned/active_profile
# and tuned is noarch package, thus the following hack is needed
if [ "$1" == 0 ]; then
rm -f %{_sysconfdir}/grub.d/00_tuned || :
# unpatch /etc/default/grub
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT \\$tuned_params"/d' %{_sysconfdir}/default/grub
fi

View file

@ -76,10 +76,10 @@ class BootloaderPlugin(base.Plugin):
log.error("error reading '%s'" % consts.GRUB2_DEFAULT_ENV_FILE)
return False
if re.search(r"^[^#]*\bGRUB_CMDLINE_LINUX\s*=.*\\\$" + consts.GRUB2_TUNED_VAR + r"\b.*$", grub2_default_env, flags = re.MULTILINE) is None:
if re.search(r"^[^#]*\bGRUB_CMDLINE_LINUX_DEFAULT\s*=.*\\\$" + consts.GRUB2_TUNED_VAR + r"\b.*$", grub2_default_env, flags = re.MULTILINE) is None:
log.debug("patching '%s'" % consts.GRUB2_DEFAULT_ENV_FILE)
self._cmd.write_to_file(consts.GRUB2_DEFAULT_ENV_FILE,
grub2_default_env + "GRUB_CMDLINE_LINUX=\"$GRUB_CMDLINE_LINUX " + r"\$" + consts.GRUB2_TUNED_VAR + "\"\n")
grub2_default_env + "GRUB_CMDLINE_LINUX_DEFAULT=\"$GRUB_CMDLINE_LINUX_DEFAULT " + r"\$" + consts.GRUB2_TUNED_VAR + "\"\n")
return True
def _grub2_cfg_patch(self, value):