summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-01-28 19:59:54 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-01-28 19:59:54 +0000
commit894627271072a1b4bc7c9e476e99da856e4ab2a0 (patch)
tree2332a32c7f581528fef731ddfefa778371d008c5 /perl-install
parented167f27c63d598a0ebb35276e4a20ea8bb5ad98 (diff)
downloaddrakx-backup-do-not-use-894627271072a1b4bc7c9e476e99da856e4ab2a0.tar
drakx-backup-do-not-use-894627271072a1b4bc7c9e476e99da856e4ab2a0.tar.gz
drakx-backup-do-not-use-894627271072a1b4bc7c9e476e99da856e4ab2a0.tar.bz2
drakx-backup-do-not-use-894627271072a1b4bc7c9e476e99da856e4ab2a0.tar.xz
drakx-backup-do-not-use-894627271072a1b4bc7c9e476e99da856e4ab2a0.zip
warn if partitions have been renumbered due to a partition being added or removed
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;
}