From 9923b3284a81cc9a6068e9f82ac5c5b8c1032987 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sat, 9 May 2015 13:12:46 +0200 Subject: backup grub2 files before configuring --- perl-install/NEWS | 2 ++ perl-install/bootloader.pm | 8 ++++++++ perl-install/install/NEWS | 2 ++ 3 files changed, 12 insertions(+) (limited to 'perl-install') diff --git a/perl-install/NEWS b/perl-install/NEWS index 1f61dc29c..5cb52e2e6 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -2,6 +2,8 @@ o recognize r8723bs (mga#15874) - diskdrake: o do not set noauto for /boot/EFI (mga#15627) +- drakboot: + o backup grub2 files before configuring - harddrake: o fix detecting AHCI as SATA (mga#9992) o fix detecting some memory chips (mga#5810) diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 6fb380567..99cfcec3a 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -1805,15 +1805,23 @@ sub write_grub2 { $conf{GRUB_GFXPAYLOAD_LINUX} = 'auto' if is_uefi(); $conf{GRUB_DISABLE_RECOVERY} = 'false'; # for 'failsafe' entry $conf{GRUB_TIMEOUT} = $bootloader->{timeout}; + renamef($f, $f . ($o_backup_extension || '.old')); setVarsInSh($f, \%conf); + my $f1 = "$::prefix/boot/grub2/grub.cfg"; + renamef($f1, $f1 . ($o_backup_extension || '.old')); run_program::rooted($::prefix, 'update-grub2', '2>', \$error) or die "update-grub2 failed: $error"; log::l("update-grub2 logs: $error"); # set default entry: eval { + my $f2 = "$::prefix/boot/grub2/grubenv"; + cp_af($f2, $f2 . ($o_backup_extension || '.old')); run_program::rooted($::prefix, 'grub2-set-default', '2>', \$error, $bootloader->{default}) or die "grub2-set-default failed: $error"; }; + if (my $err = $@) { + log::l("error while running grub2-set-default: $err"); + } check_enough_space(); write_grub2_install_sh($bootloader, $o_backup_extension); } diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 24d34dcfe..cb230b32f 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,3 +1,5 @@ +- bootloader: + o backup grub2 files before configuring - log grub2 install.sh in report.bug like for grub (mga#15857) - always log update-grub2 output (mga#15857) - networking: -- cgit v1.2.1