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 / (1024/512) / 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 / (1024/512);
138 sz = chunk_info[i]->size / (1024/512) / 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 !variable_get(VAR_DISKINTERACTIVE))
763 diskPartitionNonInteractive(devs[i]);
765 diskPartition(devs[i]);
770 /* No disks are selected, fall-back case now */
772 devs[0]->enabled = TRUE;
773 if (variable_get(VAR_NONINTERACTIVE) &&
774 !variable_get(VAR_DISKINTERACTIVE))
775 diskPartitionNonInteractive(devs[0]);
777 diskPartition(devs[0]);
778 return DITEM_SUCCESS;
781 menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook, partitionCheck);
783 msgConfirm("No devices suitable for installation found!\n\n"
784 "Please verify that your disk controller (and attached drives)\n"
785 "were detected properly. This can be done by pressing the\n"
786 "[Scroll Lock] key and using the Arrow keys to move back to\n"
787 "the boot messages. Press [Scroll Lock] again to return.");
788 return DITEM_FAILURE;
791 i = dmenuOpenSimple(menu, FALSE) ? DITEM_SUCCESS : DITEM_FAILURE;
797 return DITEM_SUCCESS;
801 diskPartitionWrite(dialogMenuItem *self)
806 if (!variable_cmp(DISK_PARTITIONED, "written"))
807 return DITEM_SUCCESS;
809 devs = deviceFind(NULL, DEVICE_TYPE_DISK);
811 msgConfirm("Unable to find any disks to write to??");
812 return DITEM_FAILURE;
815 msgDebug("diskPartitionWrite: Examining %d devices\n", deviceCount(devs));
816 for (i = 0; devs[i]; i++) {
817 Disk *d = (Disk *)devs[i]->private;
818 static u_char *boot1;
820 static u_char *boot2;
823 if (!devs[i]->enabled)
827 if (!boot1) boot1 = bootalloc("boot1", NULL);
828 Set_Boot_Blocks(d, boot1, NULL);
830 if (!boot1) boot1 = bootalloc("boot1", NULL);
831 if (!boot2) boot2 = bootalloc("boot2", NULL);
832 Set_Boot_Blocks(d, boot1, boot2);
835 msgNotify("Writing partition information to drive %s", d->name);
836 if (!Fake && Write_Disk(d)) {
837 msgConfirm("ERROR: Unable to write data to disk %s!", d->name);
838 return DITEM_FAILURE;
841 /* Now it's not "yes", but "written" */
842 variable_set2(DISK_PARTITIONED, "written", 0);
843 return DITEM_SUCCESS | DITEM_RESTORE;
846 /* Partition a disk based wholly on which variables are set */
848 diskPartitionNonInteractive(Device *dev)
851 int i, sz, all_disk = 0;
856 size_t bootmenu_size;
861 Disk *d = (Disk *)dev->private;
864 cp = variable_get(VAR_GEOMETRY);
866 msgDebug("Setting geometry from script to: %s\n", cp);
867 d->bios_cyl = strtol(cp, &cp, 0);
868 d->bios_hd = strtol(cp + 1, &cp, 0);
869 d->bios_sect = strtol(cp + 1, 0, 0);
872 cp = variable_get(VAR_PARTITION);
874 if (!strcmp(cp, "free")) {
875 /* Do free disk space case */
876 for (i = 0; chunk_info[i]; i++) {
877 /* If a chunk is at least 10MB in size, use it. */
878 if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) {
880 Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size,
882 (chunk_info[i]->flags & CHUNK_ALIGN),
885 Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size,
887 (chunk_info[i]->flags & CHUNK_ALIGN));
889 variable_set2(DISK_PARTITIONED, "yes", 0);
893 if (!chunk_info[i]) {
894 msgConfirm("Unable to find any free space on this disk!");
898 else if (!strcmp(cp, "all")) {
899 /* Do all disk space case */
900 msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
902 All_FreeBSD(d, FALSE);
904 else if (!strcmp(cp, "exclusive")) {
905 /* Do really-all-the-disk-space case */
906 msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
908 All_FreeBSD(d, all_disk = TRUE);
910 else if ((sz = strtol(cp, &cp, 0))) {
911 /* Look for sz bytes free */
912 if (*cp && toupper(*cp) == 'M')
914 else if (*cp && toupper(*cp) == 'G')
916 for (i = 0; chunk_info[i]; i++) {
917 /* If a chunk is at least sz MB, use it. */
918 if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) {
920 Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3,
921 (chunk_info[i]->flags & CHUNK_ALIGN),
924 Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3,
925 (chunk_info[i]->flags & CHUNK_ALIGN));
927 variable_set2(DISK_PARTITIONED, "yes", 0);
931 if (!chunk_info[i]) {
932 msgConfirm("Unable to find %d free blocks on this disk!", sz);
936 else if (!strcmp(cp, "existing")) {
937 /* Do existing FreeBSD case */
938 for (i = 0; chunk_info[i]; i++) {
939 if (chunk_info[i]->type == freebsd)
942 if (!chunk_info[i]) {
943 msgConfirm("Unable to find any existing FreeBSD partitions on this disk!");
948 msgConfirm("`%s' is an invalid value for %s - is config file valid?", cp, VAR_PARTITION);
953 getBootMgr(d->name, &bootipl, &bootipl_size,
954 &bootmenu, &bootmenu_size);
955 Set_Boot_Mgr(d, bootipl, bootipl_size, bootmenu, bootmenu_size);
957 getBootMgr(d->name, &mbrContents, &mbrSize);
958 Set_Boot_Mgr(d, mbrContents, mbrSize);
961 variable_set2(DISK_PARTITIONED, "yes", 0);