Example #1
0
/*
 * Wipes the start of the selected slice.
 */
void
fn_wipe_start_of_slice(struct i_fn_args *a)
{
	struct commands *cmds;

	a->short_desc =
	  _("If you are having problems formatting a primary partition, "
	    "it may be because of junk that has accumulated in the "
	    "partition's `disklabel'. A cure for this is to wipe out "
	    "everything on the first few sectors of the primary partition. "
	    "However, this is a rather drastic action to take, so it is not "
	    "recommended unless you are otherwise encountering problems.");
	a->cancel_desc = _("Return to Utilities Menu");
	fn_select_slice(a);
	if (!a->result)
		return;

	if (confirm_dangerous_action(a->c,
	    _("WARNING!  ALL data in primary partition #%d,\n\n%s\n\non the "
	    "disk\n\n%s\n\n will be IRREVOCABLY ERASED!\n\nAre you "
	    "ABSOLUTELY SURE you wish to take this action?  This is "
	    "your LAST CHANCE to cancel!"),
	    slice_get_number(storage_get_selected_slice(a->s)),
	    slice_get_desc(storage_get_selected_slice(a->s)),
	    disk_get_desc(storage_get_selected_disk(a->s)))) {
		/* XXX check to make sure this slice is not mounted first */
		cmds = commands_new();
		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)));
		if (commands_execute(a, cmds)) {
			inform(a->c, _("Start of primary partition was successfully wiped."));
		} else {
			inform(a->c, _("Some errors occurred. "
			    "Start of primary partition was not successfully wiped."));
		}
		commands_free(cmds);
	}
}
Example #2
0
/*
 * 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;
        }
}
Example #3
0
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."));
}
Example #4
0
/*
 * state_select_slice: ask the user which slice they wish to install
 * DragonFly on.  In order to avoid confusing them, refer to it as
 * a primary partition, but tell them what BSD has traditionally called
 * it, too.
 */
void
state_select_slice(struct i_fn_args *a)
{
	char msg_buf[1][1024];

	snprintf(msg_buf[0], sizeof(msg_buf[0]),
	    _("Select the existing primary partition (also "
	    "known as a `slice' in the BSD tradition) on "
	    "which to install %s.\n\n"
	    "Note that if you do not have any existing "
	    "primary partitions on this disk, you must "
	    "first create some. This installer does not "
	    "currently have the ability to do this, so "
	    "you will have to exit and run fdisk (in "
	    "DOS or *BSD) or parted (in Linux) to do so."),
	    OPERATING_SYSTEM_NAME);

	a->short_desc = msg_buf[0];
	a->cancel_desc = _("Return to Select Disk");
	fn_select_slice(a);
	if (!a->result || storage_get_selected_slice(a->s) == NULL) {
		state = state_select_disk;
	} else {
		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 = state_select_slice;
				return;
			}
		}

		if (slice_get_capacity(storage_get_selected_slice(a->s)) < DISK_MIN) {
			inform(a->c, _("WARNING: you should have a primary "
			    "partition at least %dM in size, or "
			    "you may encounter problems trying to "
			    "install %s."), DISK_MIN, OPERATING_SYSTEM_NAME);
		}

		if (confirm_dangerous_action(a->c,
		    _("WARNING!  ALL data in primary partition #%d,\n\n%s\n\non the "
		    "disk\n\n%s\n\n will be IRREVOCABLY ERASED!\n\nAre you "
		    "ABSOLUTELY SURE you wish to take this action?  This is "
		    "your LAST CHANCE to cancel!"),
		    slice_get_number(storage_get_selected_slice(a->s)),
		    slice_get_desc(storage_get_selected_slice(a->s)),
		    disk_get_desc(storage_get_selected_disk(a->s)))) {
			if (!format_slice(a)) {
				inform(a->c, _("Primary partition #%d was "
				    "not correctly formatted, and may "
				    "now be in an inconsistent state. "
				    "We recommend re-formatting it "
				    "before proceeding."),
				    slice_get_number(storage_get_selected_slice(a->s)));
			} else {
				inform(a->c, _("Primary partition #%d was formatted."),
				    slice_get_number(storage_get_selected_slice(a->s)));
				state = state_ask_fs;
			}
		} else {
			inform(a->c, _("Action cancelled - no primary partitions were formatted."));
			state = state_select_slice;
		}
	}
}