summaryrefslogtreecommitdiffstats
path: root/perl-install/fs/any.pm
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-25 11:47:03 +0000
commitccb41194a4e1cca2b162b8221a506a6768e52c6d (patch)
tree1a54052913dfffa80939576bc2abdf100ffb674b /perl-install/fs/any.pm
parentdaf8670c08e54ac64407f7f209aaf9b460abdcc6 (diff)
downloaddrakx-ccb41194a4e1cca2b162b8221a506a6768e52c6d.tar
drakx-ccb41194a4e1cca2b162b8221a506a6768e52c6d.tar.gz
drakx-ccb41194a4e1cca2b162b8221a506a6768e52c6d.tar.bz2
drakx-ccb41194a4e1cca2b162b8221a506a6768e52c6d.tar.xz
drakx-ccb41194a4e1cca2b162b8221a506a6768e52c6d.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.
Diffstat (limited to 'perl-install/fs/any.pm')
-rw-r--r--perl-install/fs/any.pm35
1 files changed, 17 insertions, 18 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;