From 14f3a580a02af53896d98ac559ec0788642996a6 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 25 Mar 2015 04:54:11 -0400 Subject: set proper GUID to ESP partitions with GPT layout --- perl-install/c/stuff.xs.pl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'perl-install/c') 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) -- cgit v1.2.1