summaryrefslogtreecommitdiffstats
path: root/debian/prep-bootdev.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:52 +0000
commitca67b09c015d4af3ae3cce12aa72e60941dbb8b5 (patch)
treeb7316d7b06c373e08dabb79a2c866c568e08f49e /debian/prep-bootdev.c
parentAdding upstream version 2.06. (diff)
downloadgrub2-ca67b09c015d4af3ae3cce12aa72e60941dbb8b5.tar.xz
grub2-ca67b09c015d4af3ae3cce12aa72e60941dbb8b5.zip
Adding debian version 2.06-13+deb12u1.debian/2.06-13+deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--debian/prep-bootdev.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/debian/prep-bootdev.c b/debian/prep-bootdev.c
new file mode 100644
index 0000000..700a486
--- /dev/null
+++ b/debian/prep-bootdev.c
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <parted/parted.h>
+
+int
+main(int argc, char *argv[])
+{
+ PedDevice *dev;
+
+ ped_exception_fetch_all();
+ ped_device_probe_all();
+ for (dev = ped_device_get_next(NULL); dev;
+ dev = ped_device_get_next(dev)) {
+ PedDisk *disk;
+ PedPartition *part;
+
+ disk = ped_disk_new(dev);
+ if (!disk)
+ continue;
+
+ for (part = ped_disk_next_partition(disk, NULL); part;
+ part = ped_disk_next_partition(disk, part)) {
+ if (ped_partition_is_active(part) &&
+ ped_partition_get_flag(part, PED_PARTITION_PREP)) {
+ char *path;
+
+ path = ped_partition_get_path(part);
+ if (path) {
+ printf("%s\n", path);
+ free(path);
+ return 0;
+ }
+ free(path);
+ }
+ }
+ }
+
+ return 0;
+}