Index: usr.sbin/bsdinstall/partedit/gpart_ops.c =================================================================== --- usr.sbin/bsdinstall/partedit/gpart_ops.c (revision 224842) +++ usr.sbin/bsdinstall/partedit/gpart_ops.c (working copy) @@ -472,7 +472,7 @@ if (geom == NULL) { /* Disk not partitioned, so partition it */ - gpart_partition(pp->lg_geom->lg_name, NULL); + gpart_partition(pp->lg_name, NULL); return; } @@ -791,7 +791,7 @@ } if (geom == NULL || scheme == NULL || strcmp(scheme, "(none)") == 0) { - if (gpart_partition(pp->lg_geom->lg_name, NULL) == 0) + if (gpart_partition(pp->lg_name, NULL) == 0) dialog_msgbox("", "The partition table has been successfully created." " Please press Create again to create partitions.", @@ -820,8 +820,10 @@ items[1].text = sizestr; /* Special-case the MBR default type for nested partitions */ - if (strcmp(scheme, "MBR") == 0 || strcmp(scheme, "PC98") == 0) + if (strcmp(scheme, "MBR") == 0 || strcmp(scheme, "PC98") == 0) { items[0].text = "freebsd"; + items[0].help = "Filesystem type (e.g. freebsd, fat32)"; + } nitems = scheme_supports_labels(scheme) ? 4 : 3; Index: usr.sbin/bsdinstall/partedit/diskeditor.c =================================================================== --- usr.sbin/bsdinstall/partedit/diskeditor.c (revision 224842) +++ usr.sbin/bsdinstall/partedit/diskeditor.c (working copy) @@ -65,7 +65,12 @@ WINDOW *dialog, *partitions; char *prompt; const char *buttons[] = - { "Create", "Delete", "Modify", "Revert", "Auto", "Exit", NULL }; + { "Create", "Delete", "Modify", "Revert", "Auto", "Finish", NULL }; + const char *help_text[] = { + "Add a new partition", "Delete selected partition or partitions", + "Change partition type or mountpoint", + "Revert changes to disk setup", "Use guided partitioning tool", + "Exit partitioner (will ask whether to save changes)", NULL }; int x, y; int i; int height, width, min_width; @@ -125,6 +130,7 @@ dlg_register_buttons(partitions, "partlist", buttons); wattrset(partitions, menubox_attr); + dlg_item_help(help_text[cur_button]); dlg_draw_buttons(dialog, height - 2*MARGIN, 0, buttons, cur_button, FALSE, width); dlg_print_autowrap(dialog, prompt, height, width); @@ -154,6 +160,7 @@ key = dlg_mouse_wgetch(dialog, &fkey); if ((i = dlg_char_to_button(key, buttons)) >= 0) { cur_button = i; + dlg_item_help(help_text[cur_button]); dlg_draw_buttons(dialog, height - 2*MARGIN, 0, buttons, cur_button, FALSE, width); break; @@ -167,6 +174,7 @@ cur_button = dlg_next_button(buttons, cur_button); if (cur_button < 0) cur_button = 0; + dlg_item_help(help_text[cur_button]); dlg_draw_buttons(dialog, height - 2*MARGIN, 0, buttons, cur_button, FALSE, width); break; @@ -174,6 +182,7 @@ cur_button = dlg_prev_button(buttons, cur_button); if (cur_button < 0) cur_button = 0; + dlg_item_help(help_text[cur_button]); dlg_draw_buttons(dialog, height - 2*MARGIN, 0, buttons, cur_button, FALSE, width); break; @@ -215,6 +224,8 @@ cur_scroll += (partlist_height - 2); if (cur_scroll + partlist_height - 2 >= nitems) cur_scroll = nitems - (partlist_height - 2); + if (cur_scroll < 0) + cur_scroll = 0; if (cur_part < cur_scroll) cur_part = cur_scroll; goto repaint; @@ -231,6 +242,8 @@ goto repaint; case DLGK_PAGE_LAST: cur_scroll = nitems - (partlist_height - 2); + if (cur_scroll < 0) + cur_scroll = 0; cur_part = cur_scroll; goto repaint; case DLGK_ENTER: @@ -238,6 +251,7 @@ default: if (is_DLGK_MOUSE(key)) { cur_button = key - M_EVENT; + dlg_item_help(help_text[cur_button]); dlg_draw_buttons(dialog, height - 2*MARGIN, 0, buttons, cur_button, FALSE, width); goto done; Index: usr.sbin/bsdinstall/partedit/part_wizard.c =================================================================== --- usr.sbin/bsdinstall/partedit/part_wizard.c (revision 224842) +++ usr.sbin/bsdinstall/partedit/part_wizard.c (working copy) @@ -96,6 +96,7 @@ LIST_FOREACH(classp, &mesh->lg_class, lg_class) { if (strcmp(classp->lg_name, "DISK") != 0 && + strcmp(classp->lg_name, "RAID") != 0 && strcmp(classp->lg_name, "MD") != 0) continue; @@ -169,6 +170,7 @@ LIST_FOREACH(classp, &mesh->lg_class, lg_class) { if (strcmp(classp->lg_name, "DISK") != 0 && strcmp(classp->lg_name, "PART") != 0 && + strcmp(classp->lg_name, "RAID") != 0 && strcmp(classp->lg_name, "MD") != 0) continue; Index: usr.sbin/bsdinstall/partedit/partedit.c =================================================================== --- usr.sbin/bsdinstall/partedit/partedit.c (revision 224842) +++ usr.sbin/bsdinstall/partedit/partedit.c (working copy) @@ -50,8 +50,24 @@ static void get_mount_points(struct partedit_item *items, int nitems); static int validate_setup(void); +static void +sigint_handler(int sig) +{ + struct gmesh mesh; + + /* Revert all changes and exit dialog-mode cleanly on SIGINT */ + geom_gettree(&mesh); + gpart_revert_all(&mesh); + geom_deletetree(&mesh); + + end_dialog(); + + exit(1); +} + int -main(int argc, const char **argv) { +main(int argc, const char **argv) +{ struct partition_metadata *md; const char *prompt; struct partedit_item *items; @@ -69,13 +85,16 @@ dialog_vars.item_help = TRUE; nscroll = i = 0; + /* Revert changes on SIGINT */ + signal(SIGINT, sigint_handler); + if (strcmp(basename(argv[0]), "autopart") == 0) { /* Guided */ prompt = "Please review the disk setup. When complete, press " - "the Exit button."; + "the Finish button."; part_wizard(); } else { prompt = "Create partitions for FreeBSD. No changes will be " - "made until you select Exit."; + "made until you select Finish."; } /* Show the part editor either immediately, or to confirm wizard */ @@ -129,21 +148,24 @@ error = 0; if (op == 5) { /* Finished */ + dialog_vars.ok_label = __DECONST(char *, "Commit"); + dialog_vars.extra_label = + __DECONST(char *, "Revert & Exit"); dialog_vars.extra_button = TRUE; - dialog_vars.extra_label = - __DECONST(char *, "Abort"); - dialog_vars.ok_label = __DECONST(char *, "Save"); + dialog_vars.cancel_label = __DECONST(char *, "Back"); op = dialog_yesno("Confirmation", "Your changes will " "now be written to disk. If you have chosen to " "overwrite existing data, it will be PERMANENTLY " - "ERASED. Are you sure you want to proceed?", 0, 0); + "ERASED. Are you sure you want to commit your " + "changes?", 0, 0); + dialog_vars.ok_label = NULL; dialog_vars.extra_button = FALSE; - dialog_vars.ok_label = NULL; + dialog_vars.cancel_label = NULL; if (op == 0 && validate_setup()) { /* Save */ error = apply_changes(&mesh); break; - } else if (op == 3) { /* Don't save => Quit */ + } else if (op == 3) { /* Quit */ gpart_revert_all(&mesh); error = -1; break; @@ -181,7 +203,8 @@ } void -delete_part_metadata(const char *name) { +delete_part_metadata(const char *name) +{ struct partition_metadata *md; TAILQ_FOREACH(md, &part_metadata, metadata) { @@ -316,7 +339,8 @@ } static struct partedit_item * -read_geom_mesh(struct gmesh *mesh, int *nitems) { +read_geom_mesh(struct gmesh *mesh, int *nitems) +{ struct gclass *classp; struct ggeom *gp; struct partedit_item *items; @@ -330,7 +354,7 @@ LIST_FOREACH(classp, &mesh->lg_class, lg_class) { if (strcmp(classp->lg_name, "DISK") != 0 && - strcmp(classp->lg_name, "MD") != 0) + strcmp(classp->lg_name, "MD") != 0) continue; /* Now recurse into all children */ @@ -343,7 +367,8 @@ static void add_geom_children(struct ggeom *gp, int recurse, struct partedit_item **items, - int *nitems) { + int *nitems) +{ struct gconsumer *cp; struct gprovider *pp; struct gconfig *gc;