From 01b766fd58782263cb51162a89331560d4a4518c Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Thu, 5 Apr 2012 22:00:36 +0000 Subject: Fix partition numbering on GPT (mga#3091) --- perl-install/NEWS | 3 +++ perl-install/install/NEWS | 3 +++ perl-install/partition_table/gpt.pm | 23 ++++++++++++++--------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/perl-install/NEWS b/perl-install/NEWS index f05fcabfb..84b339da8 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,6 @@ +- diskdrake: + o fix partition numbering on GPT (mga#3091) + Version 14.2 - 5 April 2012 - harddrake service: diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 66d178fbb..dfbbfcb95 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,3 +1,6 @@ +- diskdrake: + o fix partition numbering on GPT (mga#3091) + Version 14.2 - 5 April 2012 - add boot splash to initrd only once 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 {} -- cgit v1.2.1