diff --git a/tuned.spec b/tuned.spec index 7ca7561..0dbe3f0 100644 --- a/tuned.spec +++ b/tuned.spec @@ -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 diff --git a/tuned/plugins/plugin_bootloader.py b/tuned/plugins/plugin_bootloader.py index 4ea55b7..be9d84a 100644 --- a/tuned/plugins/plugin_bootloader.py +++ b/tuned/plugins/plugin_bootloader.py @@ -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):