From 80b43f6ee1b335af44c3ce3dbf6bb1a1311847d5 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 1 May 2015 11:42:40 +0200 Subject: add a dedicate step for grub2 (mga#9627) rationale: grub2 entries are autogenerated, thus: - we cannot just reuse labels from previous bootloader (grub-legacy/lilo) - we cannot alter entries --- perl-install/NEWS | 1 + perl-install/any.pm | 47 ++++++++++++++++++++++++++++++++++++++++++++++- perl-install/install/NEWS | 1 + 3 files changed, 48 insertions(+), 1 deletion(-) (limited to 'perl-install') diff --git a/perl-install/NEWS b/perl-install/NEWS index 5cb52e2e6..3b0646015 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -3,6 +3,7 @@ - diskdrake: o do not set noauto for /boot/EFI (mga#15627) - drakboot: + o add a dedicate step for grub2 (mga#9627) o backup grub2 files before configuring - harddrake: o fix detecting AHCI as SATA (mga#9992) diff --git a/perl-install/any.pm b/perl-install/any.pm index cb4d6f188..3dc696994 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -224,7 +224,11 @@ sub setupBootloader { setupBootloader__boot_bios_drive($in, $b, $all_hds->{hds}) or goto general; { local $::Wizard_finished = 1 if $::isStandalone; - setupBootloader__entries($in, $b, $all_hds, $fstab) or goto general; + if ($b->{method} eq 'grub2') { + setupBootloader__grub2($in, $b, $all_hds, $fstab) or goto general; + } else { + setupBootloader__entries($in, $b, $all_hds, $fstab) or goto general; + } } 1; } @@ -603,6 +607,47 @@ You can create additional entries or change the existing ones."), [ { } } +sub setupBootloader__grub2 { + my ($in, $b, $_all_hds, $_fstab) = @_; + + # update entries (so that we can display their list below): + my $error; + run_program::rooted($::prefix, 'update-grub2', '2>', \$error) or die "update-grub2 failed: $error"; + # read grub2 auto-generated entries (instead of keeping eg: grub/lilo ones): + my $b2 = bootloader::read_grub2(); + + # get default parameters: + my $append = bootloader::get_grub2_append($b2); + my $default = $b2->{default}; + + require Xconfig::resolution_and_depth; + + require network::network; #- to list network profiles + my $vga = Xconfig::resolution_and_depth::from_bios($b->{vga}); + + my $res = $in->ask_from_( + { + title => N("Bootloader Configuration"), + }, + [ + { label => N("Default"), val => \$b->{default}, + list => [ map { $_->{label} } @{$b2->{entries}} ] }, + { label => N("Append"), val => \$append }, + { label => N("Video mode"), val => \$vga, list => [ '', Xconfig::resolution_and_depth::bios_vga_modes() ], + format => \&Xconfig::resolution_and_depth::to_string, advanced => 1 }, + ]); + if ($res) { + #my ($entry) = bootloader::get_grub2_first_entry($b); + #$entry->{append} = $append; + $b->{entries} = $b2->{entries}; + $b->{default} = $default; + first(@{$b->{entries}})->{append} = $append; + 1; + } else { + ''; + } +} + sub get_autologin() { my %desktop = getVarsFromSh("$::prefix/etc/sysconfig/desktop"); my $gdm_file = "$::prefix/etc/X11/gdm/custom.conf"; diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 642f4b689..06ccb1abf 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,4 +1,5 @@ - bootloader: + o add a dedicate step for grub2 (mga#9627) o always log update-grub2 output (mga#15857) o backup grub2 files before configuring - log grub2 install.sh in report.bug like for grub (mga#15857) -- cgit v1.2.1