diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/NEWS | 1 | ||||
-rwxr-xr-x | perl-install/c/stuff.xs.pl | 29 | ||||
-rw-r--r-- | perl-install/install/NEWS | 1 | ||||
-rw-r--r-- | perl-install/partition_table/gpt.pm | 7 |
4 files changed, 37 insertions, 1 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS index 0b331ffad..9ad114fb1 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,5 +1,6 @@ - diskdrake: o fix retrieving ESP partition type on GPT + o set proper GUID to ESP partitions with GPT layout - 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 c6adf9a68..662831bc9 100755 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -596,6 +596,35 @@ is_partition_ESP(char * device_path, int part_number) OUTPUT: RETVAL +int +set_partition_flag(char * device_path, int part_number, char *type) + 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("set_partition_flag: failed to find partition\n"); + } else { + PedPartitionFlag flag = 0; + if (!strcmp(type, "ESP")) { + flag = PED_PARTITION_ESP; + } else { + printf("set_partition_flag: unknown type\n"); + } + if (flag) + RETVAL=ped_partition_set_flag(part, flag, 1); + if (RETVAL) + RETVAL = ped_disk_commit(disk); + } + ped_disk_destroy(disk); + } + } + OUTPUT: + RETVAL + const char * get_disk_type(char * device_path) diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index e0ddf0dcc..3d1b848df 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -2,6 +2,7 @@ fakeraids (containers defaults to >= 127 and partitions <=126) - partitionning: o fix retrieving ESP partition type on GPT + o set proper GUID to ESP partitions with GPT layout Version 16.69 - 20 March 2015 diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm index fdcad1e85..c6dd20f8f 100644 --- a/perl-install/partition_table/gpt.pm +++ b/perl-install/partition_table/gpt.pm @@ -6,6 +6,7 @@ use vars qw(@ISA); @ISA = qw(partition_table::raw); +use fs::type; use partition_table::raw; use c; @@ -110,7 +111,7 @@ sub read_one { # 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}) { + if (c::is_partition_ESP($hd->{file}, $_->{part_number})) { $_->{pt_type} = 0xef; } @pt[$_->{part_number}-1] = $_; @@ -141,6 +142,10 @@ sub write { print "($action, $part_number, $o_start, $o_size)\n"; if ($action eq 'add') { c::disk_add_partition($hd->{file}, $o_start, $o_size, $part->{fs_type}) or die "failed to add partition"; + if (isESP($part)) { + c::set_partition_flag($hd->{file}, $part_number, 'ESP') + or die "failed to set type for $part->{file} on $part->{mntpoint}"; + } } elsif ($action eq 'del' and !$partitions_killed) { c::disk_del_partition($hd->{file}, $part_number) or die "failed to del partition"; } |