summaryrefslogtreecommitdiffstats
path: root/perl-install/c/stuff.xs.pl
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2015-03-25 04:54:11 -0400
committerThierry Vignaud <thierry.vignaud@gmail.com>2015-03-25 19:55:51 +0100
commit14f3a580a02af53896d98ac559ec0788642996a6 (patch)
tree7e82957188a445b1b66aeeeebac3c94133177956 /perl-install/c/stuff.xs.pl
parentee22664bcb1fdedece15e07d047ba86f3d791ee6 (diff)
downloaddrakx-14f3a580a02af53896d98ac559ec0788642996a6.tar
drakx-14f3a580a02af53896d98ac559ec0788642996a6.tar.gz
drakx-14f3a580a02af53896d98ac559ec0788642996a6.tar.bz2
drakx-14f3a580a02af53896d98ac559ec0788642996a6.tar.xz
drakx-14f3a580a02af53896d98ac559ec0788642996a6.zip
set proper GUID to ESP partitions with GPT layout
Diffstat (limited to 'perl-install/c/stuff.xs.pl')
-rwxr-xr-xperl-install/c/stuff.xs.pl29
1 files changed, 29 insertions, 0 deletions
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)