/* * state_create_subpartitions: let the user specify what subpartitions they * want on the disk, how large each should be, and where it should be mounted. */ void state_create_subpartitions(struct i_fn_args *a) { struct commands *cmds; if (measure_activated_swap_from_slice(a, storage_get_selected_disk(a->s), storage_get_selected_slice(a->s)) > 0) { if (swapoff_all(a) == NULL) { inform(a->c, _("Warning: swap could not be turned off.")); state = disk_get_formatted(storage_get_selected_disk(a->s)) ? state_select_disk : state_select_slice; return; } } cmds = commands_new(); /* * Auto-disklabel the slice. * NB: one cannot use "/dev/adXsY" here - * it must be in the form "adXsY". */ command_add(cmds, "%s%s -W %s", a->os_root, cmd_name(a, "DISKLABEL64"), slice_get_device_name(storage_get_selected_slice(a->s))); command_add(cmds, "%s%s if=/dev/zero of=/dev/%s bs=32k count=16", a->os_root, cmd_name(a, "DD"), slice_get_device_name(storage_get_selected_slice(a->s))); command_add(cmds, "%s%s -B -r -w %s auto", a->os_root, cmd_name(a, "DISKLABEL64"), slice_get_device_name(storage_get_selected_slice(a->s))); commands_execute(a, cmds); commands_free(cmds); if (use_hammer) fn_create_subpartitions_hammer(a); else fn_create_subpartitions_ufs(a); if (a->result) { state = state_install_os; } else { state = disk_get_formatted(storage_get_selected_disk(a->s)) ? state_select_disk : state_select_slice; } }
static struct dfui_form * make_create_subpartitions_form(struct i_fn_args *a) { struct dfui_form *f; char msg_buf[1][1024]; snprintf(msg_buf[0], sizeof(msg_buf[0]), _("Subpartitions further divide a primary partition for " "use with %s. Some reasons you may want " "a set of subpartitions are:\n\n" "- you want to restrict how much data can be written " "to certain parts of the primary partition, to quell " "denial-of-service attacks; and\n" "- you want to speed up access to data on the disk." ""), OPERATING_SYSTEM_NAME); f = dfui_form_create( "create_subpartitions", _("Create Subpartitions"), _("Set up the subpartitions (also known as just `partitions' " "in BSD tradition) you want to have on this primary " "partition. In most cases you should be fine with " "the default settings.\n\n" "For Capacity, use 'M' to indicate megabytes, 'G' to " "indicate gigabytes, and so on (up to 'E'.) A single '*' " "indicates 'use the remaining space on the primary partition'."), msg_buf[0], "p", "special", "dfinstaller_create_subpartitions", "p", "minimum_width","64", "f", "mountpoint", _("Mountpoint"), "", "", "f", "capacity", _("Capacity"), "", "", "f", "encrypted", _("Encrypted"), "", "", "p", "control", "checkbox", "a", "ok", _("Accept and Create"), "", "", "a", "cancel", (disk_get_formatted(storage_get_selected_disk(a->s)) ? _("Return to Select Disk") : _("Return to Select Primary Partition")), "", "", "p", "accelerator", "ESC", NULL ); dfui_form_set_multiple(f, 1); dfui_form_set_extensible(f, 1); /* * Remove ATM until HAMMER installer support is better * dfui_form_set_extensible(f, 1); */ #if 0 if (expert) { fi = dfui_form_field_add(f, "softupdates", dfui_info_new(_("Softupdates"), "", "")); dfui_field_property_set(fi, "control", "checkbox"); fi = dfui_form_field_add(f, "tmpfsbacked", dfui_info_new(_("TMPFS"), "", "")); dfui_field_property_set(fi, "control", "checkbox"); fi = dfui_form_field_add(f, "fsize", dfui_info_new(_("Frag Sz"), "", "")); fi = dfui_form_field_add(f, "bsize", dfui_info_new(_("Block Sz"), "", "")); dfui_form_action_add(f, "switch", dfui_info_new(_("Switch to Normal Mode"), "", "")); } else { dfui_form_action_add(f, "switch", dfui_info_new(_("Switch to Expert Mode"), "", "")); } #endif return(f); }