Mageia Bugzilla – Attachment 6500 Details for
Bug 9431
No option in installer to install grub2 with non-graphical menu
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
add support for grub2-text
grub2-text.diff (text/plain), 3.32 KB, created by
Thierry Vignaud
on 2015-05-11 15:02:36 CEST
(
hide
)
Description:
add support for grub2-text
Filename:
MIME Type:
Creator:
Thierry Vignaud
Created:
2015-05-11 15:02:36 CEST
Size:
3.32 KB
patch
obsolete
>diff -up ./bootloader.pm.tv7 ./bootloader.pm >--- ./bootloader.pm.tv7 2015-05-11 04:26:46.292030301 -0400 >+++ ./bootloader.pm 2015-05-11 08:46:24.567000202 -0400 >@@ -299,7 +299,8 @@ sub read_grub2() { > $bootloader{timeout} = $h{GRUB_TIMEOUT}; > $bootloader{entries} = []; > my $entry; >- foreach (cat_utf8("$::prefix/boot/grub2/grub.cfg")) { >+ my $f = "$::prefix/boot/grub2/grub.cfg"; >+ foreach (cat_utf8($f)) { > next if /^#/; > if (/menuentry\s+['"]([^']+)["']/) { > push @{$bootloader{entries}}, $entry if $entry; >@@ -322,7 +323,7 @@ sub read_grub2() { > $bootloader{default} = $1 if /saved_entry=(.*)/; > } > >- $bootloader{method} = 'grub2'; >+ $bootloader{method} = cat_($f) =~ /set theme=.*maggy/ ? 'grub2-graphic' : 'grub2'; > \%bootloader; > } > >@@ -1274,7 +1275,8 @@ sub method2text { > my ($method) = @_; > +{ > 'lilo-menu' => N("LILO with text menu"), >- 'grub2' => N("GRUB2 with graphical menu"), >+ 'grub2-graphic' => N("GRUB2 with graphical menu"), >+ 'grub2' => N("GRUB2 with text menu"), > 'grub-graphic' => N("GRUB with graphical menu"), > 'grub-menu' => N("GRUB with text menu"), > }->{$method}; >@@ -1286,7 +1288,7 @@ sub method_choices_raw { > arch() =~ /mips/ ? 'pmon2000' : > arch() =~ /arm/ ? 'uboot' : > if_(!$b_prefix_mounted || whereis_binary('grub2-reboot', $::prefix), >- 'grub2'), >+ 'grub2-graphic', 'grub2'), > if_(!is_uefi(), ( > if_(!$b_prefix_mounted || whereis_binary('grub', $::prefix), > 'grub-graphic', 'grub-menu'), >@@ -1304,7 +1306,7 @@ sub method_choices { > grep { > !(/lilo/ && (isLoopback($root_part) || $have_dmraid)) > && (/grub2/ || $boot_part->{fs_type} ne 'btrfs') >- && !(/grub-graphic/ && cat_("/proc/cmdline") =~ /console=ttyS/); >+ && !(/grub2?-graphic/ && cat_("/proc/cmdline") =~ /console=ttyS/); > } method_choices_raw($b_prefix_mounted); > } > sub main_method_choices { >@@ -1802,7 +1804,7 @@ sub write_grub2 { > my $f = "$::prefix/etc/default/grub"; > my %conf = getVarsFromSh($f); > $conf{GRUB_CMDLINE_LINUX_DEFAULT} = get_grub2_append($bootloader); >- $conf{GRUB_GFXPAYLOAD_LINUX} = 'auto' if is_uefi(); >+ $conf{GRUB_TERMINAL_OUTPUT} = $bootloader->{method} eq 'grub2-graphic' ? 'gfxterm' : 'console'; > $conf{GRUB_DISABLE_RECOVERY} = 'false'; # for 'failsafe' entry > $conf{GRUB_TIMEOUT} = $bootloader->{timeout}; > renamef($f, $f . ($o_backup_extension || '.old')); >@@ -2130,11 +2132,16 @@ sub ensure_pkg_is_installed { > > my %pkg = ('grub2' => is_uefi() ? 'grub2-efi' : 'grub2'); > my %h = ('grub2' => 'grub2-install'); >+ my %suppl = ( >+ # method => [ 'pkg_name', 'file_to_test' ], >+ 'grub-graphic' => [ qw(mageia-gfxboot-theme /usr/share/gfxboot/themes/Mageia/boot/message) ], >+ 'grub2-graphic' => [ qw(grub2-mageia-theme /boot/grub2/themes/maggy/theme.txt) ], >+ ); > my $main_method = main_method($bootloader->{method}); > if (member($main_method, qw(grub grub2 lilo))) { > $do_pkgs->ensure_binary_is_installed($pkg{$main_method} || $main_method, $h{$main_method} || $main_method, 1) or return 0; >- if ($bootloader->{method} eq 'grub-graphic') { >- $do_pkgs->ensure_is_installed('mageia-gfxboot-theme', '/usr/share/gfxboot/themes/Mageia/boot/message', 1) or return 0; >+ if (my $pkg = $suppl{$bootloader->{method}}) { >+ $do_pkgs->ensure_is_installed(@$pkg, 1) or return 0; > } > } > 1;
diff -up ./bootloader.pm.tv7 ./bootloader.pm --- ./bootloader.pm.tv7 2015-05-11 04:26:46.292030301 -0400 +++ ./bootloader.pm 2015-05-11 08:46:24.567000202 -0400 @@ -299,7 +299,8 @@ sub read_grub2() { $bootloader{timeout} = $h{GRUB_TIMEOUT}; $bootloader{entries} = []; my $entry; - foreach (cat_utf8("$::prefix/boot/grub2/grub.cfg")) { + my $f = "$::prefix/boot/grub2/grub.cfg"; + foreach (cat_utf8($f)) { next if /^#/; if (/menuentry\s+['"]([^']+)["']/) { push @{$bootloader{entries}}, $entry if $entry; @@ -322,7 +323,7 @@ sub read_grub2() { $bootloader{default} = $1 if /saved_entry=(.*)/; } - $bootloader{method} = 'grub2'; + $bootloader{method} = cat_($f) =~ /set theme=.*maggy/ ? 'grub2-graphic' : 'grub2'; \%bootloader; } @@ -1274,7 +1275,8 @@ sub method2text { my ($method) = @_; +{ 'lilo-menu' => N("LILO with text menu"), - 'grub2' => N("GRUB2 with graphical menu"), + 'grub2-graphic' => N("GRUB2 with graphical menu"), + 'grub2' => N("GRUB2 with text menu"), 'grub-graphic' => N("GRUB with graphical menu"), 'grub-menu' => N("GRUB with text menu"), }->{$method}; @@ -1286,7 +1288,7 @@ sub method_choices_raw { arch() =~ /mips/ ? 'pmon2000' : arch() =~ /arm/ ? 'uboot' : if_(!$b_prefix_mounted || whereis_binary('grub2-reboot', $::prefix), - 'grub2'), + 'grub2-graphic', 'grub2'), if_(!is_uefi(), ( if_(!$b_prefix_mounted || whereis_binary('grub', $::prefix), 'grub-graphic', 'grub-menu'), @@ -1304,7 +1306,7 @@ sub method_choices { grep { !(/lilo/ && (isLoopback($root_part) || $have_dmraid)) && (/grub2/ || $boot_part->{fs_type} ne 'btrfs') - && !(/grub-graphic/ && cat_("/proc/cmdline") =~ /console=ttyS/); + && !(/grub2?-graphic/ && cat_("/proc/cmdline") =~ /console=ttyS/); } method_choices_raw($b_prefix_mounted); } sub main_method_choices { @@ -1802,7 +1804,7 @@ sub write_grub2 { my $f = "$::prefix/etc/default/grub"; my %conf = getVarsFromSh($f); $conf{GRUB_CMDLINE_LINUX_DEFAULT} = get_grub2_append($bootloader); - $conf{GRUB_GFXPAYLOAD_LINUX} = 'auto' if is_uefi(); + $conf{GRUB_TERMINAL_OUTPUT} = $bootloader->{method} eq 'grub2-graphic' ? 'gfxterm' : 'console'; $conf{GRUB_DISABLE_RECOVERY} = 'false'; # for 'failsafe' entry $conf{GRUB_TIMEOUT} = $bootloader->{timeout}; renamef($f, $f . ($o_backup_extension || '.old')); @@ -2130,11 +2132,16 @@ sub ensure_pkg_is_installed { my %pkg = ('grub2' => is_uefi() ? 'grub2-efi' : 'grub2'); my %h = ('grub2' => 'grub2-install'); + my %suppl = ( + # method => [ 'pkg_name', 'file_to_test' ], + 'grub-graphic' => [ qw(mageia-gfxboot-theme /usr/share/gfxboot/themes/Mageia/boot/message) ], + 'grub2-graphic' => [ qw(grub2-mageia-theme /boot/grub2/themes/maggy/theme.txt) ], + ); my $main_method = main_method($bootloader->{method}); if (member($main_method, qw(grub grub2 lilo))) { $do_pkgs->ensure_binary_is_installed($pkg{$main_method} || $main_method, $h{$main_method} || $main_method, 1) or return 0; - if ($bootloader->{method} eq 'grub-graphic') { - $do_pkgs->ensure_is_installed('mageia-gfxboot-theme', '/usr/share/gfxboot/themes/Mageia/boot/message', 1) or return 0; + if (my $pkg = $suppl{$bootloader->{method}}) { + $do_pkgs->ensure_is_installed(@$pkg, 1) or return 0; } } 1;
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 9431
:
6486
|
6489
| 6500 |
6501