summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2017-02-05 00:03:41 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2017-02-12 11:54:53 +0000
commite3662f1c4b563d148b8d6e7e650e93eff89b6df1 (patch)
treed0eaf4b2bb29e0d8601fe2d89a20a08ce2fd003d
parent02ba0f311a04e3fe93985bb75b6e7e99c6315b73 (diff)
downloaddrakx-e3662f1c4b563d148b8d6e7e650e93eff89b6df1.tar
drakx-e3662f1c4b563d148b8d6e7e650e93eff89b6df1.tar.gz
drakx-e3662f1c4b563d148b8d6e7e650e93eff89b6df1.tar.bz2
drakx-e3662f1c4b563d148b8d6e7e650e93eff89b6df1.tar.xz
drakx-e3662f1c4b563d148b8d6e7e650e93eff89b6df1.zip
Allow a BIOS boot partition to be located on any disk (mga#20161).
This relaxes the rules in fs::any::is_boot_bios_part_needed to allow the BIOS boot partition to be located on any disk, not just the disk containing the root partition. It also ensures that a BIOS boot partition is never forcibly required in a system with non-GPT disks.
-rw-r--r--perl-install/fs/any.pm35
-rw-r--r--perl-install/fs/partitioning_wizard.pm2
2 files changed, 18 insertions, 19 deletions
diff --git a/perl-install/fs/any.pm b/perl-install/fs/any.pm
index b47ac9f31..d2fea55ee 100644
--- a/perl-install/fs/any.pm
+++ b/perl-install/fs/any.pm
@@ -77,7 +77,7 @@ sub check_hds_boot_and_root {
die N("You must have a ESP FAT32 partition mounted in /boot/EFI");
}
} else {
- if (is_boot_bios_part_needed($all_hds, $fstab)) {
+ if (is_boot_bios_part_needed($all_hds)) {
die N("You must have a BIOS boot partition for non-UEFI GPT-partitioned disks. Please create one before continuing.");
}
}
@@ -145,31 +145,30 @@ sub getAvailableSpace_raw {
die "missing root partition";
}
-=head3 is_boot_bios_part_needed($all_hds, $fstab)
+=head3 is_boot_bios_part_needed($all_hds)
Returns whether a Boot BIOS Partition is needed
-(aka the device holding /boot is GPT partitionned but doesn't already have one).
+
+Returns true if all of the following are true:
+ - legacy boot (not UEFI)
+ - all disks are (or will be) GPT
+ - no disks have a BIOS boot partition
=cut
sub is_boot_bios_part_needed {
- my ($all_hds, $fstab) = @_;
- # failsafe:
+ my ($all_hds) = @_;
+ # never needed for UEFI boot
return if is_uefi();
- return if !@$fstab;
- # mount point holding /boot:
- my $root = fs::get::root($fstab, 1);
- my $rootDev = $root->{rootDevice};
- my $boot_hd;
- if ($rootDev) {
- $rootDev = "/dev/" . $rootDev if $rootDev !~ m!/!;
- # is it GPT?
- return if c::get_disk_type($rootDev) ne 'gpt';
- ($boot_hd) = find { $_->{device} eq $rootDev } fs::get::hds($all_hds);
+ # do we already have one?
+ my @parts = map { partition_table::get_normal_parts($_) } fs::get::hds($all_hds);
+ return if any { isBIOS_GRUB($_) } @parts;
+ # do we have any non-GPT disks?
+ foreach my $hd (@{$all_hds->{hds}}) {
+ my $type = $hd->{pt_table_type} || partition_table::default_type($hd);
+ return if $type ne 'gpt';
}
- # finally check if there's already a Boot BIOS Partition:
- my @parts = map { partition_table::get_normal_parts($_) } $boot_hd || fs::get::hds($all_hds);
- return !any { isBIOS_GRUB($_) } @parts;
+ 1;
}
1;
diff --git a/perl-install/fs/partitioning_wizard.pm b/perl-install/fs/partitioning_wizard.pm
index 6158dd440..eef836c55 100644
--- a/perl-install/fs/partitioning_wizard.pm
+++ b/perl-install/fs/partitioning_wizard.pm
@@ -78,7 +78,7 @@ Then choose action ``Mount point'' and set it to `/'"), 1) or return;
$ok = '';
}
} else {
- if (fs::any::is_boot_bios_part_needed($all_hds, \@fstab)) {
+ if (fs::any::is_boot_bios_part_needed($all_hds)) {
$in->ask_warn('', N("You must have a BIOS boot partition for non-UEFI GPT-partitioned disks. Please create one before continuing."));
$ok = '';
}