summaryrefslogtreecommitdiffstats
path: root/perl-install/fs
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/fs')
-rw-r--r--perl-install/fs/any.pm33
-rw-r--r--perl-install/fs/partitioning_wizard.pm5
2 files changed, 38 insertions, 0 deletions
diff --git a/perl-install/fs/any.pm b/perl-install/fs/any.pm
index 5471980d2..f8b314a34 100644
--- a/perl-install/fs/any.pm
+++ b/perl-install/fs/any.pm
@@ -3,9 +3,12 @@ package fs::any;
use diagnostics;
use strict;
+use c;
use common;
use fsedit;
+use fs::get;
use fs::mount_point;
+use fs::type;
use run_program;
sub get_hds {
@@ -71,6 +74,10 @@ sub check_hds_boot_and_root {
if (!fs::get::has_mntpoint("/boot/EFI", $all_hds)) {
die N("You must have a ESP FAT32 partition mounted in /boot/EFI");
}
+ } else {
+ if (is_boot_bios_part_needed($all_hds, $fstab)) {
+ die N("You must have a Boot BIOS partition");
+ }
}
}
@@ -136,4 +143,30 @@ sub getAvailableSpace_raw {
die "missing root partition";
}
+=head3 is_boot_bios_part_needed($fstab)
+
+Returns whether a Boot BIOS Partition is needed
+(aka the device holding /boot is GPT partitionned but doesn't already have one).
+
+=cut
+
+sub is_boot_bios_part_needed {
+ my ($all_hds, $fstab) = @_;
+ # failsafe:
+ 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) {
+ # is it GPT?
+ return if c::get_disk_type($rootDev) ne 'gpt';
+ ($boot_hd) = find { $_->{device} eq $rootDev } fs::get::hds($all_hds);
+ }
+ # 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;
diff --git a/perl-install/fs/partitioning_wizard.pm b/perl-install/fs/partitioning_wizard.pm
index d04a5bba3..82f03d24d 100644
--- a/perl-install/fs/partitioning_wizard.pm
+++ b/perl-install/fs/partitioning_wizard.pm
@@ -77,6 +77,11 @@ Then choose action ``Mount point'' and set it to `/'"), 1) or return;
$in->ask_warn('', N("You must have a ESP FAT32 partition mounted in /boot/EFI"));
$ok = '';
}
+ } else {
+ if (!fs::any::is_boot_bios_part_needed($all_hds, $fstab)) {
+ $in->ask_warn('', N("You must have a Boot BIOS partition"));
+ $ok = '';
+ }
}
} until $ok;
1;