Implement support for GRAID volumes in the installer partition editor,
rename a few options, clarify some help text, and add help text for the buttons on the main partition editor screen. Approved by: re (kib)
This commit is contained in:
parent
af6004651e
commit
bcc25b7ea2
@ -65,7 +65,12 @@ diskeditor_show(const char *title, const char *cprompt,
|
||||
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 @@ diskeditor_show(const char *title, const char *cprompt,
|
||||
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 @@ diskeditor_show(const char *title, const char *cprompt,
|
||||
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 @@ diskeditor_show(const char *title, const char *cprompt,
|
||||
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 @@ diskeditor_show(const char *title, const char *cprompt,
|
||||
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 @@ diskeditor_show(const char *title, const char *cprompt,
|
||||
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 @@ diskeditor_show(const char *title, const char *cprompt,
|
||||
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 @@ diskeditor_show(const char *title, const char *cprompt,
|
||||
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;
|
||||
|
@ -472,7 +472,7 @@ gpart_edit(struct gprovider *pp)
|
||||
|
||||
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 @@ gpart_create(struct gprovider *pp, char *default_type, char *default_size,
|
||||
}
|
||||
|
||||
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 @@ gpart_create(struct gprovider *pp, char *default_type, char *default_size,
|
||||
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;
|
||||
|
||||
|
@ -96,6 +96,7 @@ boot_disk(struct gmesh *mesh)
|
||||
|
||||
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 @@ provider_for_name(struct gmesh *mesh, const char *name)
|
||||
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;
|
||||
|
||||
|
@ -50,8 +50,24 @@ static void init_fstab_metadata(void);
|
||||
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 @@ main(int argc, const char **argv) {
|
||||
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 @@ main(int argc, const char **argv) {
|
||||
|
||||
error = 0;
|
||||
if (op == 5) { /* Finished */
|
||||
dialog_vars.extra_button = TRUE;
|
||||
dialog_vars.ok_label = __DECONST(char *, "Commit");
|
||||
dialog_vars.extra_label =
|
||||
__DECONST(char *, "Abort");
|
||||
dialog_vars.ok_label = __DECONST(char *, "Save");
|
||||
__DECONST(char *, "Revert & Exit");
|
||||
dialog_vars.extra_button = TRUE;
|
||||
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);
|
||||
dialog_vars.extra_button = FALSE;
|
||||
"ERASED. Are you sure you want to commit your "
|
||||
"changes?", 0, 0);
|
||||
dialog_vars.ok_label = NULL;
|
||||
dialog_vars.extra_button = FALSE;
|
||||
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 @@ get_part_metadata(const char *name, int create)
|
||||
}
|
||||
|
||||
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 @@ apply_changes(struct gmesh *mesh)
|
||||
}
|
||||
|
||||
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 @@ read_geom_mesh(struct gmesh *mesh, int *nitems) {
|
||||
|
||||
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 @@ read_geom_mesh(struct gmesh *mesh, int *nitems) {
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user