diff options
author | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2020-06-15 16:37:15 +0100 |
---|---|---|
committer | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2020-06-16 17:20:06 +0100 |
commit | ff4d256a950648b12348a42ef11dea8dd19c7453 (patch) | |
tree | c414788c4ab55022d5213ea2307852e4b82b04e5 /perl-install/fsedit.pm | |
parent | 8fca7cfca3baa1639e316c8307dd20479cbe8d1d (diff) | |
download | drakx-ff4d256a950648b12348a42ef11dea8dd19c7453.tar drakx-ff4d256a950648b12348a42ef11dea8dd19c7453.tar.gz drakx-ff4d256a950648b12348a42ef11dea8dd19c7453.tar.bz2 drakx-ff4d256a950648b12348a42ef11dea8dd19c7453.tar.xz drakx-ff4d256a950648b12348a42ef11dea8dd19c7453.zip |
When installing on a removable device, suggest an ESP on that device.
We must update the suggestions each time the user selects a different
target device.
Diffstat (limited to 'perl-install/fsedit.pm')
-rw-r--r-- | perl-install/fsedit.pm | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 2fcd1f1ee..684d802d7 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -43,23 +43,27 @@ use fs; my %bck_suggestions = %suggestions; sub init_mntpnt_suggestions { - my ($all_hds, $o_force) = @_; - my $fstab = [ fs::get::fstab($all_hds) ]; - state $done; - return if $done && !$o_force; - $done++; + my ($all_hds, $o_target, $o_force) = @_; + + my $device = $o_target ? $o_target->{device} : 'all'; + state $last_device; + return if $device eq $last_device && !$o_force; + $last_device = $device; + + #- If installing on a removable device, assume that the user wants that device to be self-bootable. + my $is_removable = $o_target && $o_target->{is_removable}; + my @fstab = $is_removable ? partition_table::get_normal_parts($o_target) : fs::get::fstab($all_hds); my $mntpoint; # only suggests /boot/EFI if there's not already one: require fs::any; if (is_uefi()) { - if (!any { isESP($_) } @$fstab) { + if (!any { isESP($_) } @fstab) { $mntpoint = { mntpoint => "/boot/EFI", size => MB(100), pt_type => 0xef, ratio => 1, maxsize => MB(300) }; } } - return if !$mntpoint; foreach (keys %suggestions) { - $suggestions{$_} = [ $mntpoint, @{$bck_suggestions{$_}} ]; + $suggestions{$_} = [ if_($mntpoint, $mntpoint), @{$bck_suggestions{$_}} ]; } } @@ -515,6 +519,11 @@ sub auto_allocate { my ($all_hds, $o_suggestions, $o_target) = @_; my $before = listlength(fs::get::fstab($all_hds)); + #- Make sure we don't finish with more than one /boot/EFI mount point + if (is_uefi()) { + delete $_->{mntpoint} foreach grep { $_->{mntpoint} eq '/boot/EFI' } fs::get::fstab($all_hds); + } + auto_allocate_bios_boot_parts($all_hds, $o_target) if !is_uefi(); my $suggestions = $o_suggestions || $suggestions{simple}; @@ -540,6 +549,10 @@ sub auto_allocate { die N("Nothing to do"); } } + + #- Don't suggest mount points on other drives when installing on a removable disk + return if $o_target && $o_target->{is_removable}; + my @fstab = fs::get::fstab($all_hds); fs::mount_point::suggest_mount_points_always(\@fstab); } |