diff --git a/usr.sbin/installer/dfuibe_installer/flow.c b/usr.sbin/installer/dfuibe_installer/flow.c index cf175ec..842574d 100644 --- a/usr.sbin/installer/dfuibe_installer/flow.c +++ b/usr.sbin/installer/dfuibe_installer/flow.c @@ -73,6 +73,10 @@ extern int _nl_msg_cat_cntr; #include "fn.h" #include "pathnames.h" +/*** PROTOTYPES ***/ +long default_capacity(struct storage *, const char *); +int create_subpartitions(struct i_fn_args *); + /*** GLOBALS ***/ void (*state)(struct i_fn_args *) = NULL; @@ -232,6 +236,13 @@ state_welcome(struct i_fn_args *a) msg_buf[1], "")); } + snprintf(msg_buf[0], sizeof(msg_buf[0]), + _("Express %s installation using all default values"), + OPERATING_SYSTEM_NAME); + dfui_form_action_add(f, "express", + dfui_info_new(_("Express install"), + msg_buf[0], "")); + snprintf(msg_buf[0], sizeof(msg_buf[0]), _("Configure a %s system once it has been installed on HDD"), OPERATING_SYSTEM_NAME); @@ -260,6 +271,9 @@ state_welcome(struct i_fn_args *a) if (strcmp(dfui_response_get_action_id(r), "install") == 0) { state = state_begin_install; + } else if (strcmp(dfui_response_get_action_id(r), "express") == 0) { + express_install = 1; + state = state_begin_express; } else if (strcmp(dfui_response_get_action_id(r), "upgrade") == 0) { state = state_begin_upgrade; } else if (strcmp(dfui_response_get_action_id(r), "configure") == 0) { @@ -852,6 +866,115 @@ state_begin_upgrade(struct i_fn_args *a) } /* + * state_begin_express: Only basic questioning and then + * proceed with default settings. + */ +void +state_begin_express(struct i_fn_args *a) +{ + struct dfui_form *f; + struct dfui_response *r; + char msg_buf[3][1024]; + + snprintf(msg_buf[0], sizeof(msg_buf[0]), + _("EXPRESS INSTALLATION. This application will install %s" + " on one of the hard disk drives attached to this computer. " + "It will take as very few questions as it is possible by using " + "default values. Please note that the WHOLE disk of your choice " + "will be used for the installation." + "\n\n" + "NOTE! As with any installation process, YOU ARE " + "STRONGLY ENCOURAGED TO BACK UP ANY IMPORTANT DATA ON THIS " + "COMPUTER BEFORE PROCEEDING!" + ""), + OPERATING_SYSTEM_NAME); + + snprintf(msg_buf[1], sizeof(msg_buf[1]), + _("Some situations in which you might not wish to use this " + "installer are:\n\n" + "- you want to install %s onto a " + "logical/extended partition;\n" + "- you want to install %s " + "onto a ``dangerously dedicated'' disk; or\n" + "- you want full and utter control over the install process." + ""), + OPERATING_SYSTEM_NAME, OPERATING_SYSTEM_NAME); + + snprintf(msg_buf[2], sizeof(msg_buf[2]), + _("Express %s Install"), OPERATING_SYSTEM_NAME); + + f = dfui_form_create( + "begin_express", + _("Begin Express Installation"), + msg_buf[0], + + msg_buf[1], + "p", "special", "dfinstaller_begin_express", + "p", "minimum_width", "76", + + "a", "proceed", msg_buf[2], + "", "", + "a", "cancel", _("Return to Welcome Menu"), + "", "", + "p", "accelerator", "ESC", + "a", "livecd", _("Exit to Live CD"), + "", "", + NULL + ); + + if (!dfui_be_present(a->c, f, &r)) + abort_backend(); + + if (strcmp(dfui_response_get_action_id(r), "proceed") == 0) { + if (!survey_storage(a)) { + inform(a->c, _("Errors occurred while probing " + "the system for its storage capabilities.")); + } + state = state_select_disk; + } else if (strcmp(dfui_response_get_action_id(r), "livecd") == 0) { + state = NULL; + } else if (strcmp(dfui_response_get_action_id(r), "cancel") == 0) { + state = state_welcome; + } + + /* Proceed with the installation */ + dfui_form_free(f); + dfui_response_free(r); +} + +/* + * state_continue_express: Continue with the express + * installation + */ +void +state_continue_express(struct i_fn_args *a) +{ + const char *mtpt[] = { "/boot", "swap", "/", NULL }; + long capacity; + int i; + + /* Use HAMMER filesystem for express installations */ + use_hammer = 1; + + fn_format_disk(a); + + /* + * Default sizes for /boot, swap and / with fstype + * HAMMER by default. + */ + for (i = 0; mtpt[i] != NULL; i++) { + capacity = default_capacity(a->s, mtpt[i]); + subpartition_new_hammer(storage_get_selected_slice(a->s), + mtpt[i], capacity, 0); + } + create_subpartitions(a); + + fn_install_os(a); + if (a->result) + state = state_install_bootstrap; +} + +/* * state_begin_install: Briefly describe the install process * to the user, and let them proceed (or not.) */ @@ -975,7 +1098,10 @@ state_select_disk(struct i_fn_args *a) "install %s."), DISK_MIN, OPERATING_SYSTEM_NAME); } #endif - state = state_format_disk; + if (!express_install) + state = state_format_disk; + else + state = state_continue_express; } } diff --git a/usr.sbin/installer/dfuibe_installer/flow.h b/usr.sbin/installer/dfuibe_installer/flow.h index 6f757b2..e4a152f 100644 --- a/usr.sbin/installer/dfuibe_installer/flow.h +++ b/usr.sbin/installer/dfuibe_installer/flow.h @@ -56,6 +56,7 @@ struct i_fn_args; int use_hammer; +int express_install; int during_install; /*** PROTOTYPES ***/ @@ -76,11 +77,13 @@ void state_diskutil_menu(struct i_fn_args *); /* Install */ void state_begin_install(struct i_fn_args *); +void state_begin_express(struct i_fn_args *); void state_begin_upgrade(struct i_fn_args *); void state_select_disk(struct i_fn_args *); void state_ask_fs(struct i_fn_args *); void state_format_disk(struct i_fn_args *); void state_select_slice(struct i_fn_args *); +void state_continue_express(struct i_fn_args *); void state_create_subpartitions(struct i_fn_args *); void state_install_os(struct i_fn_args *); void state_install_bootstrap(struct i_fn_args *); diff --git a/usr.sbin/installer/dfuibe_installer/fn_subpart_hammer.c b/usr.sbin/installer/dfuibe_installer/fn_subpart_hammer.c index 5ddba3d..d68215e 100644 --- a/usr.sbin/installer/dfuibe_installer/fn_subpart_hammer.c +++ b/usr.sbin/installer/dfuibe_installer/fn_subpart_hammer.c @@ -65,8 +65,8 @@ #include "flow.h" #include "pathnames.h" -static int create_subpartitions(struct i_fn_args *); -static long default_capacity(struct storage *, const char *); +int create_subpartitions(struct i_fn_args *); +long default_capacity(struct storage *, const char *); static int check_capacity(struct i_fn_args *); static int check_subpartition_selections(struct dfui_response *, struct i_fn_args *); static void save_subpartition_selections(struct dfui_response *, struct i_fn_args *); @@ -83,7 +83,7 @@ static int expert = 0; * Given a set of subpartitions-to-be in the selected slice, * create them. */ -static int +int create_subpartitions(struct i_fn_args *a) { struct subpartition *sp; @@ -250,7 +250,7 @@ create_subpartitions(struct i_fn_args *a) return(result); } -static long +long default_capacity(struct storage *s, const char *mtpt) { unsigned long boot, root, swap;