summaryrefslogtreecommitdiffstats
path: root/perl-install/bootloader.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2013-05-31 09:34:44 +0000
committerThierry Vignaud <tv@mageia.org>2013-05-31 09:34:44 +0000
commit1fe2940bbaa1196b33684634b2b1f8172d61e954 (patch)
tree1612c71d1a262c9547594bf4992b62fc6b374644 /perl-install/bootloader.pm
parentdbc1ff6d343003d1b913896d1f7211d5532073bd (diff)
downloaddrakx-1fe2940bbaa1196b33684634b2b1f8172d61e954.tar
drakx-1fe2940bbaa1196b33684634b2b1f8172d61e954.tar.gz
drakx-1fe2940bbaa1196b33684634b2b1f8172d61e954.tar.bz2
drakx-1fe2940bbaa1196b33684634b2b1f8172d61e954.tar.xz
drakx-1fe2940bbaa1196b33684634b2b1f8172d61e954.zip
(write_grub2) read/save choosen default entry
Diffstat (limited to 'perl-install/bootloader.pm')
-rw-r--r--perl-install/bootloader.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index 74601d740..dea5bf0bd 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -252,6 +252,11 @@ sub read_grub2 {
}
}
+ # get default entry:
+ foreach (run_program::rooted_get_stdout($::prefix, qw(grub2-editenv list))) {
+ $bootloader{default} = $1 if /saved_entry=(.*)/;
+ }
+
$bootloader{method} = 'grub2';
\%bootloader;
}
@@ -1813,6 +1818,11 @@ sub write_grub2 {
my $grub2_cfg = '/boot/grub2/grub.cfg';
run_program::rooted($::prefix, 'grub2-mkconfig', '2>', \$error, '-o', $grub2_cfg) or die "grub2-mkconfig failed: $error";
+
+ # set default entry:
+ eval {
+ run_program::rooted($::prefix, 'grub2-set-default', '2>', \$error, $bootloader->{default}) or die "grub2-mkconfig failed: $error";
+ };
}
sub write_grub {