kdump/kdump-use-pbl.patch

101 lines
2.8 KiB
Diff
Raw Normal View History

Date: Mon Jul 2 18:12:34 2018 +0200
From: Michal Koutný <mkoutny@suse.com>
Subject: Replace obsolete perl-Bootloader library with a simpler script
References: bsc#1050349
Upstream: tbd
Signed-off-by: Michal Koutný <mkoutny@suse.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
init/CMakeLists.txt | 1
init/kdump-bootloader.pl | 48 -----------------------------------------------
init/load.sh | 14 ++-----------
3 files changed, 3 insertions(+), 60 deletions(-)
--- a/init/CMakeLists.txt
+++ b/init/CMakeLists.txt
@@ -65,7 +65,6 @@ INSTALL(
INSTALL(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/mkdumprd
- ${CMAKE_CURRENT_SOURCE_DIR}/kdump-bootloader.pl
DESTINATION
/usr/sbin
PERMISSIONS
--- a/init/load.sh
+++ b/init/load.sh
@@ -214,18 +214,10 @@ function fadump_bootloader()
local newstate="$1"
# check if the old configuration is still valid
- boot_opts=$(kdump-bootloader.pl --get)
- nofadump_opts=$(echo "$boot_opts" | remove_from_commandline 'fadump')
- old_opts=$($KDUMPTOOL -F /dev/null -C <(echo "$boot_opts") \
- dump_config --usage dump --format kernel --nodefault)
if [ "$newstate" = on ] ; then
- curr_opts=$($KDUMPTOOL dump_config --usage dump --format kernel --nodefault)
- if [ "$old_opts" != "$curr_opts" -o \
- "$boot_opts" = "$nofadump_opts" ] ; then
- kdump-bootloader.pl --update fadump=on "$curr_opts"
- fi
- elif [ "$boot_opts" != "$nofadump_opts" ] ; then
- kdump-bootloader.pl --update
+ pbl --add-option fadump=on --config
+ else
+ pbl --del-option fadump=on --config
fi
}
--- a/init/kdump-bootloader.pl
+++ /dev/null
@@ -1,48 +0,0 @@
-#! /usr/bin/perl
-
-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") {
- print $section->{"append"};
-} elsif ($ARGV[0] eq "--update") {
- my $input = $section->{"append"};
- my $result;
- while (length($input)) {
- $input =~ s/^[[:space:]]+//;
- if ($input =~ s/^("[^"]*"?|[^"[:space:]]+)+//) {
- my $rawparam = $&;
- my $param = $rawparam;
- $param =~ s/"//g;
- $param =~ s/=(.*)//;
- if (! ($param =~ /^KDUMP(TOOL)?_|^MAKEDUMPFILE_|^fadump$/)) {
- $result .= " " if length($result);
- $result .= $rawparam;
- }
- }
- }
-
- shift @ARGV;
- $result .= " " if length($result);
- $result .= join(" ", @ARGV);
- 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)";
-}