From f0c56a51a76547a8357c17f31ebee1edf74cc227 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Mon, 9 Feb 2009 18:09:29 +0000 Subject: When installing to a removable device, put boot sector there, else put it into first non removable drive (#47106) --- perl-install/bootloader.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'perl-install/bootloader.pm') diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 32fe34898..095c581d2 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -977,8 +977,16 @@ sub suggest { my $boot = fs::get::root($fstab, 'boot')->{device}; #- PPC xfs module requires enlarged initrd my $xfsroot = $root_part->{fs_type} eq 'xfs'; + my $mbr; + + # If installing onto an USB drive, put the mbr there, else on the first non removable drive + if ($root_part->{is_removable}) { + $mbr = find { $_->{device} eq $root_part->{rootDevice} } $all_hds->{hds}; + } else { + $mbr = find { !$_->{is_removable} } $all_hds->{hds}; + } - my ($onmbr, $unsafe) = $bootloader->{crushMbr} ? (1, 0) : suggest_onmbr($all_hds->{hds}[0]); + my ($onmbr, $unsafe) = $bootloader->{crushMbr} ? (1, 0) : suggest_onmbr($mbr); add2hash_($bootloader, arch() =~ /ppc/ ? { defaultos => "linux", @@ -999,7 +1007,7 @@ sub suggest { timeout => $onmbr && 10, nowarn => 1, if_(arch() !~ /ia64/, - boot => "/dev/" . ($onmbr ? $all_hds->{hds}[0]{device} : $boot), + boot => "/dev/" . ($onmbr ? $mbr->{device} : $boot), map => "/boot/map", compact => 1, color => 'black/cyan yellow/cyan', -- cgit v1.2.1