summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table/gpt.pm
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
commit4ac3770fa60af29e830bb0b0c886cc0afc3ea84e (patch)
tree4297f015d7d7a4d4b25c6a17e8d6f09a5598b0e0 /perl-install/partition_table/gpt.pm
parent3b6296275c8e2e926d9f05c7c0b2596eb2f7093e (diff)
downloaddrakx-backup-do-not-use-4ac3770fa60af29e830bb0b0c886cc0afc3ea84e.tar
drakx-backup-do-not-use-4ac3770fa60af29e830bb0b0c886cc0afc3ea84e.tar.gz
drakx-backup-do-not-use-4ac3770fa60af29e830bb0b0c886cc0afc3ea84e.tar.bz2
drakx-backup-do-not-use-4ac3770fa60af29e830bb0b0c886cc0afc3ea84e.tar.xz
drakx-backup-do-not-use-4ac3770fa60af29e830bb0b0c886cc0afc3ea84e.zip
Fix partition numbering on GPT (mga#3091)
Diffstat (limited to 'perl-install/partition_table/gpt.pm')
-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 {}