2 * The new sysinstall program.
4 * This is probably the last program in the `sysinstall' line - the next
5 * generation being essentially a complete rewrite.
10 * Jordan Hubbard. All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer,
17 * verbatim and that no modifications are made prior to this
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
23 * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 #include "sysinstall.h"
41 #include <sys/disklabel.h>
43 enum size_units_t { UNIT_BLOCKS, UNIT_KILO, UNIT_MEG, UNIT_SIZE };
46 #define SUBTYPE_FREEBSD 50324
47 #define SUBTYPE_FAT 37218
49 #define SUBTYPE_FREEBSD 165
53 /* Where we start displaying chunk information on the screen */
54 #define CHUNK_START_ROW 5
56 /* Where we keep track of MBR chunks */
57 static struct chunk *chunk_info[16];
58 static int current_chunk;
60 static void diskPartitionNonInteractive(Device *dev);
61 static u_char * bootalloc(char *name, size_t *size);
64 record_chunks(Disk *d)
66 struct chunk *c1 = NULL;
71 msgFatal("No chunk list found for %s!", d->name);
73 for (c1 = d->chunks->part; c1; c1 = c1->next) {
74 if (c1->type == unused && c1->size > last_free) {
81 if (current_chunk >= i)
82 current_chunk = i - 1;
88 print_chunks(Disk *d, int u)
95 szstr = (u == UNIT_MEG ? "MB" : (u == UNIT_KILO ? "KB" : "ST"));
97 for (i = Total = 0; chunk_info[i]; i++)
98 Total += chunk_info[i]->size;
100 if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
101 dialog_clear_norefresh();
102 msgConfirm("WARNING: A geometry of %lu/%lu/%lu for %s is incorrect. Using\n"
103 "a more likely geometry. If this geometry is incorrect or you\n"
104 "are unsure as to whether or not it's correct, please consult\n"
105 "the Hardware Guide in the Documentation submenu or use the\n"
106 "(G)eometry command to change it now.\n\n"
107 "Remember: you need to enter whatever your BIOS thinks the\n"
108 "geometry is! For IDE, it's what you were told in the BIOS\n"
109 "setup. For SCSI, it's the translation mode your controller is\n"
110 "using. Do NOT use a ``physical geometry''.",
111 d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
112 Sanitize_Bios_Geom(d);
116 mvaddstr(0, 0, "Disk name:\t");
118 attrset(A_REVERSE); addstr(d->name); attrset(A_NORMAL);
119 attrset(A_REVERSE); mvaddstr(0, 55, "FDISK Partition Editor"); attrset(A_NORMAL);
121 "DISK Geometry:\t%lu cyls/%lu heads/%lu sectors = %lu sectors (%luMB)",
122 d->bios_cyl, d->bios_hd, d->bios_sect,
123 d->bios_cyl * d->bios_hd * d->bios_sect,
124 d->bios_cyl * d->bios_hd * d->bios_sect * 512 / 1024 / 1024);
125 mvprintw(3, 0, "%6s %10s(%s) %10s %8s %6s %10s %8s %8s",
126 "Offset", "Size", szstr, "End", "Name", "PType", "Desc",
128 for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
130 default: /* fall thru */
132 sz = chunk_info[i]->size;
135 sz = chunk_info[i]->size * 512 / 1024;
138 sz = chunk_info[i]->size * 512 / 1024 / 1024;
141 if (i == current_chunk)
142 attrset(ATTR_SELECTED);
143 mvprintw(row, 0, "%10ld %10lu %10lu %8s %6d %10s %8d\t%-6s",
144 chunk_info[i]->offset, sz,
145 chunk_info[i]->end, chunk_info[i]->name,
147 slice_type_name(chunk_info[i]->type, chunk_info[i]->subtype),
148 chunk_info[i]->subtype, ShowChunkFlags(chunk_info[i]));
149 if (i == current_chunk)
155 print_command_summary()
157 mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
158 mvprintw(16, 0, "A = Use Entire Disk G = set Drive Geometry C = Create Slice F = `DD' mode");
159 mvprintw(17, 0, "D = Delete Slice Z = Toggle Size Units S = Set Bootable | = Wizard m.");
160 mvprintw(18, 0, "T = Change Type U = Undo All Changes Q = Finish");
162 mvprintw(18, 47, "W = Write Changes");
163 mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to select.");
169 getBootMgr(char *dname, u_char **bootipl, size_t *bootipl_size,
170 u_char **bootmenu, size_t *bootmenu_size)
172 static u_char *boot0;
173 static size_t boot0_size;
174 static u_char *boot05;
175 static size_t boot05_size;
181 cp = variable_get(VAR_BOOTMGR);
183 /* Figure out what kind of MBR the user wants */
184 sprintf(str, "Install Boot Manager for drive %s?", dname);
185 MenuMBRType.title = str;
186 i = dmenuOpenSimple(&MenuMBRType, FALSE);
188 if (!strncmp(cp, "boot", 4))
196 if (!boot0) boot0 = bootalloc("boot0", &boot0_size);
198 *bootipl_size = boot0_size;
199 if (!boot05) boot05 = bootalloc("boot0.5", &boot05_size);
201 *bootmenu_size = boot05_size;
215 getBootMgr(char *dname, u_char **bootCode, size_t *bootCodeSize)
217 #ifndef __alpha__ /* only meaningful on x86 */
218 static u_char *mbr, *boot0;
219 static size_t mbr_size, boot0_size;
224 cp = variable_get(VAR_BOOTMGR);
226 /* Figure out what kind of MBR the user wants */
227 sprintf(str, "Install Boot Manager for drive %s?", dname);
228 MenuMBRType.title = str;
229 i = dmenuOpenSimple(&MenuMBRType, FALSE);
232 if (!strncmp(cp, "boot", 4))
234 else if (!strcmp(cp, "standard"))
242 if (!boot0) boot0 = bootalloc("boot0", &boot0_size);
244 *bootCodeSize = boot0_size;
247 if (!mbr) mbr = bootalloc("mbr", &mbr_size);
249 *bootCodeSize = mbr_size;
263 diskGetSelectCount(Device ***devs)
269 cp = variable_get(VAR_DISK);
270 dp = *devs = deviceFind(cp, DEVICE_TYPE_DISK);
271 cnt = deviceCount(dp);
274 for (i = 0, enabled = 0; i < cnt; i++) {
282 diskPartition(Device *dev)
292 size_t bootmenu_size;
297 WINDOW *w = savescr();
298 Disk *d = (Disk *)dev->private;
301 size_unit = UNIT_BLOCKS;
303 keypad(stdscr, TRUE);
305 /* Flush both the dialog and curses library views of the screen
306 since we don't always know who called us */
307 dialog_clear_norefresh(), clear();
310 /* Set up the chunk array */
314 char *val, geometry[80];
316 /* Now print our overall state */
318 print_chunks(d, size_unit);
319 print_command_summary();
321 attrset(title_attr); mvprintw(23, 0, msg); attrset(A_NORMAL);
330 /* Get command character */
332 switch (toupper(key)) {
333 case '\014': /* ^L (redraw) */
338 case '\020': /* ^P */
341 if (current_chunk != 0)
345 case '\016': /* ^N */
350 if (chunk_info[current_chunk + 1])
359 while (chunk_info[current_chunk + 1])
365 systemDisplayHelp("slice");
370 case 'F': /* Undocumented magic Dangerously Dedicated mode */
373 #else /* The rest is only relevant on x86 */
374 cp = variable_get(VAR_DEDICATE_DISK);
375 if (cp && !strcasecmp(cp, "always"))
377 else if (toupper(key) == 'A')
380 rv = msgYesNo("Do you want to do this with a true partition entry\n"
381 "so as to remain cooperative with any future possible\n"
382 "operating systems on the drive(s)?\n"
383 "(See also the section about ``dangerously dedicated''\n"
384 "disks in the FreeBSD FAQ.)");
390 variable_set2(DISK_PARTITIONED, "yes", 0);
396 if (chunk_info[current_chunk]->type != unused)
397 msg = "Slice in use, delete it first or move to an unused one.";
399 char *val, tmp[20], *cp;
404 snprintf(name, 16, "%s", "FreeBSD");
405 val = msgGetInput(name,
406 "Please specify the name for new FreeBSD slice.");
408 strncpy(name, val, 16);
411 chunk_e partitiontype;
413 snprintf(tmp, 20, "%lu", chunk_info[current_chunk]->size);
414 val = msgGetInput(tmp, "Please specify the size for new FreeBSD slice in blocks\n"
415 "or append a trailing `M' for megabytes (e.g. 20M).");
416 if (val && (size = strtol(val, &cp, 0)) > 0) {
417 if (*cp && toupper(*cp) == 'M')
419 else if (*cp && toupper(*cp) == 'G')
422 Create_Chunk(d, chunk_info[current_chunk]->offset, size,
424 (chunk_info[current_chunk]->flags & CHUNK_ALIGN),
426 variable_set2(DISK_PARTITIONED, "yes", 0);
429 sprintf(tmp, "%d", SUBTYPE_FREEBSD);
430 val = msgGetInput(tmp, "Enter type of partition to create:\n\n"
431 "Pressing Enter will choose the default, a native FreeBSD\n"
432 "slice (type 165). You can choose other types, 6 for a\n"
433 "DOS partition or 131 for a Linux partition, for example.\n\n"
434 "Note: If you choose a non-FreeBSD partition type, it will not\n"
435 "be formatted or otherwise prepared, it will simply reserve space\n"
436 "for you to use another tool, such as DOS FORMAT, to later format\n"
437 "and use the partition.");
438 if (val && (subtype = strtol(val, NULL, 0)) > 0) {
439 if (subtype == SUBTYPE_FREEBSD)
440 partitiontype = freebsd;
441 else if (subtype == SUBTYPE_FAT)
444 partitiontype = unknown;
446 if (partitiontype == freebsd && size == chunk_info[current_chunk]->size)
450 Create_Chunk(d, chunk_info[current_chunk]->offset, size, partitiontype, subtype,
451 (chunk_info[current_chunk]->flags & CHUNK_ALIGN));
452 variable_set2(DISK_PARTITIONED, "yes", 0);
463 if (chunk_info[current_chunk]->type == unused)
464 msg = "Slice is already unused!";
466 Delete_Chunk(d, chunk_info[current_chunk]);
467 variable_set2(DISK_PARTITIONED, "yes", 0);
473 if (chunk_info[current_chunk]->type == unused)
474 msg = "Slice is currently unused (use create instead)";
478 chunk_e partitiontype;
480 sprintf(tmp, "%d", SUBTYPE_FREEBSD);
482 val = msgGetInput(tmp, "New partition type:\n\n"
483 "Pressing Enter will choose the default, a native FreeBSD\n"
484 "slice (type 50324). Other popular values are 37218 for\n"
485 "DOS FAT partition.\n\n"
486 "Note: If you choose a non-FreeBSD partition type, it will not\n"
487 "be formatted or otherwise prepared, it will simply reserve space\n"
488 "for you to use another tool, such as DOS format, to later format\n"
489 "and actually use the partition.");
491 val = msgGetInput(tmp, "New partition type:\n\n"
492 "Pressing Enter will choose the default, a native FreeBSD\n"
493 "slice (type 165). Other popular values are 6 for\n"
494 "DOS FAT partition, 131 for a Linux ext2fs partition or\n"
495 "130 for a Linux swap partition.\n\n"
496 "Note: If you choose a non-FreeBSD partition type, it will not\n"
497 "be formatted or otherwise prepared, it will simply reserve space\n"
498 "for you to use another tool, such as DOS format, to later format\n"
499 "and actually use the partition.");
501 if (val && (subtype = strtol(val, NULL, 0)) > 0) {
502 if (subtype == SUBTYPE_FREEBSD)
503 partitiontype = freebsd;
504 else if (subtype == SUBTYPE_FAT)
507 partitiontype = unknown;
508 chunk_info[current_chunk]->type = partitiontype;
509 chunk_info[current_chunk]->subtype = subtype;
515 snprintf(geometry, 80, "%lu/%lu/%lu", d->bios_cyl, d->bios_hd, d->bios_sect);
516 val = msgGetInput(geometry, "Please specify the new geometry in cyl/hd/sect format.\n"
517 "Don't forget to use the two slash (/) separator characters!\n"
518 "It's not possible to parse the field without them.");
521 nc = strtol(val, &val, 0);
522 nh = strtol(val + 1, &val, 0);
523 ns = strtol(val + 1, 0, 0);
524 Set_Bios_Geom(d, nc, nh, ns);
531 chunk_info[current_chunk]->flags |= CHUNK_ACTIVE;
535 if (!variable_cmp(DISK_LABELLED, "written")) {
536 msgConfirm("You've already written this information out - you\n"
539 else if (!msgNoYes("Are you SURE you want to Undo everything?")) {
542 sstrncpy(cp, d->name, sizeof cp);
543 Free_Disk(dev->private);
546 msgConfirm("Can't reopen disk %s! Internal state is probably corrupted", cp);
548 variable_unset(DISK_PARTITIONED);
549 variable_unset(DISK_LABELLED);
557 if (!msgNoYes("WARNING: This should only be used when modifying an EXISTING\n"
558 "installation. If you are installing FreeBSD for the first time\n"
559 "then you should simply type Q when you're finished here and your\n"
560 "changes will be committed in one batch automatically at the end of\n"
561 "these questions. If you're adding a disk, you should NOT write\n"
562 "from this screen, you should do it from the label editor.\n\n"
563 "Are you absolutely sure you want to do this now?")) {
564 variable_set2(DISK_PARTITIONED, "yes", 0);
567 * Don't trash the MBR if the first (and therefore only) chunk
568 * is marked for a truly dedicated disk (i.e., the disklabel
569 * starts at sector 0), even in cases where the user has
570 * requested booteasy or a "standard" MBR -- both would be
571 * fatal in this case.
574 * Don't offer to update the MBR on this disk if the first
575 * "real" chunk looks like a FreeBSD "all disk" partition,
576 * or the disk is entirely FreeBSD.
579 if ((d->chunks->part->type != freebsd) ||
580 (d->chunks->part->offset > 1))
581 getBootMgr(d->name, &bootipl, &bootipl_size,
582 &bootmenu, &bootmenu_size);
589 Set_Boot_Mgr(d, bootipl, bootipl_size, bootmenu, bootmenu_size);
591 if ((d->chunks->part->type != freebsd) ||
592 (d->chunks->part->offset > 1))
593 getBootMgr(d->name, &mbrContents, &mbrSize);
598 Set_Boot_Mgr(d, mbrContents, mbrSize);
601 if (DITEM_STATUS(diskPartitionWrite(NULL)) != DITEM_SUCCESS)
602 msgConfirm("Disk partition write returned an error status!");
604 msgConfirm("Wrote FDISK partition information out successfully.");
610 if (!msgNoYes("Are you SURE you want to go into Wizard mode?\n"
611 "No seat belts whatsoever are provided!")) {
615 variable_set2(DISK_PARTITIONED, "yes", 0);
619 msg = "Wise choice!";
623 case '\033': /* ESC */
627 * Don't trash the MBR if the first (and therefore only) chunk
628 * is marked for a truly dedicated disk (i.e., the disklabel
629 * starts at sector 0), even in cases where the user has requested
630 * booteasy or a "standard" MBR -- both would be fatal in this case.
633 * Don't offer to update the MBR on this disk if the first "real"
634 * chunk looks like a FreeBSD "all disk" partition, or the disk is
637 if ((d->chunks->part->type != freebsd) ||
638 (d->chunks->part->offset > 1)) {
639 if (variable_cmp(DISK_PARTITIONED, "written")) {
641 getBootMgr(d->name, &bootipl, &bootipl_size,
642 &bootmenu, &bootmenu_size);
643 if (bootipl != NULL && bootmenu != NULL)
644 Set_Boot_Mgr(d, bootipl, bootipl_size,
645 bootmenu, bootmenu_size);
647 getBootMgr(d->name, &mbrContents, &mbrSize);
648 if (mbrContents != NULL)
649 Set_Boot_Mgr(d, mbrContents, mbrSize);
656 size_unit = (size_unit + 1) % UNIT_SIZE;
661 msg = "Type F1 or ? for help";
667 char buf[FILENAME_MAX];
669 use_helpline("Press F1 to read more about disk slices.");
670 use_helpfile(systemHelpFile("partition", buf));
671 if (!variable_get(VAR_NO_WARN))
672 dialog_mesgbox("Disk slicing warning:", p, -1, -1);
679 bootalloc(char *name, size_t *size)
681 char buf[FILENAME_MAX];
684 snprintf(buf, sizeof buf, "/boot/%s", name);
685 if (stat(buf, &sb) != -1) {
688 fd = open(buf, O_RDONLY);
692 cp = malloc(sb.st_size);
693 if (read(fd, cp, sb.st_size) != sb.st_size) {
696 msgDebug("bootalloc: couldn't read %ld bytes from %s\n", (long)sb.st_size, buf);
704 msgDebug("bootalloc: couldn't open %s\n", buf);
707 msgDebug("bootalloc: can't stat %s\n", buf);
712 partitionHook(dialogMenuItem *selected)
714 Device **devs = NULL;
716 devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK);
718 msgConfirm("Unable to find disk %s!", selected->prompt);
719 return DITEM_FAILURE;
721 /* Toggle enabled status? */
722 if (!devs[0]->enabled) {
723 devs[0]->enabled = TRUE;
724 diskPartition(devs[0]);
727 devs[0]->enabled = FALSE;
728 return DITEM_SUCCESS;
732 partitionCheck(dialogMenuItem *selected)
734 Device **devs = NULL;
736 devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK);
737 if (!devs || devs[0]->enabled == FALSE)
743 diskPartitionEditor(dialogMenuItem *self)
749 cnt = diskGetSelectCount(&devs);
750 devcnt = deviceCount(devs);
752 msgConfirm("No disks found! Please verify that your disk controller is being\n"
753 "properly probed at boot time. See the Hardware Guide on the\n"
754 "Documentation menu for clues on diagnosing this type of problem.");
755 return DITEM_FAILURE;
758 /* Some are already selected */
759 for (i = 0; i < devcnt; i++) {
760 if (devs[i]->enabled) {
761 if (variable_get(VAR_NONINTERACTIVE))
762 diskPartitionNonInteractive(devs[i]);
764 diskPartition(devs[i]);
769 /* No disks are selected, fall-back case now */
771 devs[0]->enabled = TRUE;
772 if (variable_get(VAR_NONINTERACTIVE))
773 diskPartitionNonInteractive(devs[0]);
775 diskPartition(devs[0]);
776 return DITEM_SUCCESS;
779 menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook, partitionCheck);
781 msgConfirm("No devices suitable for installation found!\n\n"
782 "Please verify that your disk controller (and attached drives)\n"
783 "were detected properly. This can be done by pressing the\n"
784 "[Scroll Lock] key and using the Arrow keys to move back to\n"
785 "the boot messages. Press [Scroll Lock] again to return.");
786 return DITEM_FAILURE;
789 i = dmenuOpenSimple(menu, FALSE) ? DITEM_SUCCESS : DITEM_FAILURE;
795 return DITEM_SUCCESS;
799 diskPartitionWrite(dialogMenuItem *self)
804 if (!variable_cmp(DISK_PARTITIONED, "written"))
805 return DITEM_SUCCESS;
807 devs = deviceFind(NULL, DEVICE_TYPE_DISK);
809 msgConfirm("Unable to find any disks to write to??");
810 return DITEM_FAILURE;
813 msgDebug("diskPartitionWrite: Examining %d devices\n", deviceCount(devs));
814 for (i = 0; devs[i]; i++) {
815 Disk *d = (Disk *)devs[i]->private;
816 static u_char *boot1;
818 static u_char *boot2;
821 if (!devs[i]->enabled)
825 if (!boot1) boot1 = bootalloc("boot1", NULL);
826 Set_Boot_Blocks(d, boot1, NULL);
828 if (!boot1) boot1 = bootalloc("boot1", NULL);
829 if (!boot2) boot2 = bootalloc("boot2", NULL);
830 Set_Boot_Blocks(d, boot1, boot2);
833 msgNotify("Writing partition information to drive %s", d->name);
834 if (!Fake && Write_Disk(d)) {
835 msgConfirm("ERROR: Unable to write data to disk %s!", d->name);
836 return DITEM_FAILURE;
839 /* Now it's not "yes", but "written" */
840 variable_set2(DISK_PARTITIONED, "written", 0);
841 return DITEM_SUCCESS | DITEM_RESTORE;
844 /* Partition a disk based wholly on which variables are set */
846 diskPartitionNonInteractive(Device *dev)
849 int i, sz, all_disk = 0;
854 size_t bootmenu_size;
859 Disk *d = (Disk *)dev->private;
862 cp = variable_get(VAR_GEOMETRY);
864 msgDebug("Setting geometry from script to: %s\n", cp);
865 d->bios_cyl = strtol(cp, &cp, 0);
866 d->bios_hd = strtol(cp + 1, &cp, 0);
867 d->bios_sect = strtol(cp + 1, 0, 0);
870 cp = variable_get(VAR_PARTITION);
872 if (!strcmp(cp, "free")) {
873 /* Do free disk space case */
874 for (i = 0; chunk_info[i]; i++) {
875 /* If a chunk is at least 10MB in size, use it. */
876 if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) {
878 Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size,
880 (chunk_info[i]->flags & CHUNK_ALIGN),
883 Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size,
885 (chunk_info[i]->flags & CHUNK_ALIGN));
887 variable_set2(DISK_PARTITIONED, "yes", 0);
891 if (!chunk_info[i]) {
892 msgConfirm("Unable to find any free space on this disk!");
896 else if (!strcmp(cp, "all")) {
897 /* Do all disk space case */
898 msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
900 All_FreeBSD(d, FALSE);
902 else if (!strcmp(cp, "exclusive")) {
903 /* Do really-all-the-disk-space case */
904 msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
906 All_FreeBSD(d, all_disk = TRUE);
908 else if ((sz = strtol(cp, &cp, 0))) {
909 /* Look for sz bytes free */
910 if (*cp && toupper(*cp) == 'M')
912 else if (*cp && toupper(*cp) == 'G')
914 for (i = 0; chunk_info[i]; i++) {
915 /* If a chunk is at least sz MB, use it. */
916 if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) {
918 Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3,
919 (chunk_info[i]->flags & CHUNK_ALIGN),
922 Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3,
923 (chunk_info[i]->flags & CHUNK_ALIGN));
925 variable_set2(DISK_PARTITIONED, "yes", 0);
929 if (!chunk_info[i]) {
930 msgConfirm("Unable to find %d free blocks on this disk!", sz);
934 else if (!strcmp(cp, "existing")) {
935 /* Do existing FreeBSD case */
936 for (i = 0; chunk_info[i]; i++) {
937 if (chunk_info[i]->type == freebsd)
940 if (!chunk_info[i]) {
941 msgConfirm("Unable to find any existing FreeBSD partitions on this disk!");
946 msgConfirm("`%s' is an invalid value for %s - is config file valid?", cp, VAR_PARTITION);
951 getBootMgr(d->name, &bootipl, &bootipl_size,
952 &bootmenu, &bootmenu_size);
953 Set_Boot_Mgr(d, bootipl, bootipl_size, bootmenu, bootmenu_size);
955 getBootMgr(d->name, &mbrContents, &mbrSize);
956 Set_Boot_Mgr(d, mbrContents, mbrSize);
959 variable_set2(DISK_PARTITIONED, "yes", 0);