diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2015-03-28 02:42:02 +0100 |
---|---|---|
committer | Thomas Backlund <tmb@mageia.org> | 2015-03-30 15:05:42 +0259 |
commit | 0adf9412b786342346a9df9fd262765d6b97d38f (patch) | |
tree | cee36654909e2452e8d07678ee333e15ae4e25ec /perl-install | |
parent | 6da0111e315928dd9d42494ea3c0d5c208a1f411 (diff) | |
download | drakx-0adf9412b786342346a9df9fd262765d6b97d38f.tar drakx-0adf9412b786342346a9df9fd262765d6b97d38f.tar.gz drakx-0adf9412b786342346a9df9fd262765d6b97d38f.tar.bz2 drakx-0adf9412b786342346a9df9fd262765d6b97d38f.tar.xz drakx-0adf9412b786342346a9df9fd262765d6b97d38f.zip |
try to detect recovery partitions on GPT
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/NEWS | 1 | ||||
-rwxr-xr-x | perl-install/c/stuff.xs.pl | 25 | ||||
-rw-r--r-- | perl-install/install/NEWS | 1 | ||||
-rw-r--r-- | perl-install/partition_table/gpt.pm | 2 |
4 files changed, 29 insertions, 0 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS index cdc1b7c68..673bac170 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,5 +1,6 @@ - diskdrake: o better fix for fail to read too corrupted partition table + o try to detect recovery partitions on GPT - stage2: o revert changes made in 16.70 for a better fix to mga#13894 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 @@ -591,6 +591,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: PedDevice *dev = ped_device_get(device_path); diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 5d64b6d57..c1a2f8029 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,5 +1,6 @@ - partitionning: o better fix for fail to read too corrupted partition table + o try to detect recovery partitions on GPT Version 16.74 - 27 March 2015 diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm index 11cbe414d..3f0bc3f13 100644 --- a/perl-install/partition_table/gpt.pm +++ b/perl-install/partition_table/gpt.pm @@ -117,6 +117,8 @@ sub read_one { $_->{pt_type} = 0x8e; } elsif (c::get_partition_flag($hd->{file}, $_->{part_number}, 'RAID')) { $_->{pt_type} = 0xfd; + } elsif (c::get_partition_flag($hd->{file}, $_->{part_number}, 'recovery')) { + $_->{pt_type} = 0x12; } $_->{fs_type} = 'swap' if $_->{fs_type} eq 'linux-swap(v1)'; $_->{fs_type} = 'ntfs-3g' if $_->{fs_type} eq 'ntfs'; |