From 8442dabf544ca3f27635ef9f2331d36a6965e3a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Tue, 11 Apr 2017 15:40:05 +0200 Subject: [PATCH] bootloader: work with /boot which is not on separate partition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jaroslav Škarvada --- tuned/plugins/plugin_bootloader.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tuned/plugins/plugin_bootloader.py b/tuned/plugins/plugin_bootloader.py index e0e03ea..c50f190 100644 --- a/tuned/plugins/plugin_bootloader.py +++ b/tuned/plugins/plugin_bootloader.py @@ -183,7 +183,14 @@ class BootloaderPlugin(base.Plugin): img_name = os.path.basename(self._initrd_dst_img_val) self._cmd.copy(img, self._initrd_dst_img_val) self.update_grub2_cfg = True - self._initrd_val = "/" + img_name + curr_cmdline = self._cmd.read_file("/proc/cmdline").rstrip() + initrd_grubpath = "/" + lc = len(curr_cmdline) + if lc: + path = re.sub(r"^.*[= \t]+([^= \t]*/)vmlinuz-.*$", "\\1", curr_cmdline) + if len(path) < lc: + initrd_grubpath = path + self._initrd_val = os.path.join(initrd_grubpath, img_name) @command_custom("grub2_cfg_file") def _grub2_cfg_file(self, enabling, value, verify, ignore_missing):