home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Author: Klaus KΣmpf
- * Mathias Kettner
- *
- * Purpose: This module ask about do the installation or not,
- * It additonally displays the current settings
- * - login
- * - partitions which will be erased
- * - partitions which will be created
- * - boot configuration
- * - needed disk space
- *
- * user_setting:
- *
- * ro: "loginname"
- * ro: "neededspace" contains, the diskspace needed for installation in byte
- * ro: "lilo" contains, how lilo will be installed
- * ro: "lilo_device" contains, where lilo will be installed
- *
- * "ro" readonly
- *
- * $Id: inst_doit.ycp,v 1.91 2000/03/09 01:28:12 kkaempf Exp $
- */
- {
- term vbox = `VBox ();
-
- // show future user login
-
- string username = lookup (user_settings, "loginname", "");
- // show the user the final username used for login
- vbox = add(vbox, `Left(`Label (sformat(UI(_("Your user name will be '%1'.")), username ))));
-
- // inform user about the harddisk he selected
-
- string target_is = lookup (user_settings, "target_is", "unknown");
- map targetMap = lookup (user_settings, "targets", $[]);
- map target = lookup (targetMap, target_is, $[]);
-
- string targetname = "";
- list partitions = [];
- if (target_is == "CUSTOM") {
- map mountPoints = lookup ( user_settings, "mountpoints", $[]);
- target_is = select (lookup (mountPoints, "/", []), 2); // root disk (raw disk)
- target = lookup (targetMap, target_is, $[]);
- }
-
- targetname = lookup (target, "name", "Unknown Device");
- partitions = lookup (target, "partitions", []);
-
- vbox = add(vbox, `Left(`Label(sformat(UI(_("Linux will be installed on harddisk\n%1")), targetname))));
-
- integer pnum = 0;
-
- // maximum number of targetpartitions to show
- // there simply isn't more space on a 640x480 screen
- // if more partitions are defined, only inform about
- // created partitions
-
- string text_to_show = "";
- integer max2show = 8;
-
- if (size (partitions) < max2show) {
- foreach(`part, partitions,
- ``{ pnum = pnum + 1;
- if (lookup (part, "delete") == true &&
- // Ignore the extended partition, it is never shown before
- lookup (part, "type") != `extended) {
- text_to_show = text_to_show +
- // inform about which partitions will be erased (i.e. re-used) for linux
- sformat(UI(_(" Erasing partition %1 (%2), was '%3'\n")),
- pnum,
- target_is + lookup (part, "nr"),
- lookup (part, "fstype"));
- }
- });
- }
-
- // now show created partitions
-
- pnum = 0;
- foreach(`part, partitions,
- ``{ if ((lookup (part, "delete") != true)
- && (lookup (part, "type") != `extended))
- pnum = pnum + 1;
- if ((lookup (part, "create") == true)
- && (lookup (part, "type") != `extended)
- && (lookup (part, "mount","") != "")) {
- string used_fs = "ext2fs";
- if (lookup (part, "mount") == "swap") {
- used_fs = "swap";
- }
- else if (lookup (part, "used_fs") == `reiser) {
- used_fs = "reiserfs";
- }
- text_to_show = text_to_show +
- // inform about which partitions will be created for linux
- sformat(UI(_(" Creating partition %1 (%2), as %3 (%4)\n")),
- pnum,
- target_is + lookup (part, "nr"),
- lookup (part, "mount"),
- used_fs);
- }
- });
- vbox = add(vbox, `Left(`Label(text_to_show)));
-
- // Installed software
-
- vbox = add(vbox, `Left(`Label(sformat(UI(_("%1 MB software will be installed")),
- lookup(user_settings, "neededspace") / (1024 * 1024)))));
-
- // show boot configuration
-
- string sline = "";
- string lilo = lookup (user_settings, "lilo");
- string lilo_device = lookup (user_settings, "lilo_device");
- if (lilo == "mbr") {
- // show where lilo will be installed, this means MBR
- sline = UI(_("The Linux boot manager will be written on your hard disk."));
- }
- else if (lilo == "floppy") {
- // show where lilo will be installed, this means just on floppy
- sline = UI(_("The Linux boot manager will be written on a floppy disk."));
- }
- else if (lilo == "boot") {
- // show where lilo will be installed, this means just on the boot record of the partition
- sline = UI(_("The Linux boot manager will only be written on the linux partition."));
- }
- else {
- // show where lilo will be installed, this means the user-selected partition
- sline = sformat (UI(_("The Linux boot manager will only be written to %1")), lilo_device);
- }
-
- vbox = add(vbox, `Left(`Label (sline)));
- vbox = add(vbox, `Left(`Label(_("Pressing \"Next\" will start the installation."))));
-
- term contents = `VBox(
- `HVCenter( `HSquash( vbox ) ),
- `HBox(
- `HWeight( 5, `HStretch() ),
-
- // Push button: Do not install Linux at all (this will reboot)
- // `Abort' will abort the whole config and perform a clean shutdown.
- `HWeight( 35, `PushButton(`id(`abort), `opt(`hstretch), _("&Abort installation") ) ),
-
- `HWeight( 2, `HStretch() ),
-
- // Push button: Save the settings (i.e. everything entered
- // during installation) to a floppy disk.
- `HWeight( 35, `PushButton(`id(`save), `opt(`hstretch), _("&Save settings to floppy disk") ) ),
-
- `HWeight( 5, `HStretch() )
- ),
- `Label ( " " )
-
- );
- // helptext (html-format)
- // part 1 of 6
- string helptext = UI(_("<p>
- YaST2 now has all the required information.
- <b><i>Please read all the data carefully</i></b> before you continue.
- </p>"));
-
- // part 2 of 6
- helptext = helptext + UI(_("<p>
- You will need your <b>user name</b>, your <b>user password</b> and -
- most importantly - the <b>root password</b> to work with the installed
- system. Do not forget those values! (But do not write them to a sticky
- note on your screen, either - this is a common security hole).
- </p>"));
-
- // part 3 of 6
- helptext = helptext + UI(_("<p>
- If you are satisfied with the settings, select <b>next</b> in this dialog
- to <b><i>start the installation</i></b>. This is when things actually
- will happen: Your hard disk will be prepared according to your
- selections, and the software will be installed.
- </p>"));
-
- // part 4 of 6
- helptext = helptext + UI(_("<p>
- If you wish to change any of the settings, use <b>back</b> to move back
- to the respective dialog(s), change them accordingly and then use
- <b>next</b> to move to this screen again.
- </p>"));
-
- // part 5 of 6
- helptext = helptext + UI(_("<p>
- <b>Save settings to floppy disk</b> if you want to re-use these
- settings later. Please use a fresh floppy disk - <em>not</em> the
- supplied SuSE \"Boot disk\" or the SuSE \"Modules\" disk. You might
- need those some day.
- </p>"));
-
- // part 6 of 6
- helptext = helptext + UI(_("<p>
- If you wish to abort the installaion entirely, select <b>Abort
- installation</b>. You will lose all settings chosen so far,
- but your hard disk will remain untouched.
- </p>
- <br>"));
-
- // screen title
-
- any dlg = UI(`SetWizardContents(_("Confirm installation"), contents,
- helptext, Args(0), true));
-
- // Event handling
-
- any option = nil;
- any ret = nil;
- while (true) {
- ret = UI(`UserInput());
- if (ret == `cancel || ret == `back) break;
- else if (ret == `next) {
- if (!UI(``{
- OpenDialog(`opt(`decorated, `warncolor),
- // configuration was confirmed, pop-up text if we *really* should go on.
- // `Yes' will prepare the disk and install the sotware.
- // `No' will go back; further config steps are possible.
- // "Now we mean business. There is no going back after this point!"
- // Warning MsgBox. line length < 48 chars.
- `VBox(`Heading(_("\
- Warning:\n\n\
- YaST2 has all information to install SuSE Linux.\n\
- The installation will be done according to your\n\
- settings done by the previous dialogs.\n\
- To commit the installation, and all choices made\n\
- so far, choose \"yes\". Choose \"no\" to go back\n\
- to the previous dialog.\n\n\
- Start installation?
- ")),
- `HBox(
- // no, don't go on, i just changed my mind
- `PushButton(`opt(`default), _("&No")),
- `HStretch(),
- // all right, start installation *now*
- `PushButton(`id(`yes), _("&Yes - install"))
- )));
-
- boolean ok = (UserInput() == `yes);
- CloseDialog();
- return ok;
- })) continue;
- else break;
- }
- else if (ret == `abort) {
- // go here if user selected 'no' to 'start installation ?'
- if (UI(``{
- OpenDialog(`opt(`decorated, `warncolor),
- // configuration was aborted, pop-up text to
- // inform user about possibilities
- // `yes' will reboot the system
- // `no' will go back; further config steps are possible.
- `VBox(`Heading(_("All right, the installation will be aborted.")),
- `HBox(
- // user wont abort installation, pushbutton "no continue"
- // Not longer than 30-35 chars
- `PushButton(`opt(`default), _("&No, continue the installation")),
- `HStretch(),
- // user really want to abort the installation, pushbutton "yes"
- // Not longer than 30-35 chars
- `PushButton(`id(`yes), _("&Yes, abort the installation"))
- )));
- boolean abort = (UserInput() == `yes);
- CloseDialog();
- return abort;
- })) return `cancel;
- }
- else if (ret == `save) {
- Shell("umount /floppy"); // Just for safety
- // Yes/No MsgBox; default: Yes
- while (UI(`YesOrNo(_("\
- The selected configuration and settings will be saved\n\
- on a floppy disk. Please insert a formatted floppy.\n\n\
- Write data to floppy disk now?\
- "), _("&Yes"), _("&No")))) {
- if (0 == Shell("mount /dev/fd0 /floppy -t msdos"))
- {
- boolean success = Write("/floppy/settings.ycp",
- // Remove biggggg install_info
- add (user_settings, "install_info", nil));
- Shell("umount /floppy");
- if (success) {
- // msgbox
- // data saved to floppy disk
- UI(`DisplayMessage(_("Your settings have been written to floppy disk.")));
- break;
- }
- else
- UI(`DisplayMessage(_("\
- Couldn't write your settings to the floppy.\n\
- Is it formatted and is the write protection removed?")));
-
- }
- else {
- UI(`DisplayMessage(_("\
- Couldn't find a valid floppy disk.\n\
- Are you sure, you've entered a floppy disk?\n\
- Is the disk formatted and verified?")));
- }
- }
- }
- }
-
- return ret;
- }
-