summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@gmail.com>2015-04-18 23:58:12 +0000
committerPascal Terjan <pterjan@gmail.com>2015-04-18 23:58:12 +0000
commit71c5f17dd864c7783909f75f6e7d5bd9d56ce425 (patch)
tree27114e40aa796673dc6b8a438b229af87a9482ee
parent4998a6d4c66c42d8522ddaf36cda5ccb9dd964e9 (diff)
downloaddrakx-71c5f17dd864c7783909f75f6e7d5bd9d56ce425.tar
drakx-71c5f17dd864c7783909f75f6e7d5bd9d56ce425.tar.gz
drakx-71c5f17dd864c7783909f75f6e7d5bd9d56ce425.tar.bz2
drakx-71c5f17dd864c7783909f75f6e7d5bd9d56ce425.tar.xz
drakx-71c5f17dd864c7783909f75f6e7d5bd9d56ce425.zip
use the windows partition with the most available space on current
+ disk, not the last one across all disks (mga#15589)
-rw-r--r--perl-install/NEWS4
-rw-r--r--perl-install/fs/partitioning_wizard.pm27
-rw-r--r--perl-install/install/NEWS4
3 files changed, 26 insertions, 9 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index e5e616741..bbfbddd5e 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,6 +1,6 @@
- partitioning_wizard:
- o use the windows partition with the most available space, not the one
- where Windows will have most space left after resizing.
+ o use the windows partition with the most available space on current
+ disk, not the last one across all disks (mga#15589)
o suggest up to 20GB/20% of the windows partition (whichever is larger),
previously 6GB/10% (mga#15589)
- ugtk2, ugtk3, harddrake2:
diff --git a/perl-install/fs/partitioning_wizard.pm b/perl-install/fs/partitioning_wizard.pm
index df8688bef..a30fa67d0 100644
--- a/perl-install/fs/partitioning_wizard.pm
+++ b/perl-install/fs/partitioning_wizard.pm
@@ -178,7 +178,13 @@ sub partitionWizardSolutions {
}, \&partition_table::description, \@ok_for_resize_fat) or return;
$part->{size} > $part->{min_linux} + $part->{min_win} or die N("Your Microsoft Windows® partition is too fragmented. Please reboot your computer under Microsoft Windows®, run the ``defrag'' utility, then restart the %s installation.", N("Mageia"));
} else {
- $part = top(grep { $_->{size} - $_->{req_size} } @ok_for_resize_fat);
+ my @selected = grep {
+ $_->{selected_for_resize} &&
+ $o_target->{device} eq $_->{rootDevice} # Not needed but let's be safe
+ } @ok_for_resize_fat;
+ my $nb_parts = @selected;
+ die N("Failed to find the partition to resize (%d choices)", $nb_parts) unless $nb_parts == 1;
+ $part = @selected[0];
}
my $resize_fat = $part->{resize_fat};
my $hd = fs::get::part2hd($part, $all_hds);
@@ -307,16 +313,27 @@ sub create_display_box {
my $part_sep;
my $desc;
- my $last = $resize && $resize->[-1];
+ if ($resize) {
+ my %resizable_parts;
+ foreach my $entry (@$resize) {
+ # selected_for_resize may have been set on another disk, clear it
+ $entry->{selected_for_resize} = 0;
+ $resizable_parts{$entry->{device}} = $entry;
+ }
+ # find resizable parts on this disk
+ my @choices = grep { $resizable_parts{$_->{device}} } @parts;
+ my @sorted_resize = sort {
+ ($a->{size} - $a->{req_size}) <=> ($b->{size} - $b->{req_size})
+ } @choices;
+ $sorted_resize[-1]->{selected_for_resize} = 1;
+ }
foreach my $entry (@parts) {
my $part_info = Gtk3::Label->new($entry->{device_LABEL});
my @colorized_fs_types = qw(ext2 ext3 ext4 xfs swap vfat ntfs ntfs-3g);
my $part_widget = Gtk3::EventBox->new;
$entry->{width} = int($entry->{size} * $initial_ratio) + $minwidth;
- if ($last && $last->{device} eq $entry->{device}) {
- #- entry is the last resizable partition
-
+ if ($entry->{selected_for_resize}) {
my $ratio;
my $update_ratio = sub { $ratio = $entry->{width} / $entry->{size} };
$update_ratio->();
diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index 91d6229d2..0f2cfbdac 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -1,6 +1,6 @@
- partitioning:
- o use the windows partition with the most available space, not the one
- where Windows will have most space left after resizing.
+ o use the windows partition with the most available space on current
+ disk, not the last one across all disks (mga#15589)
o suggest up to 20GB/20% of the windows partition (whichever is larger),
previously 6GB/10% (mga#15589)