summaryrefslogtreecommitdiffstats
path: root/perl-install/bootloader.pm
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2015-05-09 13:12:46 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2015-05-09 13:16:39 +0200
commit9923b3284a81cc9a6068e9f82ac5c5b8c1032987 (patch)
tree3959df9ee90b9220d620f27dc5b43a8cdf4c6fc9 /perl-install/bootloader.pm
parent5504832df4ea818cfa48004e97d35e74fad7dc70 (diff)
downloaddrakx-9923b3284a81cc9a6068e9f82ac5c5b8c1032987.tar
drakx-9923b3284a81cc9a6068e9f82ac5c5b8c1032987.tar.gz
drakx-9923b3284a81cc9a6068e9f82ac5c5b8c1032987.tar.bz2
drakx-9923b3284a81cc9a6068e9f82ac5c5b8c1032987.tar.xz
drakx-9923b3284a81cc9a6068e9f82ac5c5b8c1032987.zip
backup grub2 files before configuring
Diffstat (limited to 'perl-install/bootloader.pm')
-rw-r--r--perl-install/bootloader.pm8
1 files changed, 8 insertions, 0 deletions
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);
}