Date: Fri Sep 26 11:43:33 2014 +0200 From: Petr Tesarik Subject: kdump-Bootloader: add support for GRUB2 References: bsc#889192 Patch-mainline: v0.8.16 Git-commit: 30d4271c72251c5f1c995d0580b19aa000ade1d6 GRUB2 is very different from the other bootloader, because the final configuration file is generated by an external utility. This means that the command line must be modified in the global settings instead of the individual section. Signed-off-by: Petr Tesarik --- init/kdump-bootloader.pl | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) --- a/init/kdump-bootloader.pl +++ b/init/kdump-bootloader.pl @@ -4,11 +4,19 @@ use Bootloader::Tools; Bootloader::Tools::InitLibrary(); +my $grub2; +my $section; +if (Bootloader::Tools::GetBootloader() =~ /^(grub2|grub2-efi)$/) { + $grub2 = true; + $section = Bootloader::Tools::GetGlobals(); +} else { + $grub2 = false; + $section = Bootloader::Tools::GetDefaultSection(); +} + if ($ARGV[0] eq "--get") { - my $section = Bootloader::Tools::GetDefaultSection (); print $section->{"append"}; } elsif ($ARGV[0] eq "--update") { - my $section = Bootloader::Tools::GetDefaultSection (); my $input = $section->{"append"}; my $result; while (length($input)) { @@ -28,9 +36,13 @@ if ($ARGV[0] eq "--get") { shift @ARGV; $result .= " " if length($result); $result .= join(" ", @ARGV); - $section->{"append"} = $result; - $section->{"__modified"} = 1; - Bootloader::Tools::SetGlobals(); + if ($grub2) { + Bootloader::Tools::SetGlobals("append" => $result); + } else { + $section->{"append"} = $result; + $section->{"__modified"} = 1; + Bootloader::Tools::SetGlobals(); + } } else { die "Need an action (--get or --update)"; }