va_end(ap);
}
-
int mount_device(const char *dev_path)
{
- pb_log("attempt to mount device (%s) not supported\n", dev_path);
+ printf("[mount] %s\n", dev_path);
return 0;
}
+static int device_idx;
+static int option_idx;
+
int add_device(const struct device *dev)
{
- printf("device added:\n");
- printf("\tid: %s\n", dev->id);
- printf("\tname: %s\n", dev->name);
- printf("\tdescription: %s\n", dev->description);
- printf("\tboot_image: %s\n", dev->icon_file);
+ printf("[dev %2d] id: %s\n", device_idx, dev->id);
+ printf("[dev %2d] name: %s\n", device_idx, dev->name);
+ printf("[dev %2d] description: %s\n", device_idx, dev->description);
+ printf("[dev %2d] boot_image: %s\n", device_idx, dev->icon_file);
+
+ device_idx++;
+ option_idx = 0;
return 0;
}
+
int add_boot_option(const struct boot_option *opt)
{
- printf("option added:\n");
- printf("\tname: %s\n", opt->name);
- printf("\tdescription: %s\n", opt->description);
- printf("\tboot_image: %s\n", opt->boot_image_file);
- printf("\tinitrd: %s\n", opt->initrd_file);
- printf("\tboot_args: %s\n", opt->boot_args);
+ if (!device_idx) {
+ fprintf(stderr, "Option (%s) added before device\n",
+ opt->name);
+ exit(EXIT_FAILURE);
+ }
+
+ printf("[opt %2d] name: %s\n", option_idx, opt->name);
+ printf("[opt %2d] description: %s\n", option_idx, opt->description);
+ printf("[opt %2d] boot_image: %s\n", option_idx, opt->boot_image_file);
+ printf("[opt %2d] initrd: %s\n", option_idx, opt->initrd_file);
+ printf("[opt %2d] boot_args: %s\n", option_idx, opt->boot_args);
+
+ option_idx++;
+
return 0;
}
static char *mountpoint;
+/* pretend that all devices are mounted at our original mountpoint */
const char *mountpoint_for_device(const char *dev_path)
{
- char *tmp, *dev;
- dev = strrchr(dev_path, '/');
- if (dev)
- dev_path = dev + 1;
- asprintf(&tmp, "%s/%s", mountpoint, dev_path);
- return tmp;
+ return mountpoint;
}
char *resolve_path(const char *path, const char *default_mountpoint)
--- /dev/null
+[dev 0] id: sda1
+[dev 0] name: (null)
+[dev 0] description: (null)
+[dev 0] boot_image: /usr/share/petitboot/artwork/hdd.png
+[opt 0] name: live
+[opt 0] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --
+[opt 0] boot_image: devices/parser-tests/001//casper/vmlinux
+[opt 0] initrd: devices/parser-tests/001//casper/initrd.gz
+[opt 0] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --
+[opt 1] name: live_nosplash
+[opt 1] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz file=/cdrom/preseed/ubuntu.seed boot=casper quiet --
+[opt 1] boot_image: devices/parser-tests/001//casper/vmlinux
+[opt 1] initrd: devices/parser-tests/001//casper/initrd.gz
+[opt 1] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz file=/cdrom/preseed/ubuntu.seed boot=casper quiet --
+[opt 2] name: driverupdates
+[opt 2] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --
+[opt 2] boot_image: devices/parser-tests/001//casper/vmlinux
+[opt 2] initrd: devices/parser-tests/001//casper/initrd.gz
+[opt 2] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --
+[opt 3] name: check
+[opt 3] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz boot=casper integrity-check quiet splash --
+[opt 3] boot_image: devices/parser-tests/001//casper/vmlinux
+[opt 3] initrd: devices/parser-tests/001//casper/initrd.gz
+[opt 3] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz boot=casper integrity-check quiet splash --