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/Xconfig/various.pm | 2 +- perl-install/bootloader.pm | 27 +++++++++++++++++++++------ perl-install/install_steps.pm | 2 +- perl-install/standalone/bootloader-config | 2 +- perl-install/standalone/drakboot | 2 +- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/perl-install/Xconfig/various.pm b/perl-install/Xconfig/various.pm index 1ce1ce37e..c1997fb5a 100644 --- a/perl-install/Xconfig/various.pm +++ b/perl-install/Xconfig/various.pm @@ -132,7 +132,7 @@ sub configure_FB_TVOUT { require fsedit; require detect_devices; my $all_hds = $::isInstall ? $::o->{all_hds} : fsedit::get_hds(); - my $bootloader = $::isInstall ? $::o->{bootloader} : bootloader::read(fs::get::fstab($all_hds)); + my $bootloader = $::isInstall ? $::o->{bootloader} : bootloader::read($all_hds); if (my $tvout = bootloader::duplicate_kernel_entry($bootloader, 'TVout')) { $tvout->{append} .= " XFree=tvout"; 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' : $_; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 6eb2e0ae7..b35c6d5b8 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -831,7 +831,7 @@ sub readBootloaderConfigBeforeInstall { my ($o) = @_; require bootloader; - add2hash($o->{bootloader} ||= {}, bootloader::read($o->{fstab})); + add2hash($o->{bootloader} ||= {}, bootloader::read($o->{all_hds})); $o->{bootloader}{bootUnsafe} = 0 if $o->{bootloader}{boot}; #- when upgrading, don't ask where to install the bootloader (mbr vs boot partition) } diff --git a/perl-install/standalone/bootloader-config b/perl-install/standalone/bootloader-config index e80133fde..0bcd4d377 100755 --- a/perl-install/standalone/bootloader-config +++ b/perl-install/standalone/bootloader-config @@ -56,7 +56,7 @@ if ($image) { my $all_hds = fsedit::get_hds(); fs::get_info_from_fstab($all_hds); -my $bootloader = bootloader::read([ fs::get::fstab($all_hds) ]) or die "Cannot find a boot loader installed\n"; +my $bootloader = bootloader::read($all_hds) or die "Cannot find a boot loader installed\n"; $action =~ s/-/_/g; diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot index 3f3330d82..5babbda57 100755 --- a/perl-install/standalone/drakboot +++ b/perl-install/standalone/drakboot @@ -45,7 +45,7 @@ my $all_hds = fsedit::get_hds(); fs::get_raw_hds('', $all_hds); fs::get_info_from_fstab($all_hds); my $fstab = [ fs::get::fstab($all_hds) ]; -my $bootloader = bootloader::read($fstab); +my $bootloader = bootloader::read($all_hds); if (!$in->isa('interactive::gtk') || any { /^--boot$/ } @ARGV) { $::isWizard = 1; -- cgit v1.2.1