From 150b8ceb722bdbd393f6237a62eddffbbd7c64b6 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 26 Oct 2004 15:29:33 +0000 Subject: detectloader must handle specially raid-extra-boot=mbr-only (bugzilla #12089) --- perl-install/bootloader.pm | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'perl-install/bootloader.pm') diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index b3c9b045b..31bb13665 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -145,13 +145,28 @@ sub add_boot_splash { } sub read { - my ($fstab) = @_; + my ($all_hds) = @_; + my $fstab = [ fs::get::fstab($all_hds) ]; my @methods = method_choices_raw(); foreach my $main_method (uniq(map { main_method($_) } @methods)) { my $f = $bootloader::{"read_$main_method"} or die "unknown bootloader method $main_method (read)"; my $bootloader = $f->($fstab); - my $type = partition_table::raw::typeOfMBR($bootloader->{boot}); - warn "typeOfMBR $type on $bootloader->{boot} for method $main_method\n" if $ENV{DEBUG}; + + my @devs = $bootloader->{boot}; + if ($bootloader->{'raid-extra-boot'} =~ /mbr/ && + (my $md = fs::get::device2part($bootloader->{boot}, $all_hds->{raids}))) { + @devs = map { $_->{rootDevice} } @{$md->{disks}}; + } elsif ($bootloader->{'raid-extra-boot'} =~ m!/dev/!) { + @devs = split(',', $bootloader->{'raid-extra-boot'}); + } + + my ($type) = map { + if (my $type = partition_table::raw::typeOfMBR($_)) { + warn "typeOfMBR $type on $_ for method $main_method\n" if $ENV{DEBUG}; + $type; + } else { () } + } @devs; + if ($type eq $main_method) { my @prefered_entries = map { get_label($_, $bootloader) } $bootloader->{default}, 'linux'; @@ -780,8 +795,8 @@ wait for default boot. } sub detect_main_method { - my ($fstab) = @_; - my $bootloader = &read($fstab); + my ($all_hds) = @_; + my $bootloader = &read($all_hds); $bootloader && main_method($bootloader->{method}); } @@ -1328,7 +1343,7 @@ sub update_for_renumbered_partitions { } } - my $main_method = detect_main_method([ fs::get::fstab($all_hds) ]); + my $main_method = detect_main_method($all_hds); my @needed = $main_method ? $main_method : ('lilo', 'grub'); if (find { my $config = $_ eq 'grub' ? 'grub_install' : $_; -- cgit v1.2.1