void state_utilities_menu(struct i_fn_args *a) { struct dfui_form *f; struct dfui_response *r; if (!survey_storage(a)) { inform(a->c, _("Errors occurred while probing " "the system for its storage capabilities.")); } f = dfui_form_create( "utilities_menu", _("Live CD Utilities Menu"), _("On these submenus you will find utilities to help " "you set up your Live CD environment, diagnose " "and analyse this system, and work with " "the devices attached to this computer."), "", "p", "role", "menu", "a", "environment", _("LiveCD Environment"), _("Configure the LiveCD Environment"), "", "a", "diagnostics", _("System Diagnostics"), _("Probe and display detailed information about this system"), "", "a", "diskutil", _("Disk Utilities"), _("Format and check hard drives and floppy disks"), "", "a", "livecd", _("Exit to Live CD"), _("Exit this program to a login prompt with access to the LiveCD"), "", "a", "reboot", _("Reboot this Computer"), "", "", "a", "cancel", _("Return to Welcome Menu"), "", "", "p", "accelerator", "ESC", NULL ); if (!dfui_be_present(a->c, f, &r)) abort_backend(); if (strcmp(dfui_response_get_action_id(r), "environment") == 0) state = state_environment_menu; else if (strcmp(dfui_response_get_action_id(r), "diagnostics") == 0) state = state_diagnostics_menu; else if (strcmp(dfui_response_get_action_id(r), "diskutil") == 0) state = state_diskutil_menu; else if (strcmp(dfui_response_get_action_id(r), "livecd") == 0) state = NULL; else if (strcmp(dfui_response_get_action_id(r), "reboot") == 0) state = state_reboot; else if (strcmp(dfui_response_get_action_id(r), "cancel") == 0) state = state_welcome; dfui_form_free(f); dfui_response_free(r); }
/* * state_begin_upgrade: Ask the user where the freebsd * 4.X install is and make sure its safe to proceed. * */ void state_begin_upgrade(struct i_fn_args *a) { //struct dfui_form *f = NULL; //struct dfui_response *r = NULL; //int done = 0; if (storage_get_selected_disk(a->s) == NULL || storage_get_selected_slice(a->s) == NULL) { if (!survey_storage(a)) { inform(a->c, _("Errors occurred while probing " "the system for its storage capabilities.")); } a->short_desc = _("Select the disk containing the installation that you would like to upgrade."); a->cancel_desc = _("Return to Welcome Menu"); fn_select_disk(a); if (!a->result || storage_get_selected_disk(a->s) == NULL) { state = state_welcome; return; } a->short_desc = _("Select the primary partition containing the installation you would like to upgrade."); a->cancel_desc = _("Return to Welcome Menu"); fn_select_slice(a); if (!a->result || storage_get_selected_slice(a->s) == NULL) { state = state_welcome; return; } } a->cfg_root = "mnt"; if (!mount_target_system(a)) { inform(a->c, _("Target system could not be mounted.")); state = state_welcome; return; } }
/* * state_begin_install: Briefly describe the install process * to the user, and let them proceed (or not.) */ void state_begin_install(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]), _("This experimental application will install %s" " on one of the hard disk drives attached to this computer. " "It has been designed to make it easy to install " "%s in the typical case. " "If you have special requirements that are not addressed " "by this installer, or if you have problems using it, you " "are welcome to install %s manually. " "To do so select Exit to Live CD, login as root, and follow " "the instructions given in the file /README ." "\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, OPERATING_SYSTEM_NAME, 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]), _("Install %s"), OPERATING_SYSTEM_NAME); f = dfui_form_create( "begin_install", _("Begin Installation"), msg_buf[0], msg_buf[1], "p", "special", "dfinstaller_begin_install", "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; } dfui_form_free(f); dfui_response_free(r); }
void state_configure_menu(struct i_fn_args *a) { struct dfui_form *f = NULL; struct dfui_response *r = NULL; struct commands *cmds; int done = 0; char msg_buf[2][1024]; if (storage_get_selected_disk(a->s) == NULL || storage_get_selected_slice(a->s) == NULL) { if (!survey_storage(a)) { inform(a->c, _("Errors occurred while probing " "the system for its storage capabilities.")); } a->short_desc = _("Select the disk containing the installation."); a->cancel_desc = _("Return to Welcome Menu"); fn_select_disk(a); if (!a->result || storage_get_selected_disk(a->s) == NULL) { state = state_welcome; return; } a->short_desc = _("Select the primary partition containing the installation."); a->cancel_desc = _("Return to Welcome Menu"); fn_select_slice(a); if (!a->result || storage_get_selected_slice(a->s) == NULL) { state = state_welcome; return; } } a->cfg_root = "mnt"; if (during_install == 0) { switch (dfui_be_present_dialog(a->c, _("Select file system"), _("HAMMER|UFS|Return to Welcome Menu"), _("Please select the file system installed on the disk.\n\n"))) { case 1: /* HAMMER */ use_hammer = 1; break; case 2: /* UFS */ use_hammer = 0; break; case 3: state = state_welcome; return; /* NOTREACHED */ break; default: abort_backend(); break; } } if (!mount_target_system(a)) { inform(a->c, _("Target system could not be mounted.")); state = state_welcome; return; } snprintf(msg_buf[0], sizeof(msg_buf[0]), _("The options on this menu allow you to configure a " "%s system after it has already been " "installed."), OPERATING_SYSTEM_NAME); while (!done) { f = dfui_form_create( "configure_menu", _("Configure an Installed System"), msg_buf[0], "", "p", "role", "menu", "a", "set_timezone", _("Select timezone"), _("Set the Time Zone of your physical location"), "", "a", "set_datetime", _("Set date and time"), _("Set the Time and Date of your machine"), "", "a", "set_kbdmap", _("Set keyboard map"), _("Set what kind of keyboard layout you have"), "", "a", "root_passwd", _("Set root password"), _("Set the password that the root (superuser) account will use"), "", "a", "add_user", _("Add a user"), _("Add a user to the system"), "", "a", "assign_ip", _("Configure network interfaces"), _("Set up network interfaces (NICs, ethernet, TCP/IP, etc)"), "", "a", "assign_hostname_domain", _("Configure hostname and domain"), _("Configure the hostname and domain for this system"), "", /* "a", "select_services", "Select Services", "Enable/Disable system services (servers, daemons, etc.)", "", */ "a", "set_vidfont", _("Set console font"), _("Set how the characters on your video console look"), "", "a", "set_scrnmap", _("Set screen map"), _("Set how characters are translated before console display"), "", /* "a", "install_pkgs", _("Install extra software packages"), _("Install third-party software packages from the LiveCD"), "", */ "a", "remove_pkgs", _("Remove software packages"), _("Remove third-party software packages from the installed system"), "", "a", "cancel", _("Return to Welcome Menu"), "", "", "p", "accelerator", "ESC", NULL ); if (!dfui_be_present(a->c, f, &r)) abort_backend(); /* XXX set up a */ a->cfg_root = "mnt/"; if (strcmp(dfui_response_get_action_id(r), "root_passwd") == 0) { fn_root_passwd(a); } else if (strcmp(dfui_response_get_action_id(r), "add_user") == 0) { fn_add_user(a); } else if (strcmp(dfui_response_get_action_id(r), "install_pkgs") == 0) { fn_install_packages(a); } else if (strcmp(dfui_response_get_action_id(r), "remove_pkgs") == 0) { fn_remove_packages(a); } else if (strcmp(dfui_response_get_action_id(r), "assign_ip") == 0) { fn_assign_ip(a); } else if (strcmp(dfui_response_get_action_id(r), "assign_hostname_domain") == 0) { fn_assign_hostname_domain(a); } else if (strcmp(dfui_response_get_action_id(r), "select_services") == 0) { fn_select_services(a); } else if (strcmp(dfui_response_get_action_id(r), "set_kbdmap") == 0) { fn_set_kbdmap(a); } else if (strcmp(dfui_response_get_action_id(r), "set_vidfont") == 0) { fn_set_vidfont(a); } else if (strcmp(dfui_response_get_action_id(r), "set_scrnmap") == 0) { fn_set_scrnmap(a); } else if (strcmp(dfui_response_get_action_id(r), "set_timezone") == 0) { fn_set_timezone(a); } else if (strcmp(dfui_response_get_action_id(r), "set_datetime") == 0) { fn_assign_datetime(a); } else if (strcmp(dfui_response_get_action_id(r), "cancel") == 0) { state = state_welcome; done = 1; } dfui_form_free(f); dfui_response_free(r); } /* * Before unmounting the system, write out any changes to rc.conf. */ config_vars_write(rc_conf, CONFIG_TYPE_SH, "%s%setc/rc.conf", a->os_root, a->cfg_root); /* * Clear out configuration variable table in memory. */ config_vars_free(rc_conf); rc_conf = config_vars_new(); /* * Finally, unmount the system we mounted on /mnt and remove mappings. */ cmds = commands_new(); unmount_all_under(a, cmds, "%smnt", a->os_root); commands_execute(a, cmds); commands_free(cmds); if (remove_all_mappings(a) == NULL) inform(a->c, _("Warning: mappings could not be removed.")); }
/* * If ss->selected_disk == NULL, user will be asked for which disk. * Returns 1 if disk was formatted, 0 if it wasn't. * If it was, ss->selected_disk and ss->selected_slice are set to it. */ void fn_format_disk(struct i_fn_args *a) { struct commands *cmds; char *selected_disk_string; if (storage_get_selected_disk(a->s) == NULL) { a->short_desc = _("Select a disk to format."); a->cancel_desc = _("Return to Utilities Menu"); fn_select_disk(a); if (!a->result || storage_get_selected_disk(a->s) == NULL) { a->result = 0; return; } } if (confirm_dangerous_action(a->c, _("WARNING! ALL data in ALL partitions on the disk\n\n" "%s\n\nwill be IRREVOCABLY ERASED!\n\nAre you ABSOLUTELY " "SURE you wish to take this action? This is your " "LAST CHANCE to cancel!"), disk_get_desc(storage_get_selected_disk(a->s)))) { cmds = commands_new(); command_add(cmds, "%s%s -BI %s", a->os_root, cmd_name(a, "FDISK"), disk_get_device_name(storage_get_selected_disk(a->s))); if (!commands_execute(a, cmds)) { inform(a->c, _("The disk\n\n%s\n\nwas " "not correctly formatted, and may " "now be in an inconsistent state. " "We recommend re-formatting it " "before attempting to install " "%s on it."), disk_get_desc(storage_get_selected_disk(a->s)), OPERATING_SYSTEM_NAME); commands_free(cmds); a->result = 0; return; } commands_free(cmds); /* * Since one of the disks has now changed, we must * refresh our view of them and re-select the disk * since the selected_disk pointer will be invalidated. */ selected_disk_string = aura_strdup( disk_get_device_name(storage_get_selected_disk(a->s))); if (!survey_storage(a)) { inform(a->c, _("Errors occurred while probing " "the system for its storage capabilities.")); } storage_set_selected_disk(a->s, disk_find(a->s, selected_disk_string)); free(selected_disk_string); /* * Note that we formatted this disk and that we want * to use the first (and only) slice of it. */ disk_set_formatted(storage_get_selected_disk(a->s), 1); storage_set_selected_slice(a->s, disk_slice_first(storage_get_selected_disk(a->s))); if (!format_slice(a)) { inform(a->c, _("The sole primary partition of " "the disk\n\n%s\n\nwas " "not correctly formatted, and may " "now be in an inconsistent state. " "We recommend re-formatting the " "disk before attempting to install " "%s on it."), disk_get_desc(storage_get_selected_disk(a->s)), OPERATING_SYSTEM_NAME); a->result = 0; return; } inform(a->c, _("The disk\n\n%s\n\nwas formatted."), disk_get_desc(storage_get_selected_disk(a->s))); a->result = 1; } else { inform(a->c, _("Action cancelled - no disks were formatted.")); a->result = 0; } }