From 0adf9412b786342346a9df9fd262765d6b97d38f Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sat, 28 Mar 2015 02:42:02 +0100 Subject: try to detect recovery partitions on GPT --- perl-install/c/stuff.xs.pl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'perl-install/c') diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index 9a983a493..9d8c11375 100755 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -590,6 +590,31 @@ get_iso_volume_ids(int fd) print ' +int +is_recovery_partition(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_recovery_partition: failed to find partition\n"); + } else { + /* FIXME: not sure everything is covered ... */ + RETVAL=ped_partition_get_flag(part, PED_PARTITION_HPSERVICE) // HP-UX service partition + || ped_partition_get_flag(part, PED_PARTITION_MSFT_RESERVED) // Microsoft Reserved Partition -> LDM metadata, ... + || ped_partition_get_flag(part, PED_PARTITION_DIAG) // ==> PARTITION_MSFT_RECOVERY (Windows Recovery Environment) + || ped_partition_get_flag(part, PED_PARTITION_APPLE_TV_RECOVERY) + || ped_partition_get_flag(part, PED_PARTITION_HIDDEN); + } + ped_disk_destroy(disk); + } + } + OUTPUT: + RETVAL + int get_partition_flag(char * device_path, int part_number, char *type) CODE: -- cgit v1.2.1