Author: snwint
Date: Mon Apr 23 11:51:38 2012
New Revision: 67987
URL: http://svn.opensuse.org/viewcvs/yast?rev=67987&view=rev
Log:
- add files to repo
Added:
trunk/bootloader/src/grub2/helps.ycp
trunk/bootloader/src/grub2/options.ycp
Added: trunk/bootloader/src/grub2/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub2/helps.ycp?rev=67987&view=auto
==============================================================================
--- trunk/bootloader/src/grub2/helps.ycp (added)
+++ trunk/bootloader/src/grub2/helps.ycp Mon Apr 23 11:51:38 2012
@@ -0,0 +1,43 @@
+/**
+ * File:
+ * include/bootloader/grup2/helps.ycp
+ *
+ * Module:
+ * Bootloader installation and configuration
+ *
+ * Summary:
+ * Help and label strings for bootloader installation and configuration
+ *
+ * Authors:
+ * Joachim Plack
+ *
+ * $Id: helps.ycp 58279 2009-08-04 16:01:51Z juhliarik $
+ *
+ */
+
+{
+textdomain "bootloader";
+
+global map grub2_help_messages = $[
+ "append" :
+ _("<p><b>Optional Kernel Command Line Parameter</b> lets you define additional parameters to pass to the kernel.</p>"),
+ "vgamode" :
+ _("<p><b>Vga Mode</b> defines the VGA mode the kernel should set the <i>console</i> to when booting.</p>"),
+];
+
+global map grub2_descriptions = $[
+ "append" : _("O&ptional Kernel Command Line Parameter"),
+ "vgamode" : _("&Vga Mode"),
+];
+
+} //EOF
+
+/*
+ * Local variables:
+ * mode: ycp
+ * mode: font-lock
+ * mode: auto-fill
+ * indent-level: 4
+ * fill-column: 78
+ * End:
+ */
Added: trunk/bootloader/src/grub2/options.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub2/options.ycp?rev=67987&view=auto
==============================================================================
--- trunk/bootloader/src/grub2/options.ycp (added)
+++ trunk/bootloader/src/grub2/options.ycp Mon Apr 23 11:51:38 2012
@@ -0,0 +1,150 @@
+/**
+ * File:
+ * include/bootloader/routines/grub2/options.ycp
+ *
+ * Module:
+ * Bootloader installation and configuration
+ *
+ * Summary:
+ * Grub2 widgets for bootloader options.
+ *
+ * Authors:
+ * Josef Reidinger
+ *
+ * $Id: $
+ *
+ */
+
+{
+textdomain "bootloader";
+
+import "Label";
+import "Initrd";
+import "System::Bootloader_API";
+
+include "bootloader/routines/common_options.ycp";
+include "bootloader/grub/helps.ycp";
+include "bootloader/grub2/helps.ycp";
+
+/**
+ * Init function of widget
+ * @param widget any id of the widget
+ */
+void VgaModeInit (string widget) {
+ list<map> vga_modes = Initrd::VgaModes ();
+ list items = maplist (map m, vga_modes, {
+ return `item (`id (sformat ("%1", tohexstring(m["mode"]:0))),
+ // combo box item
+ // %1 is X resolution (width) 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, 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")));
+ items = prepend (items, `item (`id (""), _("Unspecified")));
+ UI::ChangeWidget (`id (widget), `Items, items);
+ InitGlobalStr (widget);
+}
+
+void DefaultEntryInit (string widget) {
+ list items = [];
+
+ foreach (map s, BootCommon::sections, {
+ items = add (items, `item(`id(s["menuentry"]:""), s["menuentry"]:""));
+ });
+
+ UI::ChangeWidget (`id (widget), `Items, items);
+ InitGlobalStr (widget);
+ return;
+}
+
+/**
+ * Init function for console
+ * @param string widget
+ */
+void ConsoleInit(string widget){
+ boolean enable = BootCommon::globals["terminal"]:"" == "serial";
+ UI::ChangeWidget(`id(`console_frame),`Value, enable);
+ string args = BootCommon::globals["serial"]:"";
+ UI::ChangeWidget(`id(`console_args),`Value, args);
+}
+
+/**
+ * Store function of a console
+ * @param widget any widget key
+ * @param event map event description of event that occured
+ */
+void ConsoleStore(string widget, map event){
+ boolean use_serial = (boolean) UI::QueryWidget(`id(`console_frame),`Value);
+ if (use_serial)
+ {
+ BootCommon::globals["terminal"] = "serial";
+ string console_value = (string) UI::QueryWidget(`id(`console_args),`Value);
+ if (console_value != "")
+ BootCommon::globals["serial"] = console_value;
+ } else {
+ if (haskey(BootCommon::globals, "terminal"))
+ BootCommon::globals = remove(BootCommon::globals, "terminal");
+ if (haskey(BootCommon::globals, "serial"))
+ BootCommon::globals = remove(BootCommon::globals, "serial");
+ }
+
+ // FATE: #110038: Serial console
+ // add or remove console key with value for sections
+ BootCommon::HandleConsole2();
+}
+
+map > Grub2Options(){
+ map > grub2_specific = $[
+ "activate" : CommonCheckboxWidget(grub_descriptions["activate"]:"activate",
+ grub_help_messages["activate"]:""),
+ "generic_mbr" : CommonCheckboxWidget(grub_descriptions["generic_mbr"]:"generic mbr",
+ grub_help_messages["generic_mbr"]:""),
+ "hiddenmenu" : CommonCheckboxWidget(grub_descriptions["hiddenmenu"]:"hidden menu",
+ grub_help_messages["hiddenmenu"]:""),
+ "append" : CommonInputFieldWidget(grub2_descriptions["append"]:"append",
+ grub2_help_messages["append"]:""),
+ "vgamode" : $[
+ "widget" : `combobox,
+ "label" : grub2_descriptions["vgamode"]:"vgamode",
+ "opt" : [ `editable, `hstretch ],
+ "init" : VgaModeInit,
+ "store" : StoreGlobalStr,
+ "help" : grub2_help_messages["vgamode"]:"",
+ ],
+
+ "default" : $[
+ "widget" : `combobox,
+ "label" : grub_descriptions["default"]:"default",
+ "opt" : [ `editable, `hstretch ],
+ "init" : DefaultEntryInit,
+ "store" : StoreGlobalStr,
+ "help" : grub_help_messages["default"]:"",
+ ],
+
+ "console" : $[
+ "widget" : `custom,
+ "custom_widget" : `HBox(
+ `CheckBoxFrame(`id(`console_frame),_("Use &serial console"),true,
+ `HBox(
+ `HSpacing(2),
+ `InputField(`id(`console_args),`opt(`hstretch), _("&Console arguments")),
+ `HStretch()))
+ ),
+ "init" : ConsoleInit,
+ "store" : ConsoleStore,
+ "help" : grub_help_messages["serial"]:""
+ ],
+
+ ];
+
+ return (map >)union(grub2_specific,CommonOptions());
+}
+
+}
+
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org