summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2016-06-24 15:44:16 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2016-06-24 15:46:42 +0200
commit302a992cc5fed524f62416d74308ec400343884a (patch)
treebcbebe2ffc8e6369d592788a98d07d5063d34f8a /perl-install
parent4f8bd54ef3c34a5bb33a9d5973c0393a652ce882 (diff)
downloaddrakx-302a992cc5fed524f62416d74308ec400343884a.tar
drakx-302a992cc5fed524f62416d74308ec400343884a.tar.gz
drakx-302a992cc5fed524f62416d74308ec400343884a.tar.bz2
drakx-302a992cc5fed524f62416d74308ec400343884a.tar.xz
drakx-302a992cc5fed524f62416d74308ec400343884a.zip
(write_grub2_default_entry) split it
needed for next commit
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/bootloader.pm27
1 files changed, 17 insertions, 10 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index 6f4c4cd7e..bd615c02e 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -1884,16 +1884,8 @@ sub write_grub2_sysconfig {
setVarsInSh($f, \%conf);
}
-sub write_grub2 {
- my ($bootloader, $o_all_hds, $o_backup_extension) = @_;
- my $error;
-
- write_grub2_sysconfig($bootloader, $o_all_hds, $o_backup_extension);
-
- 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");
+sub write_grub2_default_entry {
+ my ($bootloader, $_all_hds, $o_backup_extension) = @_;
my $default = $bootloader->{default};
# menu entry must be identified by its full path. eg: "submenu1>submenu2>title":
@@ -1905,11 +1897,26 @@ sub write_grub2 {
eval {
my $f2 = "$::prefix/boot/grub2/grubenv";
cp_af($f2, $f2 . ($o_backup_extension || '.old'));
+ my $error;
run_program::rooted($::prefix, 'grub2-set-default', '2>', \$error, $default) or die "grub2-set-default failed: $error";
};
if (my $err = $@) {
log::l("error while running grub2-set-default: $err");
}
+}
+
+sub write_grub2 {
+ my ($bootloader, $o_all_hds, $o_backup_extension) = @_;
+ my $error;
+
+ write_grub2_sysconfig($bootloader, $o_all_hds, $o_backup_extension);
+
+ 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");
+
+ write_grub2_default_entry($bootloader, $o_all_hds, $o_backup_extension);
check_enough_space();
}