From ee22664bcb1fdedece15e07d047ba86f3d791ee6 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 24 Mar 2015 10:47:13 -0400 Subject: fix retrieving ESP partition type ESP are the only partitions we're detecting through their pt_type (modulo 0x12 which was Compaq Diagnostic & unlikely to be found on GPT...) However GPT has no equivalent to pt_type But we can test for ESP flag --- perl-install/NEWS | 2 ++ perl-install/c/stuff.xs.pl | 21 +++++++++++++++++++++ perl-install/install/NEWS | 2 ++ perl-install/partition_table/gpt.pm | 6 +++++- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/perl-install/NEWS b/perl-install/NEWS index 29d00259b..0b331ffad 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,5 @@ +- diskdrake: + o fix retrieving ESP partition type on GPT - bump max_nb() to 131 to cover mdadm managed imsm and ddf1 bios fakeraids (containers defaults to >= 127 and partitions <=126) diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index 631271a1e..c6adf9a68 100755 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -576,6 +576,27 @@ get_iso_volume_ids(int fd) print ' +int +is_partition_ESP(char * device_path, int part_number) + CODE: + PedDevice *dev = ped_device_get(device_path); + RETVAL = 0; + if(dev) { + PedDisk* disk = ped_disk_new(dev); + if(disk) { + PedPartition* part = ped_disk_get_partition(disk, part_number); + if (!part) { + printf("is_partition_ESP: failed to find partition\n"); + } else { + RETVAL=ped_partition_get_flag(part, PED_PARTITION_ESP); + } + ped_disk_destroy(disk); + } + } + OUTPUT: + RETVAL + + const char * get_disk_type(char * device_path) CODE: diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 8accfd2b6..e0ddf0dcc 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,5 +1,7 @@ - bump max_nb() to 131 to cover mdadm managed imsm and ddf1 bios fakeraids (containers defaults to >= 127 and partitions <=126) +- partitionning: + o fix retrieving ESP partition type on GPT Version 16.69 - 20 March 2015 diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm index 77173b268..fdcad1e85 100644 --- a/perl-install/partition_table/gpt.pm +++ b/perl-install/partition_table/gpt.pm @@ -107,8 +107,12 @@ sub read_one { c::get_disk_type($hd->{file}) eq "gpt" or die "$hd->{device} not a GPT disk ($hd->{file})"; my @pt; - # FIXME: just use '@pt = c::...' if part_numbers are always linear: + # FIXME: just use '@pt = map { ... } c::...' if part_numbers are always linear: foreach (c::get_disk_partitions($hd->{file})) { + # fix detecting ESP (special case are they're detected through pt_type): + if (c::is_partition_ESP($hd->{file}, $_->{part_number}) { + $_->{pt_type} = 0xef; + } @pt[$_->{part_number}-1] = $_; } -- cgit v1.2.1