Mageia Bugzilla – Attachment 7868 Details for
Bug 18560
MCC->boot->Set up boot system fails to set correct default menu entry for grub2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
save menu ID instead of menu label (mga#XXXX)
0002-save-menu-ID-instead-of-menu-label-mga-XXXX.patch (text/plain), 1.51 KB, created by
Thierry Vignaud
on 2016-05-27 17:08:20 CEST
(
hide
)
Description:
save menu ID instead of menu label (mga#XXXX)
Filename:
MIME Type:
Creator:
Thierry Vignaud
Created:
2016-05-27 17:08:20 CEST
Size:
1.51 KB
patch
obsolete
>From a0c695fd566bc35fbcd9c3a61175bbd51658040b Mon Sep 17 00:00:00 2001 >From: Thierry Vignaud <tvignaud@redhat.com> >Date: Fri, 27 May 2016 16:48:01 +0200 >Subject: [PATCH 2/2] save menu ID instead of menu label (mga#XXXX) > >--- > perl-install/bootloader.pm | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > >diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm >index b6d66d4..25bc581 100644 >--- a/perl-install/bootloader.pm >+++ b/perl-install/bootloader.pm >@@ -303,9 +303,9 @@ sub read_grub2() { > my $f = "$::prefix/boot/grub2/grub.cfg"; > foreach (cat_utf8($f)) { > next if /^#/; >- if (/menuentry\s+['"]([^']+)["']/) { >+ if (/menuentry\s+['"]([^']+)["'].* \$menuentry_id_option '([^']+)'/) { > push @{$bootloader{entries}}, $entry if $entry; >- $entry = { label => $1 }; >+ $entry = { label => $1, menuid => $2 }; > } elsif (/linux\s+(\S+)\s+(.*)?/ || /module\s+(\S+vmlinu\S+)\s+(.*)?/) { > $entry->{type} = 'image'; > @$entry{qw(kernel_or_dev append)} = ($1, $2); >@@ -322,6 +322,10 @@ sub read_grub2() { > # get default entry: > foreach (run_program::rooted_get_stdout($::prefix, qw(grub2-editenv list))) { > $bootloader{default} = $1 if /saved_entry=(.*)/; >+ # "grub2-editenv list" returns a label instead of an id. Fix it: >+ if (my $def = grep { $_->{label} eq $bootloader{default} } @{$bootloader{entries}}) { >+ $bootloader{default} = $def->{menuid} if $def->{menuid} >+ } > } > > $bootloader{method} = cat_($f) =~ /set theme=.*maggy/ ? 'grub2-graphic' : 'grub2'; >-- >2.5.5 >
From a0c695fd566bc35fbcd9c3a61175bbd51658040b Mon Sep 17 00:00:00 2001 From: Thierry Vignaud <tvignaud@redhat.com> Date: Fri, 27 May 2016 16:48:01 +0200 Subject: [PATCH 2/2] save menu ID instead of menu label (mga#XXXX) --- perl-install/bootloader.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index b6d66d4..25bc581 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -303,9 +303,9 @@ sub read_grub2() { my $f = "$::prefix/boot/grub2/grub.cfg"; foreach (cat_utf8($f)) { next if /^#/; - if (/menuentry\s+['"]([^']+)["']/) { + if (/menuentry\s+['"]([^']+)["'].* \$menuentry_id_option '([^']+)'/) { push @{$bootloader{entries}}, $entry if $entry; - $entry = { label => $1 }; + $entry = { label => $1, menuid => $2 }; } elsif (/linux\s+(\S+)\s+(.*)?/ || /module\s+(\S+vmlinu\S+)\s+(.*)?/) { $entry->{type} = 'image'; @$entry{qw(kernel_or_dev append)} = ($1, $2); @@ -322,6 +322,10 @@ sub read_grub2() { # get default entry: foreach (run_program::rooted_get_stdout($::prefix, qw(grub2-editenv list))) { $bootloader{default} = $1 if /saved_entry=(.*)/; + # "grub2-editenv list" returns a label instead of an id. Fix it: + if (my $def = grep { $_->{label} eq $bootloader{default} } @{$bootloader{entries}}) { + $bootloader{default} = $def->{menuid} if $def->{menuid} + } } $bootloader{method} = cat_($f) =~ /set theme=.*maggy/ ? 'grub2-graphic' : 'grub2'; -- 2.5.5
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 18560
:
7867
|
7868
|
8048