home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * $Id: inst_lilo_expert.ycp,v 1.13.4.1 2000/03/27 15:28:27 kkaempf Exp $
- *
- * Module: inst_lilo_expert.ycp
- *
- * Author: Klaus KΣmpf
- * Stefan Hundhammer <sh@suse.de>
- *
- * Purpose. This module asks the LILO bootmode and save this
- * infomation in the user_settings
- *
- * user_settings:
- * ro: "has_floppy"
- * rw: "lilo"
- * rw: "lilo_device"
- * rw: "lilo_boot_params"
- * rw: "lilo_linear"
- *
- * "rw" read/write
- * "ro" readonly
-
- */
- {
- string architecture = lookup (user_settings, "architecture", default_architecture);
-
- if (architecture == "ppc")
- return `next;
-
- string lilo = lookup (user_settings, "lilo", "");
- string lilo_device = lookup (user_settings, "lilo_device", "");
- y2log (.milestone, "inst_lilo_expert", 1, "lilo: "+lilo+" at "+lilo_device);
- boolean has_floppy = lookup (user_settings, "has_floppy", false);
-
- string lilo_boot_params = lookup (user_settings, "lilo_boot_params", "");
- boolean lilo_linear = lookup (user_settings, "lilo_linear", false);
-
- term buttons = `VBox(
- `VStretch(),
- `Left(
- `RadioButton( `id( "mbr" ),
- // Radio button for LILO installation on /dev/hda or /dev/sda MBR
- _("Install LILO in the boot disk ('MBR')"),
- lilo == "mbr")
- )
- );
-
- if (has_floppy)
- buttons = add ( buttons,
- `Left(
- `RadioButton( `id( "floppy" ),
- // Radio button for LILO installation on floppy only
- _("Create a boot floppy"),
- lilo == "floppy")
- )
- );
-
- buttons = add ( buttons,
- `Left(
- `RadioButton( `id("boot"),
- // Radio button for LILO installation: Have other boot manager,
- // install in partition /boot only
- _("Install LILO on partition /boot (have other boot manager)"),
- lilo == "boot")
- )
- );
-
- string default_text = "";
- if ((lilo == "custom")
- && (substring (lilo_device, 0, 5) == "/dev/"))
- default_text = lilo_device;
-
- buttons = add ( buttons,
- `HBox(
- `Left(
- `RadioButton( `id("custom"),
- // Radio button for LILO installation:
- // Other partition (enter name in text input field)
- _("Install LILO on other partition:"),
- (lilo == "custom")
- )
- ),
- `TextEntry( `id(`custom_partition), "", default_text)
- )
- );
-
-
- // Input field for boot parameters
-
- buttons = add ( buttons, `VStretch() );
- buttons = add ( buttons,
- `VCenter(
- `VBox(
- `Left(`TextEntry(
- `id( `boot_params ),
- // Text input field to enter additional boot parameters
- _( "Kernel boot parameters:" ),
- lilo_boot_params
- )
- ),
- `Left(`CheckBox(
- `id( `linear ),
- // check box: use the 'linear' option?
- _( "Use the 'linear' option" ),
- lilo_linear
- )
- )
- )
- )
- );
-
- buttons = add ( buttons, `VStretch() );
-
- // determine destination location of lilo boot loader
- term contents = `VCenter(`HSquash(`RadioButtonGroup(`id(`options), buttons) ) );
-
- // helptext for the customized LILO installation
- // part 1 of 7
- string helptext = UI(_("<p>
- LILO (the LInux LOader) can be installed in different places:</p>"));
- // part 2 of 7
- helptext = helptext + UI(_("<p>
- - In the <b>MBR</b> (the Master Boot Record). This is recommended whenever SuSE Linux
- is the only operating system on the hard drive, or if you <em>definitely</em>
- know that you can boot all the other operating systems with LILO. The old MBR
- should be saved to disk, as a precaution.
- </p>"));
- // part 3 of 7
- helptext = helptext + UI(_("<p>
- - On a <b>floppy</b> disk (if your system has a floppy disk drive),
- if you want to avoid the risk of interfering with an already existing
- boot mechanism. You may need to enable booting from floppy disk in
- your system's BIOS when you select this option.
- </p>"));
- // part 4 of 7
- helptext = helptext + UI(_("<p>
- - In the <b>/boot</b> partition. This option can always be used
- if you have a number of operating systems on the hard drive, and if you want to
- boot with your own boot manager, or <tt>loadlin</tt>, for example. The
- advantage of this method is that the MBR is left alone.
- </p>"));
- // part 5 of 7
- helptext = helptext + UI(_("<p>
- Notice: If you use this method, you will also need to configure
- this other boot manager (e.g. <tt>loadlin</tt>) accordingly.
- </p>"));
- // part 6 of 7
- helptext = helptext + UI(_("<p>
- - In some <b>other</b> partition. You need to know your system's
- restrictions when you select this option. Most PCs for example have a
- BIOS limit that restricts booting to hard disk cylinders below
- 1024. Depending on what boot manager to use, you may or you may not
- be able to boot with LILO in a logical partition.
- </p>"));
- // part 7 of 7
- helptext = helptext + UI(_("<p>
- Enter the partition's device name (e.g. <tt>/dev/hda3</tt>,
- <tt>/dev/sdb</tt>) in the input field.
- </p>
- <br>"));
-
- any dlg = UI(`SetWizardContents(_("Custom LILO installation"),
- contents, helptext, Args(0), Args(1)));
-
- // Event handling
-
- any ret = nil;
-
- while (true) {
- ret = UI(`UserInput());
- if (ret == `next || ret == `back) {
- any option = UI(`QueryWidget(`id(`options), `CurrentButton));
- if (option == nil) {
- if ( ret == `next ) {
- // User MUST choose one of the options
- UI(`DisplayMessage(_("You have to choose one of the\noptions in order to continue.")));
- continue;
- }
- }
- else if (is(option,string)) {
- user_settings = add (user_settings, "lilo", option);
- if (option == "mbr") {
- user_settings = add (user_settings, "lilo_device", lookup (user_settings, "mbr_disk"));
- }
- else if (option == "floppy") {
- user_settings = add (user_settings, "lilo_device", lookup (user_settings, "floppy_device", "/dev/fd0"));
- }
- else if (option == "boot") {
- user_settings = add (user_settings, "lilo_device", lookup (user_settings, "boot_device"));
- }
- else if (option == "custom") {
- option = UI(`QueryWidget(`id(`custom_partition), `Value));
- if ((ret == `next)
- && ((!is(option, string))
- || (option == "")
- || (substring (option, 0, 5) != "/dev/"))) {
- UI(`DisplayMessage(_("You did not enter a partition")));
- continue;
- }
- if (is(option,string)) {
- user_settings = add (user_settings, "lilo_device", option);
- }
- }
- }
-
- option = UI(`QueryWidget(`id(`boot_params), `Value));
- if (is (option, string))
- user_settings = add (user_settings, "lilo_boot_params", option);
- option = UI(`QueryWidget(`id(`linear), `Value));
- if (is (option, boolean))
- user_settings = add (user_settings, "lilo_linear", option);
-
- } // ret == next|back
-
- break;
-
- } // while (true);
-
- return ret;
- }
-