summaryrefslogtreecommitdiffstats
path: root/perl-install/bootloader.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/bootloader.pm')
-rw-r--r--perl-install/bootloader.pm19
1 files changed, 14 insertions, 5 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index 531162103..0c6b317ad 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -1791,6 +1791,16 @@ sub write_grub2 {
run_program::rooted($::prefix, 'grub2-set-default', '2>', \$error, $bootloader->{default}) or die "grub2-set-default failed: $error";
};
check_enough_space();
+ write_grub2_install_sh($bootloader, $o_backup_extension);
+}
+
+sub write_grub2_install_sh {
+ my ($bootloader, $o_backup_extension) = @_;
+ my $f = "$::prefix/boot/grub2/install.sh";
+ my $boot = $bootloader->{boot};
+ my @options = $boot =~ /\d$/ ? ('--grub-setup=/bin/true', $boot) : $boot;
+ renamef($f, $f . ($o_backup_extension || '.old'));
+ output_with_perm($f, 0755, join(' ', 'grub2-install', @options));
}
sub write_grub {
@@ -1994,13 +2004,12 @@ sub install_grub2 {
sub install_raw_grub2 {
my ($boot) = @_;
my $error;
- # if (member($boot, map { "/dev/$_->{device}" } @{$all_hds->{hds}}) {
- my @options = $boot =~ /\d$/ ? ('--grub-setup=/bin/true', $boot) : $boot;
- if (!run_program::rooted($::prefix, 'grub2-install', '2>', \$error, @options)) {
- log::explanations("grub2-install failed:\n(grub2-install @options)\nError: <$error>");
+ my $f = '/boot/grub2/install.sh';
+ if (!run_program::rooted($::prefix, "sh", "2>", \$error, $f)) {
+ log::explanations("grub2-install failed:\n(" . cat_($f) . ")\nError: <$error>");
die "grub2-install failed: $error";
}
- setVarsInSh("$::prefix/boot/grub2/drakboot.conf", { boot => $boot });
+ unlink("$::prefix/boot/grub2/drakboot.conf");
}
sub install_grub {