tag 57368 patch
thanks
The following patch lets the user choose among PReP boot
partitions if there are more than one. Could someone with a
PReP machine please test it?
Matt
Index: utilities/dbootstrap/bootconfig.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/bootconfig.c,v
retrieving revision 1.184
diff -u -p -r1.184 bootconfig.c
--- utilities/dbootstrap/bootconfig.c 2002/03/11 08:56:15 1.184
+++ utilities/dbootstrap/bootconfig.c 2002/03/13 16:43:21
@@ -2692,21 +2692,62 @@ redisplay_options:
boot = Root->name;
if (strcmp(Arch2, "PReP") == 0) {
- if ((boot_part = fdisk_find_partition_by_type(PTYPE_PREP_BOOT)) != NULL) {
- /* Copy a kernel to the PReP boot partition */
- pleaseWaitBox(_("Copying the operating system kernel..."));
- snprintf(prtbuf, sizeof(prtbuf), BC_RUN_PREPDD, "/target/vmlinuz", boot_part->name);
- status=execlog(prtbuf, LOG_INFO);
- /* FIXME MDP: Handle the error cases */
- boxPopWindow();
- notInstalledLILO=0;
- return 0;
- }
- else {
- /* FIXME MDP: Add in error message, must learn pointerize */
-/* problemBox(_("No PReP boot partition found"),_("Problem")); */
+ struct fdisk_partition *p;
+
+ boot_part = fdisk_find_partition_by_type(PTYPE_PREP_BOOT);
+
+ /* If there is no boot partition, abort. */
+ if (boot_part == NULL)
return 1;
- }
+
+ /* If there is more than one, let the user choose. */
+ for (p = boot_part->next; p != NULL; p = p->next)
+ if (p->type == PTYPE_PREP_BOOT) {
+ struct d_choices *choices;
+ struct fdisk_partition **plist;
+ int i;
+
+ choices = malloc(2 * sizeof(struct d_choices));
+ plist = malloc(2 * sizeof(struct fdisk_partition *));
+
+ plist[0] = boot_part;
+ choices[0].string = boot_part->name;
+ choices[0].tag = NULL;
+ choices[0].state = 0;
+
+ for (i = 1; p != NULL; p = p->next) {
+ if (i >= 2) {
+ choices = realloc(choices, (i + 1) * sizeof (struct d_choices));
+ plist = realloc(plist, (i + 1) * sizeof (struct fdisk_partition *));
+ }
+ plist[i] = p;
+ choices[i].string = p->name;
+ choices[i].tag = NULL;
+ choices[i].state = 0;
+ i++;
+ }
+
+ i = menuBox(_("Select a PReP boot partition"),
+ _("Select Partition"), choices, i, 1);
+
+ if (i < 0)
+ return 1;
+
+ boot_part = plist[i];
+
+ free(choices);
+ free(plist);
+ break;
+ }
+
+ /* Copy a kernel to the PReP boot partition */
+ pleaseWaitBox(_("Copying the operating system kernel..."));
+ snprintf(prtbuf, sizeof(prtbuf), BC_RUN_PREPDD, "/target/vmlinuz", boot_part->name);
+ status=execlog(prtbuf, LOG_INFO);
+ /* FIXME MDP: Handle the error cases */
+ boxPopWindow();
+ notInstalledLILO=0;
+ return 0;
}
else {
status = run_plilo();
Attachment:
pgpKkGWcqDSwb.pgp
Description: PGP signature