[yast-commit] r56563 - in /trunk/bootloader: ./ src/ src/api/ src/elilo/ src/generic/ src/grub/ src/modules/ src/ppc/ src/routines/ src/zipl/
Author: jreidinger Date: Thu Apr 2 10:41:25 2009 New Revision: 56563 URL: http://svn.opensuse.org/viewcvs/yast?rev=56563&view=rev Log: merge back UI refactor branch Added: trunk/bootloader/src/elilo/elilo_dialogs.ycp - copied unchanged from r56562, branches/tmp/juhliarik/bootloader-UIrefactor/src/elilo/elilo_dialogs.ycp trunk/bootloader/src/elilo/elilo_options.ycp - copied unchanged from r56562, branches/tmp/juhliarik/bootloader-UIrefactor/src/elilo/elilo_options.ycp trunk/bootloader/src/ppc/ppc_dialogs.ycp - copied unchanged from r56562, branches/tmp/juhliarik/bootloader-UIrefactor/src/ppc/ppc_dialogs.ycp trunk/bootloader/src/ppc/ppc_options.ycp - copied unchanged from r56562, branches/tmp/juhliarik/bootloader-UIrefactor/src/ppc/ppc_options.ycp trunk/bootloader/src/routines/common_options.ycp - copied unchanged from r56562, branches/tmp/juhliarik/bootloader-UIrefactor/src/routines/common_options.ycp trunk/bootloader/src/routines/grub_options.ycp - copied unchanged from r56562, branches/tmp/juhliarik/bootloader-UIrefactor/src/routines/grub_options.ycp Removed: trunk/bootloader/src/ChangeLog trunk/bootloader/src/api/-lbootldr trunk/bootloader/src/generic/ trunk/bootloader/src/modules/ChangeLog trunk/bootloader/src/routines/ChangeLog Modified: trunk/bootloader/ (props changed) trunk/bootloader/src/Makefile.am trunk/bootloader/src/elilo/Makefile.am trunk/bootloader/src/elilo/helps.ycp trunk/bootloader/src/elilo/widgets.ycp trunk/bootloader/src/grub/helps.ycp trunk/bootloader/src/grub/misc.ycp trunk/bootloader/src/modules/BootCommon.ycp trunk/bootloader/src/modules/BootELILO.ycp trunk/bootloader/src/modules/BootGRUB.ycp trunk/bootloader/src/modules/BootLILO.ycp trunk/bootloader/src/modules/BootPOWERLILO.ycp trunk/bootloader/src/modules/BootZIPL.ycp trunk/bootloader/src/modules/Bootloader.ycp trunk/bootloader/src/modules/Bootloader_API.pm trunk/bootloader/src/modules/Makefile.am trunk/bootloader/src/ppc/Makefile.am trunk/bootloader/src/ppc/helps.ycp trunk/bootloader/src/routines/Makefile.am trunk/bootloader/src/routines/dialogs.ycp trunk/bootloader/src/routines/dialogs_i386.ycp trunk/bootloader/src/routines/global_widgets.ycp trunk/bootloader/src/routines/helps.ycp trunk/bootloader/src/routines/helps_i386.ycp trunk/bootloader/src/routines/lib_iface.ycp trunk/bootloader/src/routines/lilolike.ycp trunk/bootloader/src/routines/misc.ycp trunk/bootloader/src/routines/section_widgets.ycp trunk/bootloader/src/routines/switcher.ycp trunk/bootloader/src/routines/widgets_i386.ycp trunk/bootloader/src/routines/wizards.ycp trunk/bootloader/src/zipl/helps.ycp trunk/bootloader/yast2-bootloader.spec.in Modified: trunk/bootloader/src/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/Makefile.am?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/Makefile.am (original) +++ trunk/bootloader/src/Makefile.am Thu Apr 2 10:41:25 2009 @@ -1 +1 @@ -SUBDIRS = routines modules lilo grub elilo ppc zipl config clients generic +SUBDIRS = routines modules lilo grub elilo ppc zipl config clients Modified: trunk/bootloader/src/elilo/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/elilo/Makefile.am?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/elilo/Makefile.am (original) +++ trunk/bootloader/src/elilo/Makefile.am Thu Apr 2 10:41:25 2009 @@ -5,7 +5,9 @@ yncludedir = @yncludedir@/bootloader/elilo ynclude_DATA = \ - helps.ycp + helps.ycp \ + elilo_options.ycp \ + elilo_dialogs.ycp EXTRA_DIST = \ $(ynclude_DATA) Modified: trunk/bootloader/src/elilo/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/elilo/helps.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/elilo/helps.ycp (original) +++ trunk/bootloader/src/elilo/helps.ycp Thu Apr 2 10:41:25 2009 @@ -43,7 +43,9 @@ <b>Browse</b></p> "), "image" : - _("<p><b>Name of default image file</b></p>"), + _("<p><b>Name of default image file</b>, if not empty, defines the image +file to use. Either enter the path and file name directly or choose by using +<b>Browse</b></p>"), "chooser" : _("<p><b>Specify user interface for ELILO ('simple' or 'textmenu')</b><br> Beware: 'textmenu' has occasionally caused problems on some machines.</p>"), @@ -65,9 +67,43 @@ "image_readonly" : _("<p><b>Force root filesystem to be mounted read-only</b><br> Usually specified in global section</p>"), - "image_relocatable" : - _("<p><b>Allow attempt to relocate</b></p> + "section_relocatable" : + _("<p><b>Allow attempt to relocate</b> Usually specified in global section</p>"), + "prompt" : + _("<p><b>Force Interactive Mode</b> +Force interactive mode during booting</p>"), + "root" : + _("<p><b>Set Default Root Filesystem</b> +Set global root filesystem for Linux/ia64</p>"), + + "chooser" : + _("<p><b>Set the User Interface for ELILO</b> +Specify kernel chooser to use: \"simple\" or \"textmenu\"</p>"), + + "fX" : + _("<p><b>Display the Content of a File by Function Keys</b> +Some choosers may take advantage of this option to +display the content of a file when a certain function +key X is pressed. X can vary from 1-12 to cover +function keys F1 to F12</p>"), + + "fpswa" : + _("<p><b>Specify the Filename for a Specific FPSWA to Load</b> +Specify the filename for a specific FPSWA to load. +If this option is used then no other file will be tried.</p>"), + + "message" : + _("<p><b>Message Printed on Main Screen (If Supported)</b> +A message that is printed on the main screen if supported by +the chooser.</p>"), + + "delay" : +_("<p><b>Delay to Wait before Auto Booting in Seconds</b> +The number of 10th of seconds to wait before +auto booting when not in interactive mode. +Default is 0</p>"), + ]; Modified: trunk/bootloader/src/elilo/widgets.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/elilo/widgets.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/elilo/widgets.ycp (original) +++ trunk/bootloader/src/elilo/widgets.ycp Thu Apr 2 10:41:25 2009 @@ -23,7 +23,6 @@ import "Label"; import "Mode"; import "BootCommon"; - import "TablePopup"; include "bootloader/routines/popups.ycp"; @@ -37,23 +36,16 @@ global define term getTargetWidget () ``{ boolean have_old = (old_efi_entry != nil && old_efi_entry != ""); - term widget = `VBox ( + term widget = `VBox (`Frame ( _("EFI Label"), `HBox(`HSpacing(1),`VBox( `VSpacing (1), `Left (`CheckBox (`id (`create_entry), `opt (`notify), // check box _("&Create EFI Entry"))), - `VSpacing (0.6), `Left (`InputField (`id (`location), `opt (`hstretch), // text entry label _("&EFI Entry Name"))), - have_old ? `VSpacing (1) : `VSpacing (0), - have_old - ? `Left (`CheckBox (`id (`remove_old), - // check box - sformat (_("&Remove Old EFI Entry (%1)"), old_efi_entry))) - : `VSpacing (0), - `VSpacing (1) - ); + `VStretch () + )))); return widget; } @@ -63,16 +55,9 @@ * @param opt_key any option key */ global define void targetInit (string widget) ``{ - boolean have_old = (old_efi_entry != nil && old_efi_entry != ""); UI::ChangeWidget (`id (`create_entry), `Value, create_efi_entry); - UI::ChangeWidget (`id (`location), `Value, efi_entry_name); + UI::ChangeWidget (`id (`location), `Value, BootCommon::globals["boot_efilabel"]:""); UI::ChangeWidget (`id (`location), `Enabled, create_efi_entry); - if (have_old) - { - UI::ChangeWidget (`id (`remove_old), `Value, remove_old_efi); - UI::ChangeWidget (`id (`remove_old), `Enabled, create_efi_entry); - } - UI::SetFocus (`id (`create_entry)); } /** @@ -82,14 +67,9 @@ * @param event map event that occured */ global symbol targetHandle (string widget, map event) ``{ - boolean have_old = (old_efi_entry != nil && old_efi_entry != ""); UI::ChangeWidget (`id (`location), `Enabled, UI::QueryWidget (`id (`create_entry), `Value)); - if (have_old) - { - UI::ChangeWidget (`id (`remove_old), `Enabled, - UI::QueryWidget (`id (`create_entry), `Value)); - } + return nil; } /** @@ -98,18 +78,11 @@ * @param opt_key any option key */ global define void targetStore (string widget, map event) ``{ - boolean have_old = (old_efi_entry != nil && old_efi_entry != ""); - efi_entry_name = (string) + BootCommon::globals["boot_efilabel"] = (string) UI::QueryWidget (`id (`location), `Value); - if (have_old) - { - remove_old_efi = (boolean) - UI::QueryWidget (`id (`remove_old), `Value); - } BootCommon::location_changed = true; create_efi_entry = (boolean) UI::QueryWidget (`id (`create_entry), `Value); - BootCommon::location_changed = true; } /** Modified: trunk/bootloader/src/grub/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/helps.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/grub/helps.ycp (original) +++ trunk/bootloader/src/grub/helps.ycp Thu Apr 2 10:41:25 2009 @@ -40,9 +40,8 @@ using the <b>Up</b> and <b>Down</b> buttons.</p> "), "generic_mbr" : - _("<p><big><b>Write generic Boot Code to MBR</b></big><br> -To replace the master boot record of your disk with generic code (OS independent code which -boots the active partition), select <b>Write generic Boot Code to MBR</b>.</p>"), + _("<p><b>Write generic Boot Code to MBR</b> replace the master boot record of your disk with generic code (OS independent code which +boots the active partition).</p>"), "boot_boot" : _("<p><b>Boot from Boot Partition</b> is one of the recommended options, the other is <b>Boot from Root Partition</b>.</p>"), @@ -80,34 +79,32 @@ "gfxmenu" : _("<p><b>Graphical Menu File</b> defines the file to use for the graphical boot menu.</p>"), "password" : - _("<p><b>Password for the Menu Interface</b><br> + _("<p><b>Protect Boot Loader with Password</b><br> Define the password that will be required to access the boot menu. YaST will only accept the password if you repeat it in <b>Retype Password</b>.</p>"), "type_image" : _("<p><b>Image Section</b></p>"), - "image_image" : + "image" : _("<p><b>Kernel Image</b> defines the kernel to boot. Either enter the name directly or choose via <b>Browse</b>.</p>"), - "image_root" : + "root" : _("<p><b>Root Device</b> sets the device to pass to the kernel as root device.</p>"), - "image_vgamode" : + "vgamode" : _("<p><b>Vga Mode</b> defines the VGA mode the kernel should set the <i>console</i> to when booting.</p>"), - "image_append" : + "append" : _("<p><b>Optional Kernel Command Line Parameter</b> lets you define additional parameters to pass to the kernel.</p>"), - "image_initrd" : + "initrd" : _("<p><b>Initial RAM Disk</b>, if not empty, defines the initial ramdisk to use. Either enter the path and file name directly or choose by using <b>Browse</b>.</p> "), - "image_noverifyroot" : - _("<p>Selecting <b>Do not verify Filesystem before Booting</b> will skip all file system checks.</p>"), "type_other" : _("<p>Select <b>Chainloader Section</b> if you want to define a section for booting an OS other than Linux.</p>"), "other_lock" : _("<p>Setting <b>Use Password Protection</p> will require a password to select this section.</p>"), - "other_chainloader" : + "chainloader" : _("<p><b>Other System</b> lets you choose among the non-Linux operating systems found on your computer.</p>"), - "other_makeactive" : + "makeactive" : _("<p>Select <b>Activate this Partition when selected for Boot</b> if your BIOS needs this flag set in order to boot it</p>"), - "other_blockoffset" : + "blockoffset" : _("<p><b>Block Offset for Chainloading</b> lets you specify the list of blocks to boot. In most cases you want to specify <code>+1</code> here. For specifics on blocklist notation see the grub documentation.</p> "), @@ -117,14 +114,10 @@ "), "xen_image" : _("<p><b>Kernel Image</b> defines the kernel to boot. Either enter the name directly or choose via <b>Browse</b>.</p>"), - "xen_append" : - _("<p><b>Optional Kernel Command Line Parameter</b> lets you define additional parameters to pass to the kernel.</p>"), - "xen_xen" : + "xen" : _("<p><b>Hypervisor</b> specifies the Hypervisor to use.</p>"), - "xen_root" : - _("<p><b>Root Device</b> sets the device to pass to the kernel as root device.</p>"), - "xen_vgamode" : - _("<p><b>Vga Mode</b> defines the VGA mode the kernel should set the <i>console</i> to when booting.</p>"), + "xen_append" : + _("<p><b>Additional Xen Hypervisor Parameters</b> lets you define additional parameters to pass to the xen hypervisor.</p>"), "xen_initrd" : _("<p><b>Initial RAM Disk</b>,if not empty, defines the initial ramdisk to use. Either enter the path and file name directly or choose by using <b>Browse</b>.</p> @@ -133,9 +126,9 @@ _("<p><b>Menu Section</b></p>"), "menu_root" : _("<p><b>Partition of Menu File</b></p>"), - "menu_configfile" : + "configfile" : _("<p><b>Menu Description File<b></p>"), - "other_remap" : + "remap" : _("<p><b>Map Section to the First Disk from Device Map</b> Windows usually need to be on the first disk.</p>"), "MeasuresTableHelp" : _("<p><b>Measures</b> includes measured files with PCR. Change table is possible via buttons: <b>Add</b> , @@ -155,49 +148,43 @@ global map<string,string> grub_descriptions = $[ "boot" : _("Boot Loader Locations"), - "activate" : _("Set active Flag in Partition Table for Boot Partition"), - "timeout" : _("Timeout in Seconds"), - "default" : _("Default Boot Section"), - "generic_mbr" : _("Write generic Boot Code to MBR"), - "trusted_grub" : _("Use Trusted Grub"), + "activate" : _("Set &active Flag in Partition Table for Boot Partition"), + "timeout" : _("&Timeout in Seconds"), + "default" : _("&Default Boot Section"), + "generic_mbr" : _("Write &generic Boot Code to MBR"), + "trusted_grub" : _("Use &Trusted Grub"), "boot_custom" : _("Custom Boot Partition"), "boot_mbr" : _("Boot from Master Boot Record"), "boot_root" : _("Boot from Root Partition"), "boot_boot" : _("Boot from Boot Partition"), "boot_extended" : _("Boot from Extended Partition"), - "former_default_image_flavor": _("Former default Image Flavor"), - "serial" : _("Serial Connection Parameters"), - "terminal" : _("Terminal Definition"), + "serial" : _("Serial Connection &Parameters"), "fallback" : _("Fallback Sections if Default fails"), - "hiddenmenu" : _("Hide Menu on Boot"), - "gfxmenu" : _("Graphical Menu File"), - "password" : _("Password for the Menu Interface"), - "debug" : _("Debugging Flag"), + "hiddenmenu" : _("&Hide Menu on Boot"), + "gfxmenu" : _("Graphical &Menu File"), + "password" : _("Pa&ssword for the Menu Interface"), + "debug" : _("Debugg&ing Flag"), "type_image" : _("Image Section"), - "image_image" : _("Kernel Image"), - "image_root" : _("Root Device"), - "image_vgamode" : _("Vga Mode"), - "image_append" : _("Optional Kernel Command Line Parameter"), - "image_initrd" : _("Initial RAM Disk"), - "image_noverifyroot" : _("Do not verify Filesystem before Booting"), + "image" : _("&Kernel Image"), + "root" : _("&Root Device"), + "vgamode" : _("&Vga Mode"), + "append" : _("O&ptional Kernel Command Line Parameter"), + "initrd" : _("&Initial RAM Disk"), "type_other" : _("Chainloader Section"), "other_lock" : _("Use Password Protection"), - "other_chainloader" : _("Other System"), - "other_noverifyroot" : _("Do not verify Filesystem before Booting"), - "other_makeactive" : _("Activate this Partition when selected for Boot"), - "other_blockoffset" : _("Block Offset for Chainloading"), - "other_remap" : _("Map Section to the First Disk in Device Map"), + "chainloader" : _("&Other System"), + "noverifyroot" : _("Do not &verify Filesystem before Booting"), + "makeactive" : _("&Activate this Partition when selected for Boot"), + "blockoffset" : _("B&lock Offset for Chainloading"), + "remap" : _("&Map Section to the First Disk in Device Map"), "type_xen" : _("Xen Section"), - "xen_xen" : _("Hypervisor"), - "xen_xen_append" : _("Additional Xen Hypervisor Parameters"), + "xen" : _("&Hypervisor"), + "xen_append" : _("&Additional Xen Hypervisor Parameters"), "xen_image" : _("Kernel Image"), - "xen_root" : _("Root Device"), - "xen_vgamode" : _("Vga Mode"), - "xen_append" : _("Optional Kernel Command Line Parameter"), "xen_initrd" : _("Initial RAM Disk"), "type_menu" : _("Menu Section"), - "menu_root" : _("Partition of Menu File"), - "menu_configfile" : _("Menu Description File"), + "menu_root" : _("&Partition of Menu File"), + "configfile" : _("&Menu Description File"), ]; Modified: trunk/bootloader/src/grub/misc.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/misc.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/grub/misc.ycp (original) +++ trunk/bootloader/src/grub/misc.ycp Thu Apr 2 10:41:25 2009 @@ -449,7 +449,6 @@ if (haskey (BootCommon::globals, "boot_custom")) { BootCommon::globals = remove (BootCommon::globals, "boot_custom"); } - BootCommon::change_widget_default_value("boot_custom", ""); // FIXME: kludge, may be obsolete if ( selected_location == `root ) { BootCommon::globals["boot_root"] = sformat("%1", true); @@ -459,11 +458,6 @@ BootCommon::globals["boot_mbr"] = sformat("%1", true); } else if ( selected_location == `extended ) { BootCommon::globals["boot_extended"] = sformat("%1", true); -// FIXME: `mbr_md is probably unneeded; AFA we can see, this decision is -// automatic anyway and perl-Bootloader should be able to make it without help -// from the user or the proposal. -// } else if ( selected_location == `mbr_md ) { -// BootCommon::globals["boot_mbr_md"] = sformat("%1", true); } } @@ -858,17 +852,6 @@ " any more.\n" ]; -// FIXME: `mbr_md is probably unneeded; AFA we can see, this decision is -// automatic anyway and perl-Bootloader should be able to make it without help -// from the user or the proposal. -// if ( BootCommon::globals["boot_mbr_md"]:"false" == "true" ) { -// // FIXME: handle Md2Partitions() etc. here -// map p_dev = Storage::GetDiskPartition (BootCommon::BootPartitionDevice); -// string actual_mbr = p_dev["disk"]:""; -// -// if ( actual_mbr != BootCommon::mbrDisk ) -// ret = true; // FIXME: use new return structure -// } if ( BootCommon::globals["boot_custom"]:nil != nil ) { list all_boot_partitions = BootCommon::getPartitionList(`boot); @@ -966,41 +949,6 @@ // -------------------------------------------------------------- // other stuff -/** - * Propose whether allow or not embedding of 1.5 stage - * @return boolean true to allow - */ -// FIXME: remove this function, it is obsolete (now handled within grub by -// using "setup" instead of "install") -// The code probably does not work with multiple bootloader locations anyway. -// This code previously existed in lilolike.ycp and in grub/misc.ycp... See -// more in lilolike.ycp. -define boolean allowEmbed15 () { - // allow only if /boot, /root or MBR device selected - if (! (BootCommon::globals["boot_boot"]:"false" == "true" - || BootCommon::globals["boot_root"]:"false" == "true" - || BootCommon::globals["boot_mbr"]:"false" == "true" - )) - { - return false; - } - // check filesystem on /boot for Reiserfs and JFS - map mp = Storage::GetMountPoints (); - list bp_info - = mp["/boot"]:mp["/"]:[]; - list<map> partitions - = Storage::GetTargetMap ()[bp_info[2]:"", "partitions"]:[]; - boolean ret = false; - foreach (map p, partitions, { - if (p["device"]:"" == BootCommon::BootPartitionDevice) - { - symbol fs = (symbol)p["used_fs"]:nil; - if (fs == `reiser || fs == `jfs) - ret = true; - } - }); - return ret; -} /** * Encrypt the password before storing it in variables Modified: trunk/bootloader/src/modules/BootCommon.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootCommon.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/modules/BootCommon.ycp (original) +++ trunk/bootloader/src/modules/BootCommon.ycp Thu Apr 2 10:41:25 2009 @@ -399,13 +399,17 @@ // = [ "linux", "failsafe", "initrd", "floppy" ]; /** + * Common section types + */ +global list<string> common_sections_types = ["image", "other"]; + +/** * List of all supported bootloaders */ global list<string> bootloaders = ["lilo", "grub", "elilo", "milo", "silo", "aboot", "zipl", "ppc", "mips"]; - /** * bnc #468922 - problem with longtime running the parsing a huge number of disks * map<string,map> the map of all partitions with info about it -> @@ -453,8 +457,6 @@ /* * help message and dscription definitions */ -include "bootloader/generic/helps.ycp"; - include "bootloader/routines/popups.ycp"; include "bootloader/routines/misc.ycp"; // FIXME: there are other archs than i386, this is not 'commmon' @@ -762,6 +764,16 @@ return exp; } +/** + * Function return common section types + * @return list string section types + */ + +global list<string> Common_sections_types() +{ + return common_sections_types; +} + /** * Import settings from a map @@ -910,10 +922,6 @@ if (bl == "none") return true; - // FATE: #110038: Serial console - // check and add console key with value for sections - addConsole(); - // FIXME: give mountby information to perl-Bootloader (or define some // better interface), so that perl-Bootloader can use mountby device names // for these devices instead. Tracked in bug #248162. Modified: trunk/bootloader/src/modules/BootELILO.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootELILO.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/modules/BootELILO.ycp (original) +++ trunk/bootloader/src/modules/BootELILO.ycp Thu Apr 2 10:41:25 2009 @@ -42,7 +42,8 @@ include "bootloader/elilo/helps.ycp"; include "bootloader/routines/popups.ycp"; -include "bootloader/generic/dialogs.ycp"; +include "bootloader/elilo/elilo_dialogs.ycp"; + // private variables @@ -76,6 +77,9 @@ */ boolean efi_available = true; + +include "bootloader/elilo/widgets.ycp"; + // misc. functions /** @@ -368,7 +372,7 @@ */ global boolean Save (boolean clean, boolean init, boolean flush) { boolean ret = BootCommon::Save (clean, init, flush); - importMetaData(); + //importMetaData(); return ret; } @@ -796,7 +800,7 @@ global map<string,symbol()> Dialogs () { return $[ - "loader" : genericBootLoaderOptionsDialog, + "loader" : EliloLoaderDetailsDialog, ]; } @@ -810,6 +814,11 @@ return true; } +list <string> elilo_section_types() +{ + return ["image", "xen"]; +} + /** * Return map of provided functions * @return a map of functions (eg. $["write"::Write]) @@ -825,10 +834,10 @@ "summary" : Summary, "update" : Update, "write" : Write, - "widgets" : genericWidgets, + "widgets" : Widgets, "wizard_sequencer" : WizardSequenzer, "dialogs" : Dialogs, - "section_types" : section_types, + "section_types" : elilo_section_types, "flagbootdefaultonce" : FlagBootDefaultOnce, ]; } @@ -846,23 +855,7 @@ "bootloader_on_disk" : true, ]; - BootCommon::help_messages = (map<string,string>) - union(BootCommon::help_messages, - mapmap(string key, string val, elilo_help_messages, - { return $[ "elilo_" + key : val ]; } - ) - ); - y2debug("Initialized help_messages to %1", BootCommon::help_messages); - BootCommon::descriptions = (map<string,string>) - union(BootCommon::descriptions, - mapmap(string key, string val, elilo_descriptions, - { return $[ "elilo_" + key : val ]; } - ) - ); - y2debug("Initialized help_messages to %1", BootCommon::help_messages); - BootCommon::InitializeLibrary (false, "elilo"); - importMetaData(); } /** Modified: trunk/bootloader/src/modules/BootGRUB.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootGRUB.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/modules/BootGRUB.ycp (original) +++ trunk/bootloader/src/modules/BootGRUB.ycp Thu Apr 2 10:41:25 2009 @@ -61,8 +61,8 @@ include "bootloader/grub/misc.ycp"; include "bootloader/routines/popups.ycp"; include "bootloader/grub/helps.ycp"; -include "bootloader/generic/device_map_edit_widget.ycp"; -include "bootloader/generic/dialogs.ycp"; +include "bootloader/routines/dialogs_i386.ycp"; + // end of mandatory functions //---------------------------------------------------------------------------- @@ -518,7 +518,7 @@ BootCommon::ProposeDeviceMap (); } - importMetaData(); + //importMetaData(); return ret; } @@ -643,7 +643,7 @@ // now really save the settings boolean ret = BootCommon::Save (clean, init, flush); - importMetaData(); + //importMetaData(); return ret; } @@ -775,7 +775,7 @@ global map<string,symbol()> Dialogs () { return $[ "installation" : i386InstallDetailsDialog, - "loader" : genericBootLoaderOptionsDialog, + "loader" : i386LoaderDetailsDialog, ]; } @@ -792,6 +792,11 @@ return (result["exit"]:-1 == 0); } +list <string> grub_section_types() +{ + return ["image", "xen", "menu", "other"]; +} + /** * Return map of provided functions @@ -799,8 +804,6 @@ */ global map<string, any> GetFunctions () { return $[ - //"export" : Export, - //"import" : Import, "read" : Read, "reset" : Reset, "propose" : Propose, @@ -808,10 +811,10 @@ "summary" : Summary, "update" : Update, "write" : Write, - "widgets" : genericWidgets, + "widgets" : grubWidgets, "wizard_sequencer" : WizardSequenzer, "dialogs" : Dialogs, - "section_types" : section_types, + "section_types" : grub_section_types, "flagonetimeboot" : FlagOnetimeBoot, ]; } @@ -835,23 +838,7 @@ "bootloader_on_disk" : true, ]; - BootCommon::help_messages = (map<string,string>) - union(BootCommon::help_messages, - mapmap(string key, string val, grub_help_messages, - { return $[ "grub_" + key : val ]; } - ) - ); - y2debug("Initialized help_messages to %1", BootCommon::help_messages); - BootCommon::descriptions = (map<string,string>) - union(BootCommon::descriptions, - mapmap(string key, string val, grub_descriptions, - { return $[ "grub_" + key : val ]; } - ) - ); - y2debug("Initialized help_messages to %1", BootCommon::help_messages); - BootCommon::InitializeLibrary (false, "grub"); - importMetaData(); } /** Modified: trunk/bootloader/src/modules/BootLILO.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootLILO.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/modules/BootLILO.ycp (original) +++ trunk/bootloader/src/modules/BootLILO.ycp Thu Apr 2 10:41:25 2009 @@ -33,7 +33,6 @@ include "bootloader/routines/popups.ycp"; include "bootloader/routines/dialogs_i386.ycp"; -include "bootloader/generic/dialogs.ycp"; /** @@ -315,6 +314,12 @@ return (result["exit"]:-1 == 0); } + +list <string> lilo_section_types() +{ + return ["image", "other"]; +} + /** * Return map of provided functions * @return a map of functions (eg. $["write":BootLILO::Write]) @@ -329,8 +334,8 @@ "update" : Update, "write" : Write, "flagonetimeboot" : FlagOnetimeBoot, - "widgets" : genericWidgets, - "section_types" : section_types, + "widgets" : $[], // is not supported now + "section_types" : lilo_section_types, ]; } Modified: trunk/bootloader/src/modules/BootPOWERLILO.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootPOWERLILO.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/modules/BootPOWERLILO.ycp (original) +++ trunk/bootloader/src/modules/BootPOWERLILO.ycp Thu Apr 2 10:41:25 2009 @@ -43,7 +43,8 @@ * read my dialogs */ include "bootloader/routines/popups.ycp"; // define confirmSectionDeletePopup -include "bootloader/generic/dialogs.ycp"; +//include "bootloader/generic/dialogs.ycp"; + @@ -62,6 +63,9 @@ // map available of 41 PReP partitions, used on iSeries and CHRP global list<string> prep_boot_partitions = []; +// map available HFS partitions, used on PMac +global list<string> pmac_boot_partitions = []; + // PReP boot partitions that were proposed by partitioner to install BL global list<string> install_prep_boot_partitions = []; @@ -85,6 +89,10 @@ global define void setBoardType (string board); global define void currentBoardInit (); + +include "bootloader/ppc/ppc_dialogs.ycp"; + + /** * Update list of 41 PReP boot partitions * @return boolean true if list changed, false otherwise @@ -555,7 +563,7 @@ ); }); y2milestone ("Detected pmac boot partitions: %1", boot_partitions); - + pmac_boot_partitions = boot_partitions; if (selected_boot_partition == "") { selected_boot_partition = boot_partitions[0]:""; @@ -913,7 +921,7 @@ boolean ret = BootCommon::Read (false, avoid_reading_device_map); y2milestone (":: Read globals: %1", BootCommon::globals); - importMetaData(); + //importMetaData(); return ret; } @@ -988,7 +996,7 @@ if (flush) ret = ret && BootCommon::CommitSettings (); - importMetaData(); + //importMetaData(); BootCommon::WriteToSysconf(false); return ret; @@ -1258,8 +1266,7 @@ global map<string,symbol()> Dialogs () { // PPC definitly needs other text modules return $[ - "loader" : genericBootLoaderOptionsDialog, -// "installation" : ppcInstallDetailsDialog, + "loader" : PPCDetailsDialog, ]; } @@ -1276,6 +1283,13 @@ return (result["exit"]:-1 == 0); } +list<string> ppc_section_types(){ + if (Arch::board_iseries()){ + return ["image","other"]; + } + + return ["image"]; +} /** * Return map of provided functions @@ -1292,10 +1306,10 @@ "summary" : Summary, "update" : Update, "write" : Write, - "widgets" : genericWidgets, + "widgets" : ppcWidgets, "wizard_sequencer" : WizardSequenzer, "dialogs" : Dialogs, - "section_types" : section_types, + "section_types" : ppc_section_types, "flagonetimeboot" : FlagOnetimeBoot, ]; } @@ -1311,23 +1325,8 @@ "scratch" : true, "bootloader_on_disk" : true, ]; - BootCommon::help_messages = (map<string,string>) - union(BootCommon::help_messages, - mapmap(string key, string val, ppc_help_messages, - { return $[ "ppc_" + key : val ]; } - ) - ); - y2debug("Initialized help_messages to %1", BootCommon::help_messages); - BootCommon::descriptions = (map<string,string>) - union(BootCommon::descriptions, - mapmap(string key, string val, ppc_descriptions, - { return $[ "ppc_" + key : val ]; } - ) - ); - y2debug("Initialized descriptions to %1", BootCommon::descriptions); BootCommon::InitializeLibrary (false, "ppc"); - importMetaData(); } /** Modified: trunk/bootloader/src/modules/BootZIPL.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootZIPL.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/modules/BootZIPL.ycp (original) +++ trunk/bootloader/src/modules/BootZIPL.ycp Thu Apr 2 10:41:25 2009 @@ -32,7 +32,6 @@ include "bootloader/zipl/helps.ycp"; include "bootloader/routines/popups.ycp"; -include "bootloader/generic/dialogs.ycp"; // local data @@ -235,7 +234,6 @@ */ global boolean Save (boolean clean, boolean init, boolean flush) { boolean ret = BootCommon::Save (clean, init, flush); - importMetaData(); if (Mode::normal ()) return ret; @@ -283,11 +281,7 @@ global map<string,symbol()> Dialogs () { - if (size(GOW_options()) == 0) return $[]; - return $[ - "loader" : genericBootLoaderOptionsDialog, - ]; } /** @@ -301,6 +295,15 @@ return true; } +list <string> zipl_section_types() +{ + return ["image", "menu", "dump"]; +} + +map<string,map<string,any> > ziplWidgets(){ + return $[]; +} + /** * Return map of provided functions * @return a map of functions (eg. $["write"::Write]) @@ -316,10 +319,10 @@ "summary" : Summary, "update" : Update, "write" : Write, - "widgets" : genericWidgets, + "widgets" : ziplWidgets, "wizard_sequencer" : WizardSequenzer, "dialogs" : Dialogs, - "section_types" : section_types, + "section_types" : zipl_section_types, "flagonetimeboot" : FlagOnetimeBoot, ]; } @@ -337,23 +340,7 @@ "scratch" : true, ]; - BootCommon::help_messages = (map<string,string>) - union(BootCommon::help_messages, - mapmap(string key, string val, zipl_help_messages, - { return $[ "zipl_" + key : val ]; } - ) - ); - y2debug("Initialized help_messages to %1", BootCommon::help_messages); - BootCommon::descriptions = (map<string,string>) - union(BootCommon::descriptions, - mapmap(string key, string val, zipl_descriptions, - { return $[ "zipl_" + key : val ]; } - ) - ); - y2debug("Initialized help_messages to %1", BootCommon::help_messages); - BootCommon::InitializeLibrary (false, "zipl"); - importMetaData(); } /** Modified: trunk/bootloader/src/modules/Bootloader.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/Bootloader.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/modules/Bootloader.ycp (original) +++ trunk/bootloader/src/modules/Bootloader.ycp Thu Apr 2 10:41:25 2009 @@ -622,11 +622,11 @@ y2milestone ("Writing bootloader configuration during installation"); boolean ret = true; - // read current settings... - ret = blRead (true, false); - if (! Mode::live_installation()) { + // bnc#449785 - Installing of GRUB fails when using live installer from a USB stick + // read current settings... + ret = blRead (true, false); // delete duplicated sections DelDuplicatedSections(); } else { Modified: trunk/bootloader/src/modules/Bootloader_API.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/Bootloader_API.pm?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/modules/Bootloader_API.pm (original) +++ trunk/bootloader/src/modules/Bootloader_API.pm Thu Apr 2 10:41:25 2009 @@ -280,6 +280,15 @@ return $ret; } +BEGIN { $TYPEINFO{setUdevMapping} = ["function", "boolean", ["map", "string", "string"]]; } +sub setUdevMapping($) { + my ($dm) = @_; + my $ret = $lib_ref->DefineUdevMapping ($dm); + + DumpLog(); + return $ret; +} + BEGIN { $TYPEINFO{setPartitions} = ["function", "boolean", ["list", ["list", "string"]]]; } sub setPartitions($) { my ($dm) = @_; @@ -298,6 +307,15 @@ return $ret; } +BEGIN { $TYPEINFO{countGRUBPassword} = ["function", "string","string"]; } +sub countGRUBPassword($) { + my ($pass) = @_; + my $ret = $lib_ref->CountGRUBPassword($pass); + + DumpLog(); + return $ret; +} + # import fails if we cannot create the object $lib_ref; Modified: trunk/bootloader/src/modules/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/Makefile.am?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/modules/Makefile.am (original) +++ trunk/bootloader/src/modules/Makefile.am Thu Apr 2 10:41:25 2009 @@ -17,10 +17,6 @@ Bootloader_API.pm \ BootSupportCheck.ycp -# BootS390.ycp \ -# BootMILO.ycp \ -# BootABOOT.ycp - Bootloader_API.pm: test -f Bootloader_API.pm || exit 1 Modified: trunk/bootloader/src/ppc/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/ppc/Makefile.am?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/ppc/Makefile.am (original) +++ trunk/bootloader/src/ppc/Makefile.am Thu Apr 2 10:41:25 2009 @@ -5,7 +5,9 @@ yncludedir = @yncludedir@/bootloader/ppc ynclude_DATA = \ - helps.ycp + helps.ycp \ + ppc_dialogs.ycp \ + ppc_options.ycp EXTRA_DIST = \ $(ynclude_DATA) Modified: trunk/bootloader/src/ppc/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/ppc/helps.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/ppc/helps.ycp (original) +++ trunk/bootloader/src/ppc/helps.ycp Thu Apr 2 10:41:25 2009 @@ -21,6 +21,51 @@ global map<string,string> ppc_help_messages = $[ "boot-loader-location" : _("<p><big><b>Boot Loader Location</b></big><br>"), + "boot" : _("<p><b>Boot Loacation</b> +This is the partition number of your boot partition. On a +PowerMac it must be in HFS format because we use the hfsutils to +copy the files to that partition. On CHRP you need a 41 PReP +boot partition, /boot/second from the quik package is stored there </p>"), + "bootfolder" : _("<p><b>Boot Folder Path</b> +Only for Pmac. Folder that contains your boot stuff, this +folder will be blessed to mark it bootable.</p>"), + "append" : + _("<p><b>Append string for.global options to pass to kernel command line</b><br> +Lets you define additional global parameters to pass to the kernel. These are +used if no 'append' appears in a given section.</p> +"), + "initrd" : + _("<p><b>Name of the default initrd file</b>, if not empty, defines the initial +ramdisk to use. Either enter the path and file name directly or choose by using +<b>Browse</b></p> +"), + "image" : + _("<p><b>Name of default image file</b>, if not empty, defines the image +file to use. Either enter the path and file name directly or choose by using +<b>Browse</b></p>"), + "root" : + _("<p><b>Set Default Root Filesystem</b> +Set global root filesystem for Linux</p>"), + + "clone" : + _("<p><b>Partition for Boot Loader Duplication</b> +specifies other Linux device nodes where the bootinfo should be stored. +If this option is given, the boot partition will be converted to FAT. +The intend of this option is to write the boot files to all members of a RAID1 or RAID5 system.</p>"), + + "activate" : + _("<p><b>Change Boot Device in NV-RAM</b> +this option will tell lilo to update the OpenFirmware \"boot-device\" +variable with the full OpenFirmware path pointing to the device specified in +\"boot=\". If this option is missing, the system may not boot.</p>"), + + "no_os_chooser" : + _("<p><b>Do not Use OS-chooser</b> + will tell lilo to use yaboot as boot file instead of a Forth script named \"os-chooser\". +The OpenFirmware driver in the nVidia graphics card as shipped with Apple G5 systems +will crash if there is no monitor attached.</p>"), + + ]; @@ -50,10 +95,10 @@ "image_root" : _("Root Device"), "image_append" : _("Optional Kernel Command Line Parameter"), "image_initrd" : _("Initial RAM Disk"), - "image_copy" : _("Copy Image to Boot Partition"), - "image_optional" : _("Skip Section gracefully on Errors"), + "copy" : _("Copy Image to Boot Partition"), + "optional" : _("&Skip Section gracefully on Errors"), "type_other" : _("Boot Other System"), - "other_other" : _("Boot Partition of Other System"), + "other" : _("Boot Partition of Other System"), ]; Modified: trunk/bootloader/src/routines/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/Makefile.am?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/routines/Makefile.am (original) +++ trunk/bootloader/src/routines/Makefile.am Thu Apr 2 10:41:25 2009 @@ -19,7 +19,9 @@ dialogs_i386.ycp \ widgets_i386.ycp \ helps_i386.ycp \ - autoinstall.ycp + autoinstall.ycp \ + grub_options.ycp \ + common_options.ycp EXTRA_DIST = \ $(ynclude_DATA) Modified: trunk/bootloader/src/routines/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/dialogs.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/routines/dialogs.ycp (original) +++ trunk/bootloader/src/routines/dialogs.ycp Thu Apr 2 10:41:25 2009 @@ -81,14 +81,13 @@ */ symbol MainDialog () { y2milestone ("Running Main Dialog"); - term contents = `VBox ( "tab", `Right ("adv_button") ); - //F#300779 - Install diskless client (NFS-root) - //kokso: additional warning that root partition is nfs type -> bootloader will not be installed + // F#300779 - Install diskless client (NFS-root) + // kokso: additional warning that root partition is nfs type -> bootloader will not be installed string device = BootCommon::getBootDisk(); if ((device == "/dev/nfs") && (Mode::installation())) @@ -97,12 +96,12 @@ y2milestone("dialogs::MainDialog() -> Boot partition is nfs type, bootloader will not be installed."); return `next; } - - //F#300779: end + // F#300779: end list<string> widget_names = ["tab", "adv_button"]; - map<string,map<string,any> > widget_descr = (map<string,map<string,any> >) - union (CommonGlobalWidgets (), Bootloader::blWidgetMaps ()); + map<string,map<string,any> > widget_descr = $[]; + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), Bootloader::blWidgetMaps ()); + widget_descr["tab"] = CWMTab::CreateWidget($[ "tab_order": ["sections", "installation"], "tabs": TabsDescr (), @@ -152,9 +151,109 @@ * Run dialog for kernel section editation * @return symbol for wizard sequencer */ -symbol KernelSectionDialog () { +symbol CommonKernelSectionDialog () { y2milestone ("Running kernel section dialog"); + string lt = Bootloader::getLoaderType (); + term contents = `HBox (`HSpacing (2), `VBox ( + `VStretch (), + // heading + `Left (`Heading (_("Kernel Section"))), + `VSpacing (1), + "name", + `VStretch (), + // frame + `Frame (_("Section Settings"), `HBox (`HSpacing (2), `VBox ( + `VSpacing (1), + `Left("noverifyroot"), + "image", + "initrd", + `HBox ( + `HWeight (1, "root"), + `HWeight (1, "vgamode") + ), + "append", + `VSpacing (1) + ), `HSpacing (2))), + `VStretch () + ), `HSpacing (2)); + + list<string> widget_names = ["name", "image", "initrd", "root", "vgamode", "append" + ,"noverifyroot"]; + map<string,map<string,any> > widget_descr = $[]; + if (lt != "grub") + widget_descr = (map<string,map<string,any> >) union (CommonSectionWidgets (), Bootloader::blWidgetMaps ()); + else + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), CommonSectionWidgets ()); + + + // dialog caption + string caption = _("Boot Loader Settings: Section Management"); + return CWM::ShowAndRun ($[ + "widget_descr" : widget_descr, + "widget_names" : widget_names, + "contents" : contents, + "caption" : caption, + "back_button" : Label::BackButton (), + "abort_button" : Label::CancelButton (), + "next_button" : Label::OKButton (), + "fallback_functions" : section_handlers, + ]); +} + +/** + * Run dialog for kernel section editation + * @return symbol for wizard sequencer + */ +symbol PpcIseriesKernelSectionDialog () { + y2milestone ("Running kernel section dialog"); + term contents = `HBox (`HSpacing (2), `VBox ( + `VStretch (), + // heading + `Left (`Heading (_("Kernel Section"))), + `VSpacing (1), + "name", + `VStretch (), + // frame + `Frame (_("Section Settings"), `HBox (`HSpacing (2), `VBox ( + `VSpacing (1), + `Left("optional"), + "image", + "initrd", + "root", + "append", + `Left("copy"), + `VSpacing (1) + ), `HSpacing (2))), + `VStretch () + ), `HSpacing (2)); + + list<string> widget_names = ["name", "image", "initrd", "root", "optional", + "append", "copy"]; + + map<string,map<string,any> > widget_descr = $[]; + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), CommonSectionWidgets ()); + + + // dialog caption + string caption = _("Boot Loader Settings: Section Management"); + return CWM::ShowAndRun ($[ + "widget_descr" : widget_descr, + "widget_names" : widget_names, + "contents" : contents, + "caption" : caption, + "back_button" : Label::BackButton (), + "abort_button" : Label::CancelButton (), + "next_button" : Label::OKButton (), + "fallback_functions" : section_handlers, + ]); +} +/** + * Run dialog for kernel section editation + * @return symbol for wizard sequencer + */ +symbol PpcKernelSectionDialog () { + y2milestone ("Running kernel section dialog"); term contents = `HBox (`HSpacing (2), `VBox ( `VStretch (), // heading @@ -165,24 +264,244 @@ // frame `Frame (_("Section Settings"), `HBox (`HSpacing (2), `VBox ( `VSpacing (1), - "kernel", + `Left("optional"), + "image", + "initrd", + "root", + "append", + `VSpacing (1) + ), `HSpacing (2))), + `VStretch () + ), `HSpacing (2)); + + list<string> widget_names = ["name", "image", "initrd", "root", "optional", + "append"]; + + map<string,map<string,any> > widget_descr = $[]; + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), CommonSectionWidgets ()); + + + // dialog caption + string caption = _("Boot Loader Settings: Section Management"); + return CWM::ShowAndRun ($[ + "widget_descr" : widget_descr, + "widget_names" : widget_names, + "contents" : contents, + "caption" : caption, + "back_button" : Label::BackButton (), + "abort_button" : Label::CancelButton (), + "next_button" : Label::OKButton (), + "fallback_functions" : section_handlers, + ]); +} + +symbol ZiplKernelSectionDialog () { + y2milestone ("Running kernel section dialog"); + string lt = Bootloader::getLoaderType (); + term contents = `HBox (`HSpacing (2), `VBox ( + `VStretch (), + // heading + `Left (`Heading (_("Kernel Section"))), + `VSpacing (1), + "name", + `VStretch (), + // frame + `Frame (_("Section Settings"), `HBox (`HSpacing (2), `VBox ( `VSpacing (1), + "target", + "image", "initrd", + "root", + "append", + "parmfile", + `VSpacing (1) + ), `HSpacing (2))), + `VStretch () + ), `HSpacing (2)); + + list<string> widget_names = ["name", "image", "initrd", "root", "append" + ,"parmfile","target"]; + + map<string,map<string,any> > widget_descr = $[]; + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), CommonSectionWidgets ()); + + + // dialog caption + string caption = _("Boot Loader Settings: Section Management"); + return CWM::ShowAndRun ($[ + "widget_descr" : widget_descr, + "widget_names" : widget_names, + "contents" : contents, + "caption" : caption, + "back_button" : Label::BackButton (), + "abort_button" : Label::CancelButton (), + "next_button" : Label::OKButton (), + "fallback_functions" : section_handlers, + ]); +} + +symbol KernelSectionDialog() { + string bootloader = Bootloader::getLoaderType(); + if (bootloader == "zipl"){ + return ZiplKernelSectionDialog(); + } else if (bootloader == "ppc"){ + if (Arch::board_iseries()){ + return PpcIseriesKernelSectionDialog(); + } else { + return PpcKernelSectionDialog(); + } + } else{ + return CommonKernelSectionDialog(); + } +} + +symbol XenSectionDialog () { + y2milestone ("Running kernel section dialog"); + string lt = Bootloader::getLoaderType (); + term contents = `HBox (`HSpacing (2), `VBox ( + `VStretch (), + // heading + `Left (`Heading (_("Xen Section"))), + `VSpacing (1), + "name", + `VStretch (), + // frame + `Frame (_("Section Settings"), `HBox (`HSpacing (2), `VBox ( `VSpacing (1), + "xen", + "image", + "initrd", `HBox ( `HWeight (1, "root"), - `HWeight (1, "vga") + `HWeight (1, "vgamode") ), - `VSpacing (1), "append", + "xen_append", + `VSpacing (1) + ), `HSpacing (2))), + `VStretch () + ), `HSpacing (2)); + + list<string> widget_names = ["name", "image", "initrd", "root", "vgamode", "append" + ,"xen_append","xen"]; + map<string,map<string,any> > widget_descr = $[]; + if (lt != "grub") + widget_descr = (map<string,map<string,any> >) union (CommonSectionWidgets (), Bootloader::blWidgetMaps ()); + else + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), CommonSectionWidgets ()); + // dialog caption + string caption = _("Boot Loader Settings: Section Management"); + return CWM::ShowAndRun ($[ + "widget_descr" : widget_descr, + "widget_names" : widget_names, + "contents" : contents, + "caption" : caption, + "back_button" : Label::BackButton (), + "abort_button" : Label::CancelButton (), + "next_button" : Label::OKButton (), + "fallback_functions" : section_handlers, + ]); +} + +symbol GrubMenuSectionDialog () { + y2milestone ("Running kernel section dialog"); + string lt = Bootloader::getLoaderType (); + term contents = `HBox (`HSpacing (2), `VBox ( + `VStretch (), + // heading + `Left (`Heading (_("Menu Section"))), + `VSpacing (1), + "name", + `VStretch (), + // frame + `Frame (_("Section Settings"), `HBox (`HSpacing (2), `VBox ( + `VSpacing (1), + "root", + "configfile", + `VSpacing (1) + ), `HSpacing (2))), + `VStretch () + ), `HSpacing (2)); + + list<string> widget_names = ["name", "root", "configfile"]; + map<string,map<string,any> > widget_descr = $[]; + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), CommonSectionWidgets ()); + // dialog caption + string caption = _("Boot Loader Settings: Section Management"); + return CWM::ShowAndRun ($[ + "widget_descr" : widget_descr, + "widget_names" : widget_names, + "contents" : contents, + "caption" : caption, + "back_button" : Label::BackButton (), + "abort_button" : Label::CancelButton (), + "next_button" : Label::OKButton (), + "fallback_functions" : section_handlers, + ]); +} + +symbol ZiplMenuSectionDialog () { + y2milestone ("Running kernel section dialog"); + term contents = `HBox (`HSpacing (2), `VBox ( + `VStretch (), + // heading + `Left (`Heading (_("Menu Section"))), + `VSpacing (1), + "name", + `VStretch (), + // frame + `Frame (_("Section Settings"), `HBox (`HSpacing (2), `VBox ( + `VSpacing (1), + "target", + "list", + "default", + "timeout", + `Left("prompt"), + `VSpacing (1) + ), `HSpacing (2))), + `VStretch () + ), `HSpacing (2)); + + list<string> widget_names = ["name", "target", "default","list","timeout","prompt"]; + map<string,map<string,any> > widget_descr = $[]; + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), CommonSectionWidgets ()); + // dialog caption + string caption = _("Boot Loader Settings: Section Management"); + return CWM::ShowAndRun ($[ + "widget_descr" : widget_descr, + "widget_names" : widget_names, + "contents" : contents, + "caption" : caption, + "back_button" : Label::BackButton (), + "abort_button" : Label::CancelButton (), + "next_button" : Label::OKButton (), + "fallback_functions" : section_handlers, + ]); +} + +symbol DumpSectionDialog () { + y2milestone ("Running kernel section dialog"); + term contents = `HBox (`HSpacing (2), `VBox ( + `VStretch (), + // heading + `Left (`Heading (_("Dump Section"))), + `VSpacing (1), + "name", + `VStretch (), + // frame + `Frame (_("Section Settings"), `HBox (`HSpacing (2), `VBox ( + `VSpacing (1), + "target", + "dumpto", + "dumptofs", `VSpacing (1) ), `HSpacing (2))), `VStretch () ), `HSpacing (2)); - list<string> widget_names = ["name", "kernel", "initrd", "root", "vga", "append"]; - map<string,map<string,any> > widget_descr = (map<string,map<string,any> >) - union (CommonSectionWidgets (), Bootloader::blWidgetMaps ()); + list<string> widget_names = ["name", "target", "dumpto","dumptofs"]; + map<string,map<string,any> > widget_descr = $[]; + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), CommonSectionWidgets ()); // dialog caption string caption = _("Boot Loader Settings: Section Management"); return CWM::ShowAndRun ($[ @@ -191,19 +510,67 @@ "contents" : contents, "caption" : caption, "back_button" : Label::BackButton (), - "abort_button" : (!Mode::installation()) ? Label::AbortButton () : Label::CancelButton (), + "abort_button" : Label::CancelButton (), "next_button" : Label::OKButton (), "fallback_functions" : section_handlers, ]); } +symbol MenuSectionDialog() { + string bootloader = Bootloader::getLoaderType(); + if (bootloader == "grub"){ + return GrubMenuSectionDialog(); + } else if (bootloader == "zipl"){ + return ZiplMenuSectionDialog(); + } +} + +symbol PPCChainloaderSectionDialog () { + y2milestone ("Running chainloader section dialog"); + string lt = Bootloader::getLoaderType (); + term contents = `HBox (`HSpacing (4), `VBox ( + // label + `Left (`Heading (_("Other System Section"))), + `VSpacing (2), + "name", + `VStretch (), + // part two - section settings + `HBox ( + // frame + `Frame (_("Section Settings"), `HBox (`HSpacing (2), `VBox ( + `VSpacing (2), + `Left("other"), + `VSpacing (2) + ), `HSpacing (2)))), + `VStretch () + ), `HSpacing (4)); + + list<string> widget_names = ["name", "other"]; + map<string,map<string,any> > widget_descr = $[]; + + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), CommonSectionWidgets ()); + + + // dialog caption + string caption = _("Boot Loader Settings: Section Management"); + return CWM::ShowAndRun ($[ + "widget_descr" : widget_descr, + "widget_names" : widget_names, + "contents" : contents, + "caption" : caption, + "back_button" : Label::BackButton (), + "abort_button" : Label::CancelButton (), + "next_button" : Label::OKButton (), + "fallback_functions" : section_handlers, + ]); +} /** * Run dialog for kernel section editation * @return symbol for wizard sequencer */ -symbol ChainloaderSectionDialog () { +symbol CommonChainloaderSectionDialog () { y2milestone ("Running chainloader section dialog"); - + string lt = Bootloader::getLoaderType (); term contents = `HBox (`HSpacing (4), `VBox ( // label `Left (`Heading (_("Other System Section"))), @@ -215,19 +582,26 @@ // frame `Frame (_("Section Settings"), `HBox (`HSpacing (2), `VBox ( `VSpacing (2), - `HBox ( - `HSpacing (4), - "chainloader", - `HSpacing (4) - ), + `Left("chainloader"), + `Left("makeactive"), + `Left("noverifyroot"), + `Left("remap"), + `Left(`HSquash("blockoffset")), `VSpacing (2) ), `HSpacing (2)))), `VStretch () ), `HSpacing (4)); - list<string> widget_names = ["name", "chainloader"]; - map<string,map<string,any> > widget_descr = (map<string,map<string,any> >) - union (CommonSectionWidgets (), Bootloader::blWidgetMaps ()); + list<string> widget_names = ["name", "chainloader", "makeactive", + "noverifyroot", "remap", "blockoffset"]; + map<string,map<string,any> > widget_descr = $[]; + + if (lt != "grub") + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), Bootloader::blWidgetMaps ()); + else + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), CommonSectionWidgets ()); + + // dialog caption string caption = _("Boot Loader Settings: Section Management"); return CWM::ShowAndRun ($[ @@ -236,19 +610,27 @@ "contents" : contents, "caption" : caption, "back_button" : Label::BackButton (), - "abort_button" : (!Mode::installation()) ? Label::AbortButton () : Label::CancelButton (), + "abort_button" : Label::CancelButton (), "next_button" : Label::OKButton (), "fallback_functions" : section_handlers, ]); } +symbol ChainloaderSectionDialog () { + if ( Bootloader::getLoaderType() == "ppc" ){ + return PPCChainloaderSectionDialog(); + } else { + return CommonChainloaderSectionDialog(); + } +} + /** * Run dialog for kernel section editation * @return symbol for wizard sequencer */ symbol AddNewSectionDialog () { y2milestone ("Running new section dialog"); - + string lt = Bootloader::getLoaderType (); term contents = `HBox (`HStretch (), `VBox ( `VStretch (), "section_type", @@ -256,8 +638,12 @@ ), `HStretch ()); list<string> widget_names = ["section_type"]; - map<string,map<string,any> > widget_descr = (map<string,map<string,any> >) - union (CommonSectionWidgets (), Bootloader::blWidgetMaps ()); + map<string,map<string,any> > widget_descr = $[]; + if (lt == "ppc" ) + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), Bootloader::blWidgetMaps ()); + else + widget_descr = (map<string,map<string,any> >) union (CommonGlobalWidgets (), CommonSectionWidgets ()); + // dialog caption string caption = _("Boot Loader Settings: Section Management"); return CWM::ShowAndRun ($[ @@ -266,8 +652,8 @@ "contents" : contents, "caption" : caption, "back_button" : Label::BackButton (), - "abort_button" : (!Mode::installation()) ? Label::AbortButton () : Label::CancelButton (), - "next_button" : (!Mode::installation()) ? Label::NextButton () : Label::OKButton (), + "abort_button" : Label::CancelButton (), + "next_button" : Label::NextButton (), ]); } @@ -277,9 +663,16 @@ */ symbol EditSectionSwitch () { string type = BootCommon::current_section["type"]:""; - if (type == "chainloader") + if (type == "chainloader" || type == "other") return `chainloader; - + if (type == "xen") + return `xen; + if (type == "menu") + return `menus; + if (type == "dump") + return `dump; + if (type == "image") + return `kernel; else return `kernel; } Modified: trunk/bootloader/src/routines/dialogs_i386.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/dialogs_i386.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/routines/dialogs_i386.ycp (original) +++ trunk/bootloader/src/routines/dialogs_i386.ycp Thu Apr 2 10:41:25 2009 @@ -28,6 +28,9 @@ include "bootloader/routines/helps_i386.ycp"; include "bootloader/routines/widgets_i386.ycp"; +include "bootloader/routines/grub_options.ycp"; + + /** @@ -35,194 +38,21 @@ * @return symbol for wizard sequencer */ symbol i386InstallDetailsDialog () { - term contents = `HBox (`HStretch (), `VBox ( - `VStretch (), - // frame - `Frame (_("Disk Order"), - `HBox (`HSpacing (2), `VBox ( - `VSpacing (1), - `SelectionBox (`id (`disks), - `opt (`notify, `immediate), - // selectionn box label - _("D&isks"), []), - Mode::config () - ? `HBox ( - `HStretch (), - `PushButton (`id (`add), `opt (`key_F3), Label::AddButton ()), - `PushButton (`id (`delete), `opt(`key_F5), Label::DeleteButton ()), - `HStretch () - ) - : `HBox (), - `VSpacing (1) - ), - `HSquash ( - `VBox ( - `VStretch (), - `PushButton (`id (`up), `opt (`hstretch), _("&Up")), - `PushButton (`id (`down), `opt (`hstretch), _("&Down")), - `VStretch () - ) - ), - `HSpacing (2) - ) - ), - `VStretch (), - // frame - `Frame (_("Disk System Area Update"), `HBox (`HSpacing (2), `VBox ( - `VSpacing (1), - `Left (`CheckBox (`id (`repl_mbr), - // check box - _("R&eplace MBR with Generic Code"))), - `Left (`CheckBox (`id (`activate), - // check box - _("&Activate Boot Loader Partition"))), - BootCommon::getLoaderType (false) == "grub" - && BootCommon::allowEmbed15 () - ? `Left (`CheckBox (`id (`embed), - // check box - _("U&se Dedicated Boot Loader Area"))) - : `VBox (), - `VSpacing (1) - ), `HSpacing (2))), - `VStretch () - ), `HStretch ()); - - Wizard::SetContentsButtons ( - // dialog caption - _("Boot Loader Installation Details"), - contents, - i386InstallDetailsHelp (), - Label::BackButton (), - Label::OKButton ()); - - list<string> disks_order = BootCommon::DisksOrder (); - - UI::ChangeWidget (`id (`disks), `Items, disks_order); - UI::ChangeWidget (`id (`disks), `CurrentItem, disks_order[0]:""); - UI::ChangeWidget (`id (`repl_mbr), `Value, BootCommon::repl_mbr); - UI::ChangeWidget (`id (`activate), `Value, BootCommon::activate); - if (UI::WidgetExists (`id (`embed))) - UI::ChangeWidget (`id (`embed), `Value, BootCommon::embed_stage15); - boolean save_embed = BootCommon::embed_stage15; - - any ret = nil; - while (ret == nil) - { - string current = (string)UI::QueryWidget (`id (`disks), `CurrentItem); - integer pos = 0; - while (pos < size (disks_order) && disks_order[pos]:"" != current) - pos = pos + 1; - UI::ChangeWidget (`id (`up), `Enabled, - pos > 0 && pos < size (disks_order)); - UI::ChangeWidget (`id (`down), `Enabled, pos < size (disks_order) - 1); - - ret = UI::UserInput (); - boolean order_changed = false; - - if (ret == `add) - { - term popup = `VBox (`VSpacing (1), - // textentry header - `InputField (`id (`devname), `opt (`hstretch), _("&Device")), - `VSpacing (1), - `HBox (`HStretch (), - `PushButton (`id (`ok), `opt (`key_F10, `default), - Label::OKButton ()), - `HStretch (), - `PushButton (`id (`cancel), `opt (`key_F8), - Label::CancelButton ()), - `HStretch () - ), - `VSpacing (1) - ); - UI::OpenDialog (popup); - symbol pushed = (symbol)UI::UserInput (); - string new_dev = (string) - UI::QueryWidget (`id (`devname), `Value); - UI::CloseDialog (); - if (pushed == `ok) - { - disks_order = add (disks_order, new_dev); - order_changed = true; - current = new_dev; - } - } - else if (ret == `delete) - { - disks_order = filter (string d, disks_order, { - return d != current; - }); - order_changed = true; - current = disks_order[0]:nil; - } - else if (ret == `up) - { - disks_order = (list<string>) - BootCommon::swapItems (disks_order, pos, pos - 1); - order_changed = true; - } - else if (ret == `down) - { - disks_order = (list<string>) - BootCommon::swapItems (disks_order, pos, pos + 1); - order_changed = true; - } - - if (ret == `cancel) - ret = `abort; - if (ret != `next && ret != `abort && ret != `back) - { - if (order_changed) - { - UI::ChangeWidget (`id (`disks), `Items, disks_order); - UI::ChangeWidget (`id (`disks), `CurrentItem, current); - } - ret = nil; - } - } - if (ret == `next) - { - integer index = 0; - BootCommon::device_mapping = filter (string k, string v, - BootCommon::device_mapping, - { - return substring (v, 0, 2) != "hd"; - }); - BootCommon::mbrDisk = disks_order[0]:""; - BootCommon::device_mapping = (map<string,string>)union ( - BootCommon::device_mapping, - listmap (string d, disks_order, { - string hex_index = substring (tohexstring (index), 2); - index = index + 1; - return $[ d : sformat ("hd%1", hex_index) ]; - }) - ); - BootCommon::repl_mbr = (boolean) - UI::QueryWidget (`id (`repl_mbr), `Value); - if (BootCommon::activate != (boolean) - UI::QueryWidget (`id (`activate), `Value)) - { - BootCommon::activate_changed = true; - } - BootCommon::activate = (boolean) - UI::QueryWidget (`id (`activate), `Value); - if (UI::WidgetExists (`id (`embed))) - { - BootCommon::embed_stage15 = (boolean) - UI::QueryWidget (`id (`embed), `Value); - } - if (BootCommon::repl_mbr) - { - if (Stage::initial ()) - Pkg::PkgInstall ("master-boot-code"); - BootCommon::location_changed = true; - } - if (BootCommon::activate || BootCommon::embed_stage15 != save_embed) - { - BootCommon::location_changed = true; - } - } - return (symbol)ret; + term contents = `HBox (`HStretch (), `VBox ( + `VStretch(), + `Frame (_("Disk Order"),"disks_order"), + `VStretch()), + `HStretch()); + + return CWM::ShowAndRun ($[ + "widget_descr": $[ "disks_order": DisksOrderWidget()], + "widget_names": ["disks_order"], + "contents": contents, + "caption" : _("Disk order settings"), + "back_button" : Label::BackButton (), + "abort_button" : Label::CancelButton (), + "next_button" : Label::OKButton () + ]); } /** @@ -232,28 +62,42 @@ symbol i386LoaderDetailsDialog () { y2milestone ("Running i386 loader details dialog"); - term contents = `HBox (`HSpacing (2), `VBox ( + term contents = `HBox (`HSpacing (2),`VBox ( `VStretch (), - "boot_menu", - `VStretch (), - "password", + `Frame (_("Boot Menu"), + `HBox( + `HSpacing(2), + `VBox( + `Left("activate"), + `Left("debug"), + `Left("generic_mbr"), + `Left("trusted_grub"), + `Left("hiddenmenu"), + `Left("gfxmenu"), + `Left(`HSquash("timeout")) + ), + `HStretch() + ) + ), + `VSpacing(1), + `Left("password"), + `VSpacing(1), + `Left("console"), `VStretch () - ), `HSpacing (2)); + ), + `HSpacing (2)); - list<string> widget_names = ["boot_menu", "password"]; - map<string,map<string,any> > widget_descr = (map<string,map<string,any> >) - i386Widgets (); - // dialog caption + list<string> widget_names = ["activate","debug","generic_mbr", + "trusted_grub","hiddenmenu","gfxmenu","timeout", "console","password"]; string caption = _("Boot Loader Options"); return CWM::ShowAndRun ($[ - "widget_descr" : widget_descr, + "widget_descr" : GrubOptions(), "widget_names" : widget_names, "contents" : contents, "caption" : caption, "back_button" : Label::BackButton (), - "abort_button" : Label::AbortButton (), + "abort_button" : Label::CancelButton (), "next_button" : Label::OKButton (), -// "fallback_functions" : section_handlers, ]); } Modified: trunk/bootloader/src/routines/global_widgets.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/global_widgets.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/routines/global_widgets.ycp (original) +++ trunk/bootloader/src/routines/global_widgets.ycp Thu Apr 2 10:41:25 2009 @@ -106,32 +106,55 @@ * @param sects list of current sections */ void RedrawSectionsTable (list<map<string,any> > sects) { - boolean elilo = Bootloader::getLoaderType () == "elilo"; list sec = maplist (map<string,any> s, sects, { - string image = s["kernel"]:""; - string root = (BootCommon::getHintedPartitionList ([s["root"]:""]))[0]:""; - + string info = ""; + + string type = _("Other"); + if (s["type"]:"" == "image") + { + type = _("Image"); + string image = s["image"]:""; + string root = (BootCommon::getHintedPartitionList ([s["root"]:""]))[0]:""; + boolean elilo = Bootloader::getLoaderType () == "elilo"; + info = (image != "" && image != nil) ? sformat ("%1 (%2%3)", + image, elilo ? "" : BootCommon::splitPath (image)[0]:"", + root == "" ? "": ((elilo ? "" : ", ")+ sformat ("root=%1", root))):""; + } + else if (s["type"]:"" == "xen"){ + type = _("Xen"); + string image = s["image"]:""; + string root = (BootCommon::getHintedPartitionList ([s["root"]:""]))[0]:""; + boolean elilo = Bootloader::getLoaderType () == "elilo"; + info = (image != "" && image != nil) ? sformat ("%1 (%2%3)", + image, elilo ? "" : BootCommon::splitPath (image)[0]:"", + root == "" ? "": ((elilo ? "" : ", ")+ sformat ("root=%1", root))):""; + } + else if (s["type"]:"" == "floppy"){ + type = _("Floppy"); + } + else if (s["type"]:"" == "menu"){ + type = _("Menu"); + if (Bootloader::getLoaderType () == "grub"){ + string paths = s["configfile"]:""; + string root = s["root"]:""; + info = sformat ("dev=%1 path=%2", root, paths); + } else if (Bootloader::getLoaderType () == "zipl"){ + info = s["list"]:""; + } + } + else if (s["type"]:"" == "dump"){ + type = _("Dump"); + info = s["dumpto"]:(s["dumptofs"]:""); + } else if (s["type"]:"" == "other"){ + info = s["chainloader"]:""; + } return `item (`id (s["name"]:""), - // FIXME: do not match against key "name" (can be changed by user when editing section) tolower (BootCommon::globals["default"]:"") == tolower (s["name"]:"") ? UI::Glyph (`CheckMark) : "", s["name"]:"", - (image == nil || image == "") - // table header - ? _("Other") - // table header - : _("Image"), - (image != "" && image != nil) - ? sformat ("%1 (%2%3)", - image, - elilo - ? "" - : BootCommon::splitPath (image)[0]:"", - root == "" ? "" - : ((elilo ? "" : ", ") - + sformat ("root=%1", root))) - : s["chainloader"]:"" + type, + info ); }); UI::ChangeWidget (`id (`sects), `Items, sec); @@ -452,6 +475,19 @@ else if (action == `prev) Bootloader::Import (BootCommon::other_bl[new_bl]:$[]); + else if (action == `convert) + { + //filter out uknown type of section e.g. chainloader for elilo etc. + BootCommon::sections = (list <map<string,any> >)filter(map<string, any> sec, BootCommon::sections, { + list<string> section_types = Bootloader::blsection_types(); + if (contains(section_types, sec["type"]:"" )) + return true; + else + return false; + }); + + } + } BootCommon::location_changed = true; BootCommon::changed = true; @@ -500,228 +536,6 @@ } } -// loader target widget - -/** - * Get the target widget to be displayed - * @return term widget to be displayed - */ -term TargetWidget () { - string lt = Bootloader::getLoaderType (); - if (lt == "none" || lt == "default") - { - return `Empty (); - } - list<string> boot_devices = BootCommon::getPartitionList(`boot); - boolean allow_boot = contains (boot_devices, - BootCommon::BootPartitionDevice); - boolean allow_root = contains (boot_devices, - BootCommon::RootPartitionDevice); - boolean all_mbr = size (BootCommon::Md2Partitions ( - BootCommon::BootPartitionDevice)) > 1; - - term targetlist = `VBox ( - `VSpacing (0.4), - `Left (`RadioButton (`id ("mbr"), `opt (`notify), - BootCommon::mbrDisk == "" - // radio button - ? _("&Master Boot Record") - // radiobutton, %1 is device (eg. /dev/hda) - : sformat(_("&Master Boot Record of %1"), - BootCommon::mbrDisk), - (BootCommon::selected_location == "mbr") - )) - ); - - if (all_mbr && Bootloader::getLoaderType () == "grub") - { - list<string> mbrs = maplist (string d, integer id, - BootCommon::Md2Partitions (BootCommon::BootPartitionDevice), - { - map p_dev = Storage::GetDiskPartition (d); - return p_dev["disk"]:""; - }); - mbrs = toset (mbrs); - targetlist = add (targetlist, `VSpacing (0.4)); - targetlist = add (targetlist, `Left ( - `RadioButton (`id ("mbr_md"), `opt (`notify), - // radiobutton, %1 is a list of devices (eg. /dev/hda1) - sformat(_("MB&Rs of Disks %1"), - mergestring (mbrs, ", ")), - (BootCommon::selected_location == "mbr_md") - ))); - } - if (allow_boot) - { - targetlist = add (targetlist, `VSpacing (0.4)); - targetlist = add (targetlist, `Left ( - `RadioButton (`id ("boot"), `opt (`notify), - // radiobutton, %1 is device (eg. /dev/hda1) - sformat(_("Boot &Sector of Boot Partition %1"), - BootCommon::BootPartitionDevice), - (BootCommon::selected_location == "boot") - ))); - }; - if (allow_root - && BootCommon::BootPartitionDevice != BootCommon::RootPartitionDevice) - { - targetlist = add (targetlist, `VSpacing (0.4)); - targetlist = add (targetlist, `Left ( - `RadioButton (`id ("root"), `opt (`notify), - // radiobutton, %1 is device (eg. /dev/hda1) - sformat(_("Boot Sector of Roo&t Partition %1"), - BootCommon::RootPartitionDevice), - (BootCommon::selected_location == "root") - ))); - }; - - if (StorageDevices::FloppyPresent()) - { - targetlist = add (targetlist, `VSpacing (1)); - targetlist = add (targetlist, `Left (`RadioButton (`id ("floppy"), - `opt (`notify), - // radiobutton, %1 is device name, typically /dev/fd0 - sformat (_("&Floppy Disk %1"), StorageDevices::FloppyDevice()), - (BootCommon::selected_location == "floppy") - ))); - } - - targetlist = add (targetlist, `HBox ( - `VBox (`Label (""), `RadioButton (`id ("custom"), `opt (`notify), - // radiobutton - _("Ot&her"), - (BootCommon::selected_location == "custom"))), - `HSpacing (2), - `VBox ( - `ComboBox (`id (`loc), `opt (`editable, `hstretch, `notify, `notify, `immediate), "", - boot_devices), - `HSpacing (15) - ), - `HStretch () - )); - - targetlist = add (targetlist, `VSpacing (0.4)); - - // frame - term widget = `Frame (_("Boot Loader Location"), - `RadioButtonGroup (`id (`location), - targetlist - ) - ); - return widget; -} - -/** - * Init function of a widget - * @param widget string widget key - */ -void TargetInit (string widget) { - string lt = Bootloader::getLoaderType (); - if (lt == "none" || lt == "default") - { - return; - } - if (BootCommon::BootPartitionDevice == BootCommon::RootPartitionDevice - && BootCommon::selected_location == "root") - { - BootCommon::selected_location = "boot"; - } - if (BootCommon::loader_device != "mbr_md") - UI::ChangeWidget (`id (`loc), `Value, BootCommon::loader_device == "mbr_md" - ? BootCommon::getPartitionList(`boot)[0]:"" - : BootCommon::loader_device); - UI::ChangeWidget (`id (`location), `CurrentButton, - BootCommon::selected_location); - UI::SetFocus (`id (`loc)); -} - -symbol TargetHandle (string widget, map event) { - UI::ChangeWidget (`id (`location), `CurrentButton, "custom"); - return nil; -} - -/** - * Store function of a widget - * @param widget string widget key - * @param event map event that caused the operation - */ -void TargetStore (string widget, map event) { - string lt = Bootloader::getLoaderType (); - if (lt == "none" || lt == "default") - { - return; - } - BootCommon::selected_location = (string) - UI::QueryWidget (`id (`location), `CurrentButton); - BootCommon::loader_device = (string)UI::QueryWidget (`id (`loc), `Value); - BootCommon::loader_device = BootCommon::GetBootloaderDevice (); - BootCommon::location_changed = true; - BootCommon::changed = true; -} - -/** - * Validate function of a widget - * @param widget string widget key - * @param event map event that caused validation - * @return boolean true if validation succeeded - */ -boolean TargetValidate (string widget, map event){ - string lt = Bootloader::getLoaderType (); - if (lt == "none" || lt == "default") - { - return true; - } - string rb = (string)UI::QueryWidget (`id (`location), `CurrentButton); - if (rb == nil) - { - setLocationErrorPopup (); - UI::SetFocus (`id (`location)); - return false; - } - if (rb == "custom" && UI::QueryWidget (`id (`loc), `Value) == "") - { - setLocationErrorPopup (); - UI::SetFocus (`id (`loc)); - return false; - } - if (rb == "custom") - { - boolean ok = true; - string ld = (string)UI::QueryWidget (`id (`loc), `Value); - map<string,map> tm = Storage::GetTargetMap (); - foreach (string disk_dev, map disk, tm, { - list<map<string,any> > partitions - = (list<map<string,any> >) disk["partitions"]:[]; - foreach (map<string,any> p, partitions, { - if (! p["delete"]:false) - { - symbol fs = (symbol)(p["used_fs"]:p["detected_fs"]:nil); - // FIXME this checking is performed on 3 places - if (p["device"]:"" == ld && fs == `xfs) - { - // yes-no popup - if (! Popup::YesNo (_("The partition selected for boot loader installation -does not have enough free space in its boot sector -to hold the boot loader because of the file system -it contains. Using this partition for the boot loader -may lead to corruption of data on the partition. - -Continue?"))) - { - UI::SetFocus (`id (`loc)); - ok = false; - } - } - } - }); - }); - if (! ok) - return false; - } - return true; -} - - // manual edit button /** @@ -904,39 +718,6 @@ ]; } - - -/** - * Function for disable back button - * @param string key - */ - -void BackButton (string key) { - if (Mode::installation()) - UI::ChangeWidget(`id(`back), `Enabled, false); -} - - -/** - * Init function where are added UI hadle functions - * special hack widget where is handlig disable back button - * - * @return map<string,any> map for start-stop widget - */ - -map<string,any> DisBackButton () { - map<string,any> result = $[]; - - result["widget"] = `custom; - result["custom_widget"] =`Empty(); - result["init"] = BackButton; - result["help"] = " "; - - return result; -} - - - /** * Get the main dialog tabs description * @return a map the description of the tabs @@ -969,26 +750,27 @@ `HStretch (), `VBox ( `Label (""), - "loader_options" + (lt == "none" || lt == "default" || lt == "zipl" || lt == "lilo") + ? `Empty() : "loader_options" ), `HSpacing (2) ), `VSpacing (0.4) )), `VStretch (), - (lt == "none" || lt == "default") + (lt == "none" || lt == "default" || lt == "zipl" || lt == "lilo") ? `Empty () : "loader_location", `VStretch (), - (lt == "none" || lt == "default") + (lt != "grub") ? `Empty () : "inst_details", `VStretch () ), `HStretch ()), - "widget_names": (lt == "none" || lt == "default") - ? [ "loader_type", "loader_options", "DisBackButton"] + "widget_names": (lt == "none" || lt == "default" || lt=="zipl") + ? [ "loader_type", "loader_options"] : [ "loader_type", "loader_options", "loader_location", - "inst_details", "DisBackButton" ] + "inst_details"] ], ]; }; @@ -1026,17 +808,8 @@ "handle" : LoaderOptionsButtonHandle, "help" : LoaderOptionsHelp (), ], - "loader_location" : $[ - "widget" : `func, - "widget_func" : TargetWidget, - "init" : TargetInit, - "handle" : TargetHandle, - "handle_events" : [ `loc ], - "store" : TargetStore, - "help" : LocationsHelp (), - "validate_type" : `function, - "validate_function" : TargetValidate, - ], + //FIXME: after deleting all using of metadata delete widget from + // from CommonGlobalWidgets the button is only for GRUB... "inst_details" : $[ "widget" : `push_button, // push button @@ -1046,7 +819,6 @@ "help" : InstDetailsHelp (), ], - "DisBackButton" : DisBackButton(), ]; Modified: trunk/bootloader/src/routines/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/helps.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/routines/helps.ycp (original) +++ trunk/bootloader/src/routines/helps.ycp Thu Apr 2 10:41:25 2009 @@ -163,7 +163,7 @@ */ string InstDetailsHelp () { // help text 1/1 - return _("<p><big><b>Boot Loader Installation Details</b></big><br> + return _("<p><b>Boot Loader Installation Details</b><br> To adjust advanced boot loader installation options (such as the device mapping), click <b>Boot Loader Installation Details</b>.</p>"); } @@ -174,7 +174,7 @@ */ string LoaderTypeHelp () { // help text 1/1 - return _("<p><big><b>Boot Loader Type</b></big><br> + return _("<p><b>Boot Loader Type</b><br> To select whether to install a boot loader and which bootloader to install, use <b>Boot Loader</b>.</p>"); } @@ -186,7 +186,7 @@ */ string LoaderOptionsHelp () { // help text 1/1 - return _("<p><big><b>Boot Loader Options</b></big><br> + return _("<p><b>Boot Loader Options</b><br> To adjust options of the boot loader, such as the time-out, click <b>Boot Loader Options</b>.</p>"); } @@ -208,7 +208,7 @@ */ string SectionNameHelp () { // help text 1/1 - return _("<p><b><big>Section Name</big></b><br> + return _("<p><b>Section Name</b><br> Use <b>Section Name</b> to specify the boot loader section name. The section name must be unique.</p>"); } @@ -217,73 +217,6 @@ * Get help text * @return string help text */ -string KernelHelp () { - // help text 1/1 - return _("<p><big><b>Kernel</b></big><br> -Use <b>Kernel</b> to specify the kernel image to load.</p>"); -} - -/** - * Get help text - * @return string help text - */ -string InitrdHelp () { - // help text 1/1 - return _("<p><big><b>Initial RAM Disk</b></big><br> -Use <b>Initial RAM Disk</b> to specify the initial RAM disk (initrd) to load. If it is -left empty, no initial RAM disk is loaded during boot.</p>"); -} - -/** - * Get help text - * @return string help text - */ -string RootDeviceHelp () { - // help text 1/1 - return _("<p><big><b>Root Device<b></big><br> -Use <b>Root Device</b> to specify the root file system to mount after the kernel is -loaded.</p> -"); -} - -/** - * Get help text - * @return string help text - */ -string VgaModeHelp () { - // help text 1/1 - return _("<p><big><b>VGA Mode</b></big><br> -Use <b>VGA Mode</b> to specify the resolution and color depth to set after -the kernel has booted.</p>"); -} - -/** - * Get help text - * @return string help text - */ -string AppendHelp () { - // help text 1/1 - return _("<p><big><b>Other Kernel Parameters</b></big><br> -Use <b>Other Kernel Parameters</b> to set other parameters to append -to the kernel command line.</p>"); -} - -/** - * Get help text - * @return string help text - */ -string ChainloaderHelp () { - // help text 1/1 - return _("<p><big><b>Device</b></big><br> -Use <b>Device</b> to set the device from which to load the operating system. -In most cases, it is the disk partition in which -the other system is installed.</p>"); -} - -/** - * Get help text - * @return string help text - */ string SectionTypeHelp () { // help text 1/5 return _("<p><big><b>Type of the New Section</b></big><br> @@ -304,17 +237,4 @@ booting other operating systems.</p>"); } - -/** - * Get help text - * @return string help text - */ -string TrustedGrubHelp () { - // help text 1/1 - return _("<p><b>Trusted GRUB Details</b><br> -allows to add aditional measured files and also to define own PCR for kernel, initrd or chainloader</p>"); -} - - - } // EOF Modified: trunk/bootloader/src/routines/helps_i386.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/helps_i386.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/routines/helps_i386.ycp (original) +++ trunk/bootloader/src/routines/helps_i386.ycp Thu Apr 2 10:41:25 2009 @@ -28,74 +28,7 @@ return _("<p><big><b>Disks Order</b></big><br> To specify the order of the disks according to the order in BIOS, use the <b>Up</b> and <b>Down</b> buttons to reorder the disks.</p>") - + (Mode::config () - // help text 2/5, optional (only for autoinstallation) - ? _("<p>To add a disk, push <b>Add</b>. - To remove a disk, push <b>Remove</b>.</p>") - : "") - // help text 3/5 - + _("<p><big><b>Replacing MBR With Generic Code</b></big><br> -To replace the master boot record of your disk with generic code (which -boots the active partition), set <b>Replace MBR with Generic Code</b>.</p>") - // help text 4/5 - + _("<p><big><b>Activating Bootloader Partition</b></big><br> -To activate the partition which contains the boot loader, set -<b>Activate Bootloader Partition</b>. The generic MBR code boots -the active partition. Older BIOSes require one partition active even -if boot loader is installed in MBR.</p>") - + (BootCommon::getLoaderType (false) == "grub" - && BootCommon::allowEmbed15 () - // help text 4/5 - ? _("<p><big><b>Dedicated Boot Loader Area</b></big><br> -Using the dedicated boot loader area prevents -boot loader files from being moved during -automatic disk defragmentation. The movement could prevent the -boot loader from loading. -To use dedicated boot loader area, set <b>Use Dedicated Boot Loader -Area</b>.</p>") - : ""); + + _("<p>To add a disk, push <b>Add</b>. + To remove a disk, push <b>Remove</b>.</p>"); } - -string i386DeviceMapEditHelp () -{ - // help text 1/5 - return _("<p><big><b>Disks Order</b></big><br> -To specify the order of the disks according to the order in BIOS, use -the <b>Up</b> and <b>Down</b> buttons to reorder the disks.</p>") - + (Mode::config () - // help text 2/5, optional (only for autoinstallation) - ? _("<p>To add a disk, push <b>Add</b>. - To remove a disk, push <b>Remove</b>.</p>") - : ""); -} - - -/** - * Get help - * @return string help text - */ -string i386PasswdHelp () { - // help text 1/1 - return _("<p><big><b>Password Protection</b></big><br> -To protect the boot loader using a password, -set <b>Protect Boot Loader with Password</b> and set the <b>Password</b> -and <b>Retype Password</b>.</p> -"); -} - -/** - * Get help - * @return string help text - */ -string i386BootMenuHelp () { - // help text 1/1 - return _("<p><big><b>Boot Menu</b></big><br> -To show the boot loader menu during the boot process, set -<b>Show Boot Menu</b>. Otherwise the boot loader menu will be hidden. -To specify the time-out after which the default -kernel is loaded, set <b>Continue Booting after a Time-Out</b> and -<b>Boot Menu Time-Out</b>.</p>"); -} - - } //EOF Modified: trunk/bootloader/src/routines/lib_iface.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/lib_iface.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/routines/lib_iface.ycp (original) +++ trunk/bootloader/src/routines/lib_iface.ycp Thu Apr 2 10:41:25 2009 @@ -44,7 +44,6 @@ */ global boolean DefineMultipath(map<string,string> multipath_map); - boolean checkCallingDiskInfo () { boolean ret = false; @@ -417,7 +416,6 @@ return ret; } - /** * Initialize the boot loader (eg. modify firmware, depending on architecture) * @return boolean true on success Modified: trunk/bootloader/src/routines/lilolike.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/lilolike.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/routines/lilolike.ycp (original) +++ trunk/bootloader/src/routines/lilolike.ycp Thu Apr 2 10:41:25 2009 @@ -35,44 +35,6 @@ include "bootloader/routines/i386.ycp"; /** - * Is embedding 1.5 stage of bootloader to dedicated partition area possible? - * @return true if it is possible - */ -// FIXME: remove this function, it is obsolete (now handled within grub by -// using "setup" instead of "install") -// The code probably does not work with multiple bootloader locations anyway. -// Keeping this temporarily until no other code references it anymore (so that -// for now, the code compiles). This is only used from widget code, and that -// code is probably obsolete as well. -// This code previously existed in lilolike.ycp and in grub/misc.ycp... -global boolean allowEmbed15 () { - // allow only if /boot, /root or MBR device selected - // (corrected anyway to use boot_* keys; only grub knows about embed_1.5) - if (! (BootCommon::globals["boot_boot"]:"false" == "true" - || BootCommon::globals["boot_root"]:"false" == "true" - || BootCommon::globals["boot_mbr"]:"false" == "true" - )) - { - return false; - } - // check filesystem on /boot for Reiserfs and JFS - map mp = Storage::GetMountPoints (); - list bp_info - = mp["/boot"]:mp["/"]:[]; - list<map> partitions - = Storage::GetTargetMap ()[bp_info[2]:"", "partitions"]:[]; - boolean ret = false; - foreach (map p, partitions, { - if (p["device"]:"" == BootCommon::BootPartitionDevice) - { - symbol fs = (symbol)p["used_fs"]:nil; - if (fs == `reiser || fs == `jfs) - ret = true; - } - }); - return ret; -} -/** * Check whether disk settings were changed since last checking * @return boolean true if needs to recheck */ Modified: trunk/bootloader/src/routines/misc.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/misc.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/routines/misc.ycp (original) +++ trunk/bootloader/src/routines/misc.ycp Thu Apr 2 10:41:25 2009 @@ -788,10 +788,18 @@ */ global define list<string> getPartitionList(symbol type) ``{ y2milestone ("getPartitionList: %1", type); + string bl = getLoaderType(false); map<string,map> devices = (map<string,map>)Storage::GetTargetMap(); list<map> partitions = []; foreach (string k, map v, devices, ``{ - partitions = (list<map>)merge (partitions, (list<map>)(v["partitions"]:[])); + if ((type == `boot) && (bl == "grub")) + { + // check if device is in device map + if (haskey(device_mapping, k) || (haskey(device_mapping, Dev2MountByDev(k)))) + partitions = (list<map>)merge (partitions, (list<map>)(v["partitions"]:[])); + } else { + partitions = (list<map>)merge (partitions, (list<map>)(v["partitions"]:[])); + } }); list<string> floppies = getFloppyDevices (); @@ -800,10 +808,20 @@ if (type == `boot || type == `boot_other) { - devices = filter (string k, map v, devices, - ``(v["type"]:`CT_UNKNOWN == `CT_DISK)); + devices = filter (string k, map v, devices, { + if ((v["type"]:`CT_UNKNOWN == `CT_DISK) || + (v["type"]:`CT_UNKNOWN == `CT_DMRAID)) + return true; + else + return false; + }); } - list<string> all_disks = (list<string>) maplist (string k, map v, devices, ``(k)); + list<string> all_disks = (list<string>) maplist (string k, map v, devices, + { + return k; + }); + + if (type == `deleted) return maplist (map x, filter (map p, partitions, ``(p["delete"]:false)), @@ -820,6 +838,14 @@ }); } partitions = filter (map p, partitions, ``(! p["delete"]:false)); + // filter out disk which are not in device map + if ((bl == "grub") && (type == `boot)) + all_disks = (list<string>) filter(string k, all_disks, { + if (haskey(device_mapping, k) || (haskey(device_mapping, Dev2MountByDev(k)))) + return true; + else + return false; + }); list<string> ret = all_disks; if (type == `boot_other || type == `root || type == `parts_old || type == `kept) @@ -831,7 +857,8 @@ ``(p["type"]:`primary == `primary || p["type"]:`primary == `extended || p["type"]:`primary == `logical - || p["type"]:`primary == `sw_raid)); + || p["type"]:`primary == `sw_raid) + ); // FIXME this checking is performed on 3 places, one function should // be developed for it partitions = filter (map p, partitions, { @@ -867,7 +894,8 @@ ``(p["fstype"]:"" == "Linux native" || p["fstype"]:"" == "Extended" || p["fstype"]:"" == "Linux RAID" - || p["fstype"]:"" == "MD Raid")); + || p["fstype"]:"" == "MD Raid" + || p["fstype"]:"" == "DM RAID")); } list<string>partition_names = maplist (map p, partitions, ``((string)(p["device"]:""))); @@ -2578,44 +2606,42 @@ * - add key console with value to section type image and xen */ -define void addConsole() +global define void HandleConsole() { string console_value = getConsoleValue(); - if ((console_value != "") && (console_value != nil)) - { - // list of idexes from sections where is image or xen - list < integer > list_index =[]; - // counter - integer index = -1; - foreach(map<string,any> section, sections, - { - index = index +1; - if ((section["type"]:"" == "image") || (search(section["type"]:"", "xen") != nil)) - list_index = add(list_index, index); - }); + // list of idexes from sections where is image or xen + list < integer > list_index =[]; + // counter + integer index = -1; + foreach(map<string,any> section, sections, + { + index = index +1; + if ((section["type"]:"" == "image") || (search(section["type"]:"", "xen") != nil)) + list_index = add(list_index, index); + }); - // add key console with value - if (size(list_index) > 0) + // add key console with value + if (size(list_index) > 0) + { + foreach (integer idx, list_index, { - foreach (integer idx, list_index, + sections[idx, "__changed"] = true; + if (sections[idx, "append"]:nil != nil) { - sections[idx, "console"] = console_value; - sections[idx, "__changed"] = true; - if (sections[idx, "append"]:nil != nil) + string updated_append = ""; + if ((console_value != "") || (console_value != nil)) + updated_append = BootCommon::UpdateSerialConsole(sections[idx,"append"]:"", + console_value); + else + updated_append = BootCommon::UpdateSerialConsole(sections[idx,"append"]:"", ""); + if (updated_append != nil) { - string updated_append = - BootCommon::UpdateSerialConsole(sections[idx,"append"]:"", - sections[idx,"console"]:""); - if (updated_append != nil) - { - sections[idx,"append"]=updated_append; - } + sections[idx,"append"]=updated_append; } - y2debug("Added console for section: %1", sections[idx]:$[]); - }); - } - + } + y2debug("Added/Removed console for section: %1", sections[idx]:$[]); + }); } } Modified: trunk/bootloader/src/routines/section_widgets.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/section_widgets.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/routines/section_widgets.ycp (original) +++ trunk/bootloader/src/routines/section_widgets.ycp Thu Apr 2 10:41:25 2009 @@ -11,6 +11,7 @@ * Authors: * Jiri Srain <jsrain@suse.cz> * Olaf Dabrunz <od@suse.de> + * Josef Reidinger <jreidinger@suse.cz> * * $Id$ * @@ -27,10 +28,52 @@ import "Mode"; import "Storage"; import "StorageDevices"; -import "TablePopup"; +import "Bootloader"; import "Popup"; +import "FileUtils"; include "bootloader/routines/helps.ycp"; +include "bootloader/grub/helps.ycp"; +include "bootloader/elilo/helps.ycp"; +include "bootloader/zipl/helps.ycp"; +include "bootloader/ppc/helps.ycp"; + +boolean validate_image(string widget, map event){ + string value = (string) UI::QueryWidget(`id(widget),`Value); + if (value == ""){ + Popup::Error(_("Image section must have specified kernel image")); + UI::SetFocus(`id(widget)); + return false; + } + if (!Mode::installation() && !Mode::repair()){ + if (!FileUtils::Exists(value)){ + if (!Popup::YesNo(_("Image file doesn't exist now. Do you really want use it?"))){ + UI::SetFocus(`id(widget)); + return false; + } + } + } + + return true; +} + +boolean validate_initrd(string widget, map event){ + string value = (string) UI::QueryWidget(`id(widget),`Value); + if (!Mode::installation() && !Mode::repair()){ + if (!FileUtils::Exists(value)){ + if (!Popup::YesNo(_("Initrd file doesn't exist now. Do you really want use it?"))){ + UI::SetFocus(`id(widget)); + return false; + } + } + } + return true; +} + +map<string,boolean (string, map)> validation_map = $[ + "image" : validate_image, + "initrd" : validate_initrd, +]; /** * Init function for widget value @@ -48,7 +91,7 @@ */ void SectionOptionStore (string widget, map event) { BootCommon::current_section[widget] - = UI::QueryWidget (`id (widget), `Value); + = UI::QueryWidget (`id (widget), `Value); } /** @@ -60,6 +103,128 @@ ]; +void InitSectionBool(string widget){ + boolean value = BootCommon::current_section[widget]:"false" == "true"; + UI::ChangeWidget (`id (widget), `Value, value); +} + +void StoreSectionBool(string widget, map event){ + boolean value = (boolean)UI::QueryWidget (`id (widget), `Value); + BootCommon::current_section[widget] = value ? "true" : "false"; +} + +map<string,any> SectionCheckBoxWidget( string label, string help){ + return $[ + "label" : label, + "widget" : `checkbox, + "help" : help, + "init" : InitSectionBool, + "store" : StoreSectionBool + ]; +} + + +/** + * Handle function of a widget (InputField + browse button) + * @param widget any widget key + * @param event map event description of event that occured + * @return symbol nil + */ +symbol HandleSectionBrowse (string widget, map event) { + string current = (string)UI::QueryWidget (`id (widget), `Value); + if (current == "" || current == nil) + current = "/boot"; + // file open popup caption + current = UI::AskForExistingFile (current, "*", _("Select File")); + if (current != nil) + UI::ChangeWidget (`id (widget), `Value, current); + return nil; +} + +/** + * Handle function of a widget (InputField + browse button) + * Asks for directory instead file + * @param widget any widget key + * @param event map event description of event that occured + * @return symbol nil + */ +symbol HandleSectionBrowseDirectory (string widget, map event) { + string current = (string)UI::QueryWidget (`id (widget), `Value); + // file open popup caption + current = UI::AskForExistingFile (current, "*", _("Select File")); + if (current != nil) + UI::ChangeWidget (`id (widget), `Value, current); + return nil; +} + +/** + * Generic widget of a inputfield + browse button + * Use validation function from validation_map + * if it is necessary create own definition of widget + * @param string lable of widget + * @param string help text for widget + * @param string id of widget + * @return map<string,any> CWS widget + */ +map<string,any> SectionInputFieldBrowseWidget(string label, string help, string id){ + string browse = "browse" + id; + map<string,any> ret = $[ + "widget" : `custom, + "custom_widget" : `HBox( + `Left(`InputField(`id(id),`opt(`hstretch), label)), + `VBox( + `Label(""), + `PushButton(`id(browse),`opt(`notify), Label::BrowseButton()) + ) + ), + "init" : SectionOptionInit, + "store" : SectionOptionStore, + "handle" : HandleSectionBrowse, + "handle_events" : [browse], + "help" : help, + ]; + if (haskey(validation_map,id)){ + ret["validate_type"] = `function; + ret["validate_function"] = validation_map[id]:nil;//nil cannot happen + } + + return ret; +} + +map<string,any> SectionInputFieldBrowseDirectoryWidget(string label, string help, string id){ + map<string,any> ret = SectionInputFieldBrowseWidget(label,help,id); + ret["handle"] = HandleSectionBrowseDirectory; + return ret; +} + + +void InitSectionInt(string widget){ + integer value = tointeger(BootCommon::current_section[widget]:"0"); + UI::ChangeWidget (`id (widget), `Value, value); +} + +void StoreSectionInt(string widget, map event){ + integer value = (integer)UI::QueryWidget (`id (widget), `Value); + BootCommon::current_section[widget] = tostring(value); +} + +map<string,any> SectionIntFieldWidget( string label, string help, + integer min, integer max){ + map<string,any> ret = $[ + "label" : label, + "widget" : `intfield, + "help" : help, + "init" : InitSectionInt, + "store" : StoreSectionInt + ]; + if ( min != nil ) + ret["minimum"] = min; + if ( max != nil ) + ret["maximum"] = max; + + return ret; + +} /** * Validate function of the name widget * @param widget any widget key @@ -67,6 +232,7 @@ * @return boolean true if widget settings ok */ boolean SectionNameValidate (string widget, map event) { + //TODO check for valid section name list<string> existing = []; foreach (map<string,any> s, BootCommon::sections, { existing = add (existing, s["name"]:""); @@ -92,73 +258,14 @@ */ void SectionNameStore (string widget, map event) { string value = (string)UI::QueryWidget (`id (widget), `Value); - if (Bootloader::getLoaderType () != "grub") - { - value = BootCommon::replaceAll (value, " ", "_"); - if (size (value) > 15) - value = substring (value, 0, 15); - } - BootCommon::current_section[widget] = value; -} -/** - * Init function of widget - * @param widget any id of the widget - */ -void KernelImageInit (string widget) { - list<string> available = (list<string>)SCR::Read (.target.dir, "/boot"); - available = filter (string f, available, { - return substring (f, 0, 13) == "/boot/vmlinuz"; - }); - if (size (available) == 0) - available = ["/boot/vmlinuz"]; - UI::ChangeWidget (`id (widget), `Items, available); - SectionOptionInit (widget); -} - -/** - * Handle function of a widget - * @param widget any widget key - * @param event map event description of event that occured - * @return symbol to return to wizard sequencer, or nil - */ -symbol KernelImageHandle (string widget, map event) { - string current = (string)UI::QueryWidget (`id (widget), `Value); - // file open popup caption - current = UI::AskForExistingFile (current, "*", _("Kernel Image")); - if (current != nil) - UI::ChangeWidget (`id (widget), `Value, current); - return nil; -} - -/** - * Init function of widget - * @param widget any id of the widget - */ -void InitrdInit (string widget) { - list<string> available = (list<string>)SCR::Read (.target.dir, "/boot"); - available = filter (string f, available, { - return substring (f, 0, 12) == "/boot/initrd"; - }); - if (size (available) == 0) - available = ["/boot/initrd"]; - UI::ChangeWidget (`id (widget), `Items, available); - SectionOptionInit (widget); -} + //check if we need change default value in globals + if ( BootCommon::globals["default"]:nil + == BootCommon::current_section[widget]:""){ + BootCommon::globals["default"] = value; + } -/** - * Handle function of the initrd widget - * @param widget any widget key - * @param event map event description of event that occured - * @return symbol to return to wizard sequencer, or nil - */ -symbol InitrdHandle (string widget, map event) { - string current = (string)UI::QueryWidget (`id (widget), `Value); - // file open popup caption - current = UI::AskForExistingFile (current, "*", _("Initial RAM Disk")); - if (current != nil) - UI::ChangeWidget (`id (widget), `Value, current); - return nil; + BootCommon::current_section[widget] = value; } @@ -215,15 +322,17 @@ void VgaModeInit (string widget) { list<map> vga_modes = Initrd::VgaModes (); list items = maplist (map m, vga_modes, { - return `item (`id (sformat ("%1", m["mode"]:0)), + return `item (`id (sformat ("%1", tohexstring(m["mode"]:0))), // combo box item // %1 is X resolution (width) in pixels - // %2 is Y serolution (height) in pixels + // %2 is Y resolution (height) in pixels // %3 is color depth (usually one of 8, 16, 24, 32) // %4 is the VGA mode ID (hexadecimal number) sformat (_("%1x%2, %3 bits (mode %4)"), - m["width"]:0, m["height"]:0, m["color"]:0, m["mode"]:0)); + m["width"]:0, m["height"]:0, m["color"]:0, tohexstring(m["mode"]:0))); }); + items = prepend(items,`item(`id("ask"), _("Ask for resolution during boot."))); + items = prepend(items,`item(`id("extended"), _("Standard 8-pixel font mode."))); // item of a combo box items = prepend (items, `item (`id ("normal"), _("Text Mode"))); UI::ChangeWidget (`id (widget), `Items, items); @@ -241,21 +350,6 @@ } /** - * Handle function of the chainloader widget - * @param widget any widget key - * @param event map event description of event that occured - * @return symbol to return to wizard sequencer, or nil - */ -symbol ChainloaderHandle (string widget, map event) { - string current = (string)UI::QueryWidget (`id (widget), `Value); - // file open popup caption - current = UI::AskForExistingFile (current, "*", _("Device to Boot")); - if (current != nil) - UI::ChangeWidget (`id (widget), `Value, current); - return nil; -} - -/** * Widget for selecting section type * @return term widget */ @@ -269,14 +363,18 @@ _("Clone Selected Section"), true))); count = count + 1; } - list<string> section_types = ["image", "xen", "chainloader"]; + list<string> section_types = Bootloader::blsection_types(); map<string,string> section_types_descr = $[ // radio button - "image" : _("Kernel (Linux)"), + "image" : _("Image Section"), // radio button - "xen" : _("Kernel via XEN"), + "xen" : _("Xen Section"), // radio button (don't translate 'chainloader') - "chainloader" : _("Other System (Chainloader)"), + "other" : _("Other System (Chainloader)"), + // radio button + "menu" : _("Menu Section"), + // radio button + "dump" : _("Dump Section"), ]; foreach (string t, section_types, { if (count > 0) @@ -309,18 +407,22 @@ return nil; string selected = (string) UI::QueryWidget (`id (`sect_type), `CurrentButton); + string original_name = selected; + if (original_name == "image") + original_name = "linux"; if (selected != "clone") - { + { BootCommon::current_section = $[ "type" : selected, + "original_name" : original_name, ]; } else { BootCommon::current_section["name"] = ""; - // FIXME: the problem with missing YaST commnet in menu.lst + // fix the problem with missing YaST commnet in menu.lst // it seems be correct if original_name stay same... - // BootCommon::current_section["original_name"] = ""; + BootCommon::current_section["original_name"] = ""; BootCommon::current_section["__auto"] = false; // fix for problem with cloning section if (haskey(BootCommon::current_section,"lines_cache_id")) @@ -355,94 +457,79 @@ "store" : SectionNameStore, "help" : SectionNameHelp (), ], - "kernel" : $[ - "widget" : `custom, - "custom_widget" : Stage::initial () - ? `InputField (`id ("kernel"), `opt (`hstretch), - // text entry - _("&Kernel")) - : `HBox ( - `ComboBox (`id ("kernel"), `opt (`editable, `hstretch), - // combo box - _("&Kernel"), - []), - `VBox ( - `Label (""), - `PushButton (`id (`kernel_browse), - Label::BrowseButton ()) - ) - ), - "init" : KernelImageInit, - "help" : KernelHelp (), - "handle" : KernelImageHandle, - "handle_events" : [ `kernel_browse ], + "image" : SectionInputFieldBrowseWidget( + grub_descriptions["image"]:"image", + grub_help_messages["image"]:"", + "image"), + "initrd" : SectionInputFieldBrowseWidget( + grub_descriptions["initrd"]:"initrd", + grub_help_messages["initrd"]:"", + "initrd"), + "xen" : SectionInputFieldBrowseWidget( + grub_descriptions["xen"]:"xen", + grub_help_messages["xen"]:"", + "xen"), + "target" : SectionInputFieldBrowseDirectoryWidget( + zipl_descriptions["target"]:"target", + zipl_help_messages["target"]:"", + "target"), + "parmfile" : SectionInputFieldBrowseWidget( + zipl_descriptions["parmfile"]:"parmfile", + zipl_help_messages["parmfile"]:"", + "parmfile"), + "dumpto" : $[ //FIXME when exist browse device use it + "label" : zipl_descriptions["dumpto"]:"dumpto", + "widget" : `textentry, + "help" : zipl_help_messages["dumpto"]:"" ], - "initrd" : $[ - "widget" : `custom, - "custom_widget" : Stage::initial () - ? `InputField (`id ("initrd"), `opt (`hstretch), - // text entry - _("&Initial RAM Disk")) - : `HBox ( - `ComboBox (`id ("initrd"), `opt (`editable, `hstretch), - // combo box - _("&Initial RAM Disk"), - []), - `VBox ( - `Label (""), - `PushButton (`id (`initrd_browse), - Label::BrowseButton ()) - ) - ), - "init" : InitrdInit, - "handle" : InitrdHandle, - "handle_events" : [ `initrd_browse ], - "help" : InitrdHelp (), + "dumptofs" : $[ //FIXME when exist browse device use it + "label" : zipl_descriptions["dumptofs"]:"dumptofs", + "widget" : `textentry, + "help" : zipl_help_messages["dumptofs"]:"" ], "root" : $[ "widget" : `combobox, // combo box - "label" : _("Root &Device"), + "label" : grub_descriptions["root"]:"root", "opt" : [ `editable, `hstretch, `notify ], "init" : RootDeviceInit, "handle" : RootDeviceHandle, "store" : RootDeviceStore, - "help" : RootDeviceHelp (), + "help" : grub_help_messages["root"]:"", ], - "vga" : $[ + "vgamode" : $[ "widget" : `combobox, // combo box - "label" : _("&VGA Mode"), + "label" : grub_descriptions["vgamode"]:"vgamode", "opt" : [ `editable, `hstretch ], "init" : VgaModeInit, - "help" : VgaModeHelp (), + "help" : grub_help_messages["vgamode"]:"", ], "append" : $[ - // text entry - "label" : _("Other Kernel &Parameters"), + "label" : grub_descriptions["append"]:"append", + "widget" : `textentry, + "help" : grub_help_messages["append"]:"" + ], + "xen_append" : $[ + "label" : grub_descriptions["xen_append"]:"xen_append", "widget" : `textentry, - "help" : AppendHelp (), + "help" : grub_help_messages["xen_append"]:"", ], + "configfile" : $[ + "label" : grub_descriptions["configfile"]:"configfile", + "widget" : `textentry, + "help" : grub_help_messages["configfile"]:"", + ], + "list" : $[ + "label" : zipl_descriptions["list"]:"list", + "widget" : `textentry, + "help" : zipl_help_messages["list"]:"", + ], "chainloader" : $[ - "widget" : `custom, - "custom_widget" : `HBox ( - `ComboBox (`id ("chainloader"), - `opt (`editable, `hstretch), - // combo box - _("&Device"), - []), - Stage::initial () - ? `VBox () - : `VBox ( - `Label (""), - `PushButton (`id (`chainloader_browse), - Label::BrowseButton ()) - ) - ), + "widget" : `combobox, "init" : ChainloaderInit, - "handle" : ChainloaderHandle, - "handle_events" : [ `chainloader_browse ], - "help" : ChainloaderHelp (), + "help" : grub_help_messages["chainloader"]:"", + "opt" : [ `editable, `hstretch ], ], "section_type" : $[ "widget" : `func, @@ -450,7 +537,41 @@ "handle" : SectionTypeHandle, "help" : SectionTypeHelp (), ], - + "makeactive" : SectionCheckBoxWidget( + grub_descriptions["makeactive"]:"makeactive", + grub_help_messages["makeactive"]:""), + "noverifyroot" : SectionCheckBoxWidget( + grub_descriptions["noverifyroot"]:"noverifyroot", + grub_help_messages["noverifyroot"]:""), + "remap" : SectionCheckBoxWidget( + grub_descriptions["remap"]:"remap", + grub_help_messages["remap"]:""), + "relocatable" : SectionCheckBoxWidget( + elilo_descriptions["relocatable"]:"relocatable", + elilo_help_messages["section_relocatable"]:""), + "prompt" : SectionCheckBoxWidget( + zipl_descriptions["prompt"]:"prompt", + zipl_help_messages["prompt"]:""), + "blockoffset" : SectionIntFieldWidget( + grub_descriptions["blockoffset"]:"blockoffset", + grub_help_messages["blockoffset"]:"",0,nil), + "default" : SectionIntFieldWidget( + zipl_descriptions["default"]:"default", + zipl_help_messages["default"]:"",1,10), + "timeout" : SectionIntFieldWidget( + zipl_descriptions["timeout"]:"timeout", + zipl_help_messages["timeout"]:"",0,60), + "optional" : SectionCheckBoxWidget( + ppc_descriptions["optional"]:"optional", + ppc_help_messages["optional"]:""), + "copy" : SectionCheckBoxWidget( + ppc_descriptions["copy"]:"copy", + ppc_help_messages["copy"]:""), + "other" : $[ //FIXME change to combobox and add proper init function + "label" : ppc_descriptions["other"]:"other", + "widget" : `textentry, + "help" : ppc_help_messages["other"]:"" + ], ]; } Modified: trunk/bootloader/src/routines/switcher.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/switcher.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/routines/switcher.ycp (original) +++ trunk/bootloader/src/routines/switcher.ycp Thu Apr 2 10:41:25 2009 @@ -105,6 +105,16 @@ void() toEval = functions["propose"]:BootCommon::Propose; toEval (); } +/** + * Get sections types + * @return list <string> section types + */ +global list <string> blsection_types () +{ + map functions = getFunctions (BootCommon::getLoaderType (false)); + list<string>() toEval = functions["section_types"]:BootCommon::Common_sections_types; + return toEval (); +} /** * Save bootloader cfg. files to the cache of the pluglib Modified: trunk/bootloader/src/routines/widgets_i386.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/widgets_i386.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/routines/widgets_i386.ycp (original) +++ trunk/bootloader/src/routines/widgets_i386.ycp Thu Apr 2 10:41:25 2009 @@ -20,232 +20,303 @@ textdomain "bootloader"; +include "bootloader/routines/helps.ycp"; include "bootloader/routines/popups.ycp"; +include "bootloader/grub/helps.ycp"; -/** - * Init function of widget - * @param widget string id of the widget - */ -void InitBootMenu (string widget) { - boolean timeout_active = haskey (BootCommon::globals, "timeout"); - UI::ChangeWidget (`id (`timeout_act), `Value, timeout_active); - UI::ChangeWidget (`id (`timeout), `Enabled, timeout_active); - integer timeout = tointeger (BootCommon::globals["timeout"]:"0"); - UI::ChangeWidget (`id (`timeout), `Value, timeout); - boolean show_menu = BootCommon::globals["prompt"]:"0" != "0"; - UI::ChangeWidget (`id (`show_menu), `Value, show_menu); +void InitDiskOrder(string widget) { + list<string> disksOrder = BootCommon::DisksOrder (); + + UI::ChangeWidget ( `id(`disks), `Items, disksOrder); + UI::ChangeWidget (`id (`disks), `CurrentItem, disksOrder[0]:""); } -/** - * Store function of a widget - * @param widget string widget key - * @param event map event that caused the operation - */ -void StoreBootMenu (string widget, map event) { - integer timeout = (integer)UI::QueryWidget (`id (`timeout), `Value); - boolean timeout_act = (boolean)UI::QueryWidget (`id (`timeout_act), `Value); - if (timeout_act) - BootCommon::globals["timeout"] = sformat ("%1", timeout); - else if (haskey (BootCommon::globals, "timeout")) - BootCommon::globals = remove (BootCommon::globals, "timeout"); - boolean show_menu = (boolean)UI::QueryWidget (`id (`show_menu), `Value); - BootCommon::globals["prompt"] = show_menu ? "1" : "0"; +string GetItemID(term t){ + return argsof((term)argsof(t)[0]:`id(""))[0]:""; } -/** - * Handle function of a widget - * @param key any widget key - * @param event map event description of event that occured - * @return symbol always nil - */ -symbol HandleBootMenu (string key, map event) { - boolean active = (boolean)UI::QueryWidget (`id (`timeout_act), `Value); - UI::ChangeWidget (`id (`timeout), `Enabled, active); - return nil; +void StoreDiskOrder(string widget, map event) { + list<term> disksOrder = (list<term>)UI::QueryWidget(`id(`disks), `Items); + list<string> result = (list<string>) maplist(term t, disksOrder, { + return GetItemID(t); + }); + BootCommon::mbrDisk = result[0]:""; + integer index = 0; + BootCommon::device_mapping = listmap (string d, result, { + string indexs = tostring(index); + index = index + 1; + return $[ d : sformat ("hd%1", indexs)]; + }); } -/** - * Build a map describing a widget - * @return a map describing a widget - */ -map<string,any> BootMenuWidget () { - return $[ - "widget" : `custom, - // frame - "custom_widget" : `Frame (_("Boot Menu"), `HBox ( - `HSpacing (2), `VBox ( - `VSpacing (0.4), - // check box - `Left (`CheckBox (`id (`show_menu), _("&Show Boot Menu"))), - `VSpacing (0.4), - `Left (`CheckBox (`id (`timeout_act), `opt (`notify), - // check box - _("&Continue Booting after a Time-Out"))), - // integer field - `IntField (`id (`timeout), _("Boot &Menu Time-Out"), 0, 60, 0), - `VSpacing (0.4) - ), `HSpacing (2) - )), - "init" : InitBootMenu, - "store" : StoreBootMenu, - "handle" : HandleBootMenu, - "handle_events" : [ `timeout_act ], - "help" : i386BootMenuHelp (), - ]; +string NewDevicePopup(){ + term popup = `VBox (`VSpacing (1), + // textentry header + `InputField (`id (`devname), `opt (`hstretch), _("&Device")), + `VSpacing (1), + `HBox (`HStretch (), + `PushButton (`id (`ok), `opt (`key_F10, `default), + Label::OKButton ()), + `HStretch (), + `PushButton (`id (`cancel), `opt (`key_F8), + Label::CancelButton ()), + `HStretch () + ), + `VSpacing (1) + ); + UI::OpenDialog (popup); + symbol pushed = (symbol)UI::UserInput (); + string new_dev = (string) UI::QueryWidget (`id (`devname), `Value); + UI::CloseDialog (); + string ret = ""; + if (pushed == `ok){ + ret = new_dev; + } + return ret; } -/** - * Init function of widget - * @param widget string id of the widget - */ -void InitPasswdWidget (string widget) { - string passwd = BootCommon::globals["password"]:""; - if (passwd == nil || passwd == "") - { - UI::ChangeWidget (`id (`use_pas), `Value, false); - UI::ChangeWidget (`id (`pw1), `Enabled, false); - UI::ChangeWidget (`id (`pw1), `Value, ""); - UI::ChangeWidget (`id (`pw2), `Enabled, false); - UI::ChangeWidget (`id (`pw2), `Value, ""); - } - else - { - UI::ChangeWidget (`id (`use_pas), `Value, true); - UI::ChangeWidget (`id (`pw1), `Enabled, true); - UI::ChangeWidget (`id (`pw1), `Value, "**********"); - UI::ChangeWidget (`id (`pw2), `Enabled, true); - UI::ChangeWidget (`id (`pw2), `Value, "**********"); + +symbol HandleDiskOrder( string widget, map event ){ + any action = event["ID"]:nil; + boolean changed = false; + list<term> disksOrder = (list<term>)UI::QueryWidget(`id(`disks), `Items); + string current = (string)UI::QueryWidget (`id (`disks), `CurrentItem); + integer pos = 0; + while (pos < size (disksOrder) + && GetItemID(disksOrder[pos]:`Item(`id(""))) != current) + pos = pos + 1; + + //disabling & enabling up/down + UI::ChangeWidget (`id (`up), `Enabled, pos > 0 && pos < size (disksOrder)); + UI::ChangeWidget (`id (`down), `Enabled, pos < size (disksOrder) - 1); + + if (action == `up){ + changed= true; + disksOrder = + (list<term>) BootCommon::swapItems (disksOrder, pos, pos - 1); + } else if (action == `down){ + changed= true; + disksOrder = + (list<term>) BootCommon::swapItems (disksOrder, pos, pos + 1); + } else if (action == `delete){ + changed = true; + disksOrder = remove(disksOrder,pos); + UI::ChangeWidget (`id (`disks), `CurrentItem, + (pos > 0) ? GetItemID(disksOrder[(pos-1)]:`Item(`id(""))) + : GetItemID(disksOrder[0]:`Item(`id("")))); + } else if (action == `add) { + string new_dev = NewDevicePopup(); + if (new_dev != ""){ + changed = true; + disksOrder = add(disksOrder, `item(`id(new_dev),new_dev)); } - UI::SetFocus (`id (`use_pas)); + } + + if (changed){ + UI::ChangeWidget (`id (`disks), `Items, disksOrder); + } +} + +boolean ValidateDiskOrder(string key, map event) { + list<term> disksOrder = (list<term>)UI::QueryWidget(`id(`disks), `Items); + if (size(disksOrder)>0) + return true; + Popup::Warning(_("Device map must contain at least one device")); + return false; +} + +map<string,any> DisksOrderWidget(){ + term contents = `HBox (`HSpacing (2), `VBox ( + `VSpacing (1), + `SelectionBox (`id (`disks), + `opt (`notify, `immediate),_("D&isks"), []), + `HBox( + `HStretch (), + `PushButton (`id (`add), + `opt (`key_F3), Label::AddButton ()), + `PushButton (`id (`delete), + `opt(`key_F5), Label::DeleteButton ()), + `HStretch () + ), + `VSpacing (1) + ), + `HSquash ( + `VBox ( + `VStretch (), + `PushButton (`id (`up), + `opt (`hstretch), _("&Up")), + `PushButton (`id (`down), + `opt (`hstretch), _("&Down")), + `VStretch () + ) + ), + `HSpacing (2) + ); + return $[ + "widget" : `custom, + "custom_widget" : contents, + "init" : InitDiskOrder, + "handle" : HandleDiskOrder, + "store" : StoreDiskOrder, + "help" : i386InstallDetailsHelp (), + "validate_type" : `function, + "validate_function" : ValidateDiskOrder + ]; } + /** - * Handle function of a widget - * @param widget string id of the widget - * @param event map event description of event that occured - * @return symbol always nil + * Init function of a widget + * @param widget string widget key */ -symbol HandlePasswdWidget (string widget, map event) { - if (event["ID"]:nil == `use_pas) +void InitBootLoaderLocationWidget(string widget) { + list<string> boot_devices = BootCommon::getPartitionList(`boot); + list <string> list_global_target_keys = ["boot_mbr", "boot_boot", "boot_root", "boot_extended"]; + foreach(string key, list_global_target_keys, { - boolean enabled = (boolean)UI::QueryWidget (`id (`use_pas), `Value); - UI::ChangeWidget (`id (`pw1), `Enabled, enabled); - UI::ChangeWidget (`id (`pw2), `Enabled, enabled); + string value = BootCommon::globals[key]:nil; + if (value != nil) + UI::ChangeWidget (`id (key), `Value, (value == "true")? true: false); + }); + UI::ChangeWidget (`id ("boot_custom_list"),`Items, boot_devices); + if ((!haskey(BootCommon::globals,"boot_custom")) && + (BootCommon::globals["boot_custom"]:"" == "")) + { + UI::ChangeWidget (`id ("boot_custom_list"),`Enabled, false); + } else { + UI::ChangeWidget (`id ("boot_custom"), `Value, true); + UI::ChangeWidget (`id ("boot_custom_list"),`Enabled, true); + UI::ChangeWidget (`id ("boot_custom_list"),`Value, BootCommon::globals["boot_custom"]:""); } - return nil; } - /** - * Store function of a popup - * @param key any widget key + * handle function of a widget + * @param widget string widget key * @param event map event that caused the operation + * @return symbol */ -void StorePasswdWidget (string key, map event) { - string password = nil; - boolean usepass = (boolean)UI::QueryWidget (`id (`use_pas), `Value); - y2milestone ("Usepass: %1", usepass); - if (usepass) - { - if (UI::QueryWidget (`id (`pw1), `Value) != "**********") - { - password = (string)UI::QueryWidget (`id (`pw1), `Value); - if (haskey (BootCommon::current_bootloader_attribs, - "update_passwd")) - { - string(string) f = (string(string)) - BootCommon::current_bootloader_attribs[ - "update_passwd"]:nil; - password = f (password); - } - BootCommon::globals["password"] = password; - } - } - else if (haskey (BootCommon::globals, "password")) +symbol HandleBootLoaderLocationWidget (string widget, map event) { + any ret = event["ID"]:nil; + if (ret == "boot_custom") { - BootCommon::globals = remove (BootCommon::globals, "password"); + if ((boolean)UI::QueryWidget(`id("boot_custom"), `Value)) + UI::ChangeWidget (`id ("boot_custom_list"),`Enabled, true); + else + UI::ChangeWidget (`id ("boot_custom_list"),`Enabled, false); } return nil; } /** - * Validate function of a popup - * @param key any widget key - * @param event map event that caused validation - * @return boolean true if widget settings ok - */ -boolean ValidatePasswdWidget (string key, map event) { - if (! (boolean)UI::QueryWidget (`id (`use_pas), `Value)) - return true; - if (UI::QueryWidget (`id (`pw1), `Value) == "") + * Store function of a widget + * @param widget string widget key + * @param event map event that caused the operation + */ +void StoreBootLoaderLocationWidget (string widget, map event) { + + list <string> list_global_target_keys = ["boot_mbr", "boot_boot", "boot_root", "boot_extended"]; + foreach(string key, list_global_target_keys, { - emptyPasswdErrorPopup (); - UI::SetFocus (`id (`pw1)); - return false; - } - if (UI::QueryWidget (`id (`pw1), `Value) - == UI::QueryWidget (`id (`pw2), `Value) - ) - return true; - passwdMissmatchPopup (); - UI::SetFocus (`id (`pw1)); - return false; + string value = ((boolean)UI::QueryWidget(`id(key), `Value))?"true":"false"; + BootCommon::globals[key]= value; + }); + if ((boolean)UI::QueryWidget(`id("boot_custom"), `Value)) + BootCommon::globals["boot_custom"]= (string)UI::QueryWidget(`id("boot_custom_list"), `Value); } +/** FIXME: merge help text to one for BootLoaderLocationWidget + * Function merge help text from ../grub/helps.ycp + * + * @return string help text for widget BootLoaderLocationWidget + */ +string HelpBootLoaderLocationWidget() +{ + string ret = ""; + ret = grub_help_messages["boot_mbr"]:""; + ret = ret + "\n"; + ret = ret + grub_help_messages["boot_root"]:""; + ret = ret + "\n"; + ret = ret + grub_help_messages["boot_boot"]:""; + ret = ret + "\n"; + ret = ret + grub_help_messages["boot_extended"]:""; + ret = ret + "\n"; + ret = ret + grub_help_messages["boot_custom"]:""; + return ret; +} +map<string,any> grubBootLoaderLocationWidget () +{ + term contents = `VBox ( + `Frame (_("Boot Loader Location"), + `VBox (`HBox(`HSpacing(1),`VBox( + `Left(`CheckBox( `id("boot_mbr"), _("Boot from &Master Boot Record"))), + `Left(`CheckBox( `id("boot_root"), _("Boot from &Root Partition"))), + `Left(`CheckBox( `id("boot_boot"), _("Boo&t from Boot Partition"))), + `Left(`CheckBox( `id("boot_extended"), _("Boot from &Extended Partition"))), + `Left(`CheckBox( `id("boot_custom"), `opt(`notify), _("C&ustom Boot Partition"))), + `Left(`ComboBox( `id("boot_custom_list"), `opt (`editable, `hstretch),"", [])), + `VStretch() + ))) + ), + `VStretch() + ); + + return $[ + "widget" : `custom, + "custom_widget" : contents, + "init" : InitBootLoaderLocationWidget, + "handle" : HandleBootLoaderLocationWidget, + "store" : StoreBootLoaderLocationWidget, + "help" : HelpBootLoaderLocationWidget(), + ]; +} /** - * Build a map describing a widget - * @return a map describing a widget + * Handle function of a widget + * @param widget string widget key + * @param event map event description of event that occured + * @return symbol to return to wizard sequencer, or nil */ -map<string,any> PasswordWidget () { +symbol InstDetailsButtonHandle (string widget, map event) +{ + return `inst_details; +} + + +map<string,any> grubInstalationDetials () +{ return $[ - "widget" : `custom, - // frame - "custom_widget" : `Frame (_("Password Protection"), `VBox ( - `VSpacing (0.4), - `HBox ( - `HSpacing (2), `VBox ( - `Left (`CheckBox (`id (`use_pas), `opt (`notify), - // check box - _("Prot&ect Boot Loader with Password"))), - `HBox ( - // text entry - `Password (`id (`pw1), _("&Password")), - // text entry - `Password (`id (`pw2), _("Re&type Password")) - ) - ), `HSpacing (2) - ), - `VSpacing (0.4) - )), - "init" : InitPasswdWidget, - "handle" : HandlePasswdWidget, - "store" : StorePasswdWidget, - "validate_type" : `function, - "validate_function" : ValidatePasswdWidget, - "help" : i386PasswdHelp (), + "widget" : `push_button, + // push button + "label" : _("Boot Loader Installation &Details"), + "handle_events" : ["inst_details"], + "handle" : InstDetailsButtonHandle, + "help" : InstDetailsHelp (), ]; } + + /** - * Cache for i386Widgets function + * Cache for genericWidgets function */ -map<string,map<string,any> > _i386_widgets = nil; +map<string,map<string,any> > _grub_widgets = nil; /** - * Get widgets specific for i386 - * @return a map describing all i386-specific widgets + * Get generic widgets + * @return a map describing all generic widgets */ -map<string,map<string,any> > i386Widgets () { - if (_i386_widgets == nil) +global map<string,map<string,any> > grubWidgets () { + if (_grub_widgets == nil) { - _i386_widgets = $[ - "boot_menu" : BootMenuWidget (), - "password" : PasswordWidget (), + _grub_widgets = $[ + "loader_location" : grubBootLoaderLocationWidget (), + "inst_details" : grubInstalationDetials (), ]; } - return _i386_widgets; + return _grub_widgets; } + } // include end Modified: trunk/bootloader/src/routines/wizards.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/wizards.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/routines/wizards.ycp (original) +++ trunk/bootloader/src/routines/wizards.ycp Thu Apr 2 10:41:25 2009 @@ -24,7 +24,7 @@ import "Report"; import "Popup"; include "bootloader/routines/dialogs.ycp"; -include "bootloader/generic/wizards.ycp"; + /** @@ -34,22 +34,17 @@ symbol MainSequence () { if (! BootCommon::BootloaderInstallable ()) // error report - Report::Error (_("Because of the partitioning, the boot loader -cannot be installed properly.")); - - // check loader-specific sequence - symbol spec_ret = Bootloader::blMainSequence (); - if (spec_ret == `generic_new) - return GenericMainSequence(); - - if (spec_ret != `generic) - return spec_ret; + Report::Error (_("Because of the partitioning, the boot loader cannot be installed properly.")); + string bl = Bootloader::getLoaderType (); // run generic sequence map aliases = $[ "edit_section_switch" : [``(EditSectionSwitch ()), true], "kernel_section" : ``(KernelSectionDialog ()), "kernel_details" : ``(DetailsDialog ("kernel_section")), + "xen_section" : ``(XenSectionDialog ()), + "menu_section" : ``(MenuSectionDialog ()), + "dump_section" : ``(DumpSectionDialog ()), "chainloader_section" : ``(ChainloaderSectionDialog ()), "chainloader_details" : ``(DetailsDialog ("chainloader_section")), "main" : ``(MainDialog ()), @@ -96,6 +91,18 @@ `next : "kernel_section", `abort : `abort, ], + "xen_section" : $[ + `next : "store_section", + `abort : `abort, + ], + "menu_section" : $[ + `next : "store_section", + `abort : `abort, + ], + "dump_section" : $[ + `next : "store_section", + `abort : `abort, + ], "chainloader_section" : $[ `next : "store_section", `abort : `abort, @@ -114,6 +121,9 @@ "edit_section_switch" : $[ `kernel : "kernel_section", `chainloader : "chainloader_section", + `xen : "xen_section", + `menus : "menu_section", + `dump : "dump_section", ], ]; Modified: trunk/bootloader/src/zipl/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/zipl/helps.ycp?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/src/zipl/helps.ycp (original) +++ trunk/bootloader/src/zipl/helps.ycp Thu Apr 2 10:41:25 2009 @@ -35,22 +35,20 @@ "boot" : _("Boot Image Location"), "default" : _("Default Boot Section/Menu"), "type_image" : _("Image Section"), - "image_target" : _("Target Directory for Image Section"), + "target" : _("Tar&get Directory for Section"), "image_image" : _("Kernel Image"), "image_initrd" : _("Initial RAM Disk"), "image_append" : _("Optional Kernel Parameters"), "image_root" : _("Root device"), - "image_parmfile" : _("Optional Parameter File"), + "parmfile" : _("Op&tional Parameter File"), "type_dump" : _("Dump Section (obsolete)"), - "dump_target" : _("Target Directory for Dump Section"), - "dump_dumpto" : _("Dump Device"), - "dump_dumptofs" : _("SCSI Dump Device"), + "dumpto" : _("&Dump Device"), + "dumptofs" : _("&SCSI Dump Device"), "type_menu" : _("Menu Section"), - "menu_target" : _("Target Directory for Menu Section"), - "menu_list" : _("List of Menu Entries"), - "menu_default" : _("Number of Default Entry"), - "menu_timeout" : _("Timeout in seconds"), - "menu_prompt" : _("Show boot menu"), + "list" : _("&List of Menu Entries"), + "default" : _("&Number of Default Entry"), + "timeout" : _("&Timeout in seconds"), + "prompt" : _("&Show boot menu"), ]; Modified: trunk/bootloader/yast2-bootloader.spec.in URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/yast2-bootloader.spec.in?rev=56563&r1=56562&r2=56563&view=diff ============================================================================== --- trunk/bootloader/yast2-bootloader.spec.in (original) +++ trunk/bootloader/yast2-bootloader.spec.in Thu Apr 2 10:41:25 2009 @@ -14,7 +14,7 @@ BuildRequires: yast2 >= 2.17.36 BuildRequires: yast2-packager >= 2.17.24 BuildRequires: yast2-pkg-bindings >= 2.17.25 -BuildRequires: perl-Bootloader >= 0.4.80 +BuildRequires: perl-Bootloader >= 0.4.91 %ifarch %ix86 x86_64 Requires: master-boot-code -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
jreidinger@svn.opensuse.org