diff --git a/grub2-once b/grub2-once index 3a402c6..112f7f9 100644 --- a/grub2-once +++ b/grub2-once @@ -199,17 +199,24 @@ open(SYSCONF, ") { - if (/^#/) { - next - }; - if (/LOADER_TYPE="(.*)"/) { - my $bl = $1; - if ($bl eq "grub2" || $bl eq "grub2-efi") { + chomp; + next if ( /^\s*#/ ); + if ( /LOADER_TYPE=(\'|\"|)([^\'\"\s]+)\1(\s*|\s+#.*)$/ ) { + dPrint("OK : $2\n"); + if ($2 eq "grub2" || $2 eq "grub2-efi") { + # Found grub2 to be the incumbent loader ... $grub2_dir = "/boot/grub2"; $grub2_reboot = "/usr/sbin/grub2-reboot"; $grub2_editenv = "/usr/bin/grub2-editenv"; + # Note : Here we continues rather than exiting the loop, which + # results in different behavior than previous "the first wins". Now + # the latest defined LOADER_TYPE can be used to override any + # previous one, which is identical to the result of regular shell + # variable expansion to meet most people's expectation. } - last; + } else { + next if ( /^\s*$/ ); + dPrint("SKIP: <$_>\n"); } } diff --git a/grub2.changes b/grub2.changes index 93fc136..903a2f8 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Feb 20 08:38:55 UTC 2019 - mchang@suse.com + +- Fix LOADER_TYPE parsing in grub2-once (boo#1122569) + ------------------------------------------------------------------- Tue Feb 12 08:57:03 UTC 2019 - mchang@suse.com