diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2016-06-09 11:57:55 +0200 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2016-06-11 09:39:44 +0200 |
commit | 1b96be96d399303bcfa8d0f6c4920880848dac77 (patch) | |
tree | 6cea037cfd0c44e014a19e46966be65c1d3bdc26 /perl-install/fs | |
parent | 72836d6f7cf216e405db6e6675e03ebda63b0655 (diff) | |
download | drakx-1b96be96d399303bcfa8d0f6c4920880848dac77.tar drakx-1b96be96d399303bcfa8d0f6c4920880848dac77.tar.gz drakx-1b96be96d399303bcfa8d0f6c4920880848dac77.tar.bz2 drakx-1b96be96d399303bcfa8d0f6c4920880848dac77.tar.xz drakx-1b96be96d399303bcfa8d0f6c4920880848dac77.zip |
add a GRUB_BIOS partitions if needed (mga#18656)
Diffstat (limited to 'perl-install/fs')
-rw-r--r-- | perl-install/fs/any.pm | 33 | ||||
-rw-r--r-- | perl-install/fs/partitioning_wizard.pm | 5 |
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; |