summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2012-04-05 22:00:36 +0000
committerPascal Terjan <pterjan@mageia.org>2012-04-05 22:00:36 +0000
commit01b766fd58782263cb51162a89331560d4a4518c (patch)
tree4297f015d7d7a4d4b25c6a17e8d6f09a5598b0e0 /perl-install/partition_table
parent32084a3eb924fd488e85d90f13cf2b57fab2d093 (diff)
downloaddrakx-01b766fd58782263cb51162a89331560d4a4518c.tar
drakx-01b766fd58782263cb51162a89331560d4a4518c.tar.gz
drakx-01b766fd58782263cb51162a89331560d4a4518c.tar.bz2
drakx-01b766fd58782263cb51162a89331560d4a4518c.tar.xz
drakx-01b766fd58782263cb51162a89331560d4a4518c.zip
Fix partition numbering on GPT (mga#3091)
Diffstat (limited to 'perl-install/partition_table')
-rw-r--r--perl-install/partition_table/gpt.pm23
1 files changed, 14 insertions, 9 deletions
diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm
index 5607ed215..24e2f4029 100644
--- a/perl-install/partition_table/gpt.pm
+++ b/perl-install/partition_table/gpt.pm
@@ -9,6 +9,7 @@ use vars qw(@ISA);
use partition_table::raw;
use c;
+my $nb_primary = 128;
#sub use_pt_type { 1 }
sub read_one {
@@ -16,7 +17,7 @@ sub read_one {
my $info;
c::get_disk_type($hd->{file}) eq "gpt" or die "not a GPT disk";
- my @pt = map {
+ my %parts = map {
my %p;
print $_;
if (/^([^ ]*) ([^ ]*) ([^ ]*) (.*) \((\d*),(\d*),(\d*)\)$/) {
@@ -27,9 +28,20 @@ sub read_one {
$p{start} = $5;
$p{size} = $7;
}
- \%p;
+ $p{part_number} => \%p;
} c::get_disk_partitions($hd->{file});
+ my @pt = map {
+ my $part_number = $_;
+ if ($parts{$part_number}) {
+ $parts{$part_number};
+ } else {
+ my %p;
+ $p{part_number} = $part_number;
+ \%p;
+ }
+ } (1..$nb_primary);
+
[ @pt ], $info;
}
@@ -62,13 +74,6 @@ sub initialize {
}
sub can_add { &can_raw_add }
-sub can_raw_add { 1 }
-sub raw_add {
- my ($hd, $raw, $part) = @_;
- $hd->can_raw_add or die "raw_add: partition table already full";
- push @$raw, $part;
-}
-
sub adjustStart {}
sub adjustEnd {}