summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/diskdrake/interactive.pm14
-rw-r--r--perl-install/partition_table.pm14
2 files changed, 25 insertions, 3 deletions
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index 2a86d73af..22b508d60 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -106,6 +106,9 @@ struct hd {
bool needKernelReread # must we tell the kernel to reread the partition table
bool hasBeenDirty # for undo
bool rebootNeeded # happens when a kernel reread failed
+ bool partitionsRenumbered # happens when you
+ # - remove an extended partition which is not the last one
+ # - add an extended partition which is the first extended partition
int bus, id
partition_table_elem primary
@@ -451,6 +454,8 @@ sub Create {
},
) or return;
+ warn_if_renumbered($in, $hd);
+
if ($migrate_files eq 'migrate') {
format_($in, $hd, $part, $all_hds) or return;
migrate_files($in, $hd, $part);
@@ -478,6 +483,7 @@ sub Delete {
undef $partition_table_mac::bootstrap_part if (isAppleBootstrap($part) && ($part->{device} = $partition_table_mac::bootstrap_part));
}
partition_table::remove($hd, $part);
+ warn_if_renumbered($in, $hd);
}
}
@@ -985,6 +991,14 @@ sub migrate_files {
}
}
+sub warn_if_renumbered {
+ my ($in, $hd) = @_;
+ my $l = delete $hd->{partitionsRenumbered};
+ return if is_empty_array_ref($l);
+
+ my @l = map { _("partition %s is now known as %s", @$_) } @$l;
+ $in->ask_warn('', join("\n", 'Partitions have been renumbered: ', @l));
+}
#- unit of $mb is mega bytes, min and max are in sectors, this
#- function is used to convert back to sectors count the size of
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index 74645562d..9b09da13b 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -347,9 +347,16 @@ sub assign_device_numbers {
$_->{device} = $hd->{prefix} . $i++;
$start = $_->{start} + $_->{size};
}
- } else {
- $_->{device} = $hd->{prefix} . $i++ foreach @{$hd->{primary}{raw}},
- map { $_->{normal} } @{$hd->{extended} || []};
+ } else {
+ foreach (@{$hd->{primary}{raw}}) {
+ my $dev = $hd->{prefix} . $i++;
+ $_->{device} = $dev;
+ }
+ foreach (map { $_->{normal} } @{$hd->{extended} || []}) {
+ my $dev = $hd->{prefix} . $i++;
+ push @{$hd->{partitionsRenumbered}}, [ $_->{device}, $dev ] if $_->{device} && $dev ne $_->{device};
+ $_->{device} = $dev;
+ }
}
#- try to figure what the windobe drive letter could be!
@@ -633,6 +640,7 @@ sub remove {
delete $_->{normal}; #- remove it
remove_empty_extended($hd);
+ assign_device_numbers($hd);
return $hd->{isDirty} = $hd->{needKernelReread} = 1;
}