Mailinglist Archive: yast-commit (1212 mails)
| < Previous | Next > |
[yast-commit] r50815 - in /trunk/bootloader/src: config/ generic/ grub/ modules/ routines/
- From: juhliarik@xxxxxxxxxxxxxxxx
- Date: Mon, 08 Sep 2008 15:01:09 -0000
- Message-id: <20080908150109.AC9BA30CA2@xxxxxxxxxxxxxxxx>
Author: juhliarik
Date: Mon Sep 8 17:01:09 2008
New Revision: 50815
URL: http://svn.opensuse.org/viewcvs/yast?rev=50815&view=rev
Log:
added support for trusted grub
M bootloader/src/grub/helps.ycp
* added help text
A bootloader/src/grub/trusted_grub_edit.ycp
* added new UI for detail editing measured files
M bootloader/src/grub/Makefile.am
* update makefile
M bootloader/src/config/bootloader.rnc
* update autoyast profile of bootloader
M bootloader/src/modules/BootCommon.ycp
* update import/export
M bootloader/src/modules/BootGRUB.ycp
* added new dialog
M bootloader/src/routines/lib_iface.ycp
M bootloader/src/modules/Bootloader_API.pm
* changed type of map section from map <string, string> to
map <string, any>
M bootloader/src/routines/section_widgets.ycp
* update UI
M bootloader/src/routines/misc.ycp
* added new function for handling import/export
M bootloader/src/routines/helps.ycp
* update help text
M bootloader/src/generic/boot_loader_locations_widget.ycp
M bootloader/src/generic/global_options_widget.ycp
M bootloader/src/generic/wizards.ycp
* update UI
Added:
trunk/bootloader/src/grub/trusted_grub_edit.ycp
Modified:
trunk/bootloader/src/config/bootloader.rnc
trunk/bootloader/src/generic/boot_loader_locations_widget.ycp
trunk/bootloader/src/generic/global_options_widget.ycp
trunk/bootloader/src/generic/wizards.ycp
trunk/bootloader/src/grub/Makefile.am
trunk/bootloader/src/grub/helps.ycp
trunk/bootloader/src/modules/BootCommon.ycp
trunk/bootloader/src/modules/BootGRUB.ycp
trunk/bootloader/src/modules/Bootloader_API.pm
trunk/bootloader/src/routines/helps.ycp
trunk/bootloader/src/routines/lib_iface.ycp
trunk/bootloader/src/routines/misc.ycp
trunk/bootloader/src/routines/section_widgets.ycp
Modified: trunk/bootloader/src/config/bootloader.rnc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/config/bootloader.rnc?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/config/bootloader.rnc (original)
+++ trunk/bootloader/src/config/bootloader.rnc Mon Sep 8 17:01:09 2008
@@ -43,6 +43,7 @@
element global {
element boot_custom { text }? &
element generic_mbr { text }? &
+ element trusted_grub{ text }? &
element serial { text }? &
element terminal { text }? &
lines_cache_id? &
@@ -55,6 +56,7 @@
boot_mbr? &
stage1_dev?
}
+
lines_cache_id = element lines_cache_id { text }
stage1_dev = element stage1_dev { text }
bl_timeout = element timeout { INTEGER }
@@ -88,6 +90,7 @@
element sectors {text}? &
element blockoffset {text}? &
element vgamode {text}? &
+ element measures ? &
element xen {text}? &
element xen_append {text}? &
element noverifyroot { "true" | "false" }? &
@@ -97,3 +100,15 @@
element image {text}?
}
kernel_parameters = element kernel_parameters { text }
+
+measure =
+ element measure {
+ element file { text } &
+ element pcr { text }
+ }
+
+measures =
+ element measures {
+ LIST,
+ measure+
+}
Modified: trunk/bootloader/src/generic/boot_loader_locations_widget.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/generic/boot_loader_locations_widget.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/generic/boot_loader_locations_widget.ycp (original)
+++ trunk/bootloader/src/generic/boot_loader_locations_widget.ycp Mon Sep 8
17:01:09 2008
@@ -32,6 +32,12 @@
map<string,any> _bll_options = nil;
/**
+ * option once propose
+ */
+
+boolean once_to_mbr = true;
+
+/**
* return map of boot loader options from global_options, cache them if
* necessary
*/
@@ -53,6 +59,13 @@
* @param widget string widget key
*/
void BLL_Init (string widget) {
+ // propose install grub to MBR if trusted GRUB is selected (only once)
+
+ if ((BootCommon::globals["trusted_grub"]:"" == "true") && (once_to_mbr))
+ {
+ BootCommon::globals["boot_mbr"] = "true";
+ once_to_mbr = false;
+ }
generic_Init(widget, BLL_options(), BootCommon::globals);
}
Modified: trunk/bootloader/src/generic/global_options_widget.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/generic/global_options_widget.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/generic/global_options_widget.ycp (original)
+++ trunk/bootloader/src/generic/global_options_widget.ycp Mon Sep 8 17:01:09
2008
@@ -30,6 +30,21 @@
map<string,any> _gow_options = nil;
map<string,any> GOW_options () {
+ // HACK add checkbox for enabling trusted GRUB
+ if (BootCommon::getLoaderType (false) == "grub")
+ {
+ BootCommon::global_options["trusted_grub"] = "bool:Use Trusted
Grub:true";
+ } else {
+ if (haskey(BootCommon::global_options, "trusted_grub"))
+ BootCommon::global_options = remove(BootCommon::global_options,
"trusted_grub");
+ }
+ // HACK delete fallback and former_default_image_flavor
+ if (haskey(BootCommon::global_options, "former_default_image_flavor"))
+ BootCommon::global_options = remove(BootCommon::global_options,
"former_default_image_flavor");
+
+ if (haskey(BootCommon::global_options, "fallback"))
+ BootCommon::global_options = remove(BootCommon::global_options,
"fallback");
+
if ( _gow_options == nil)
{
_gow_options = filter( string key, any value,
BootCommon::global_options, {
Modified: trunk/bootloader/src/generic/wizards.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/generic/wizards.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/generic/wizards.ycp (original)
+++ trunk/bootloader/src/generic/wizards.ycp Mon Sep 8 17:01:09 2008
@@ -54,13 +54,12 @@
}
string se_type = "section_edit_" + type;
map<string,map<string,any> > widget_descr = (map<string,map<string,any> >)
- union (CommonSectionWidgets (), Bootloader::blWidgetMaps ());
+ union (CommonSectionWidgets (), Bootloader::blWidgetMaps ());
if (! haskey(widget_descr, se_type) ) {
y2error("Could not find a dialog %1", se_type);
return nil;
}
-
term contents = `HBox (
`HSpacing (2),
`VBox (
@@ -78,6 +77,8 @@
`HSpacing (2)
)
),
+ "trusted",
+
`VStretch ()
),
`HSpacing (2)
@@ -85,7 +86,7 @@
return CWM::ShowAndRun ($[
"widget_descr" : widget_descr,
- "widget_names" : ["name", se_type],
+ "widget_names" : ["name", "trusted", se_type],
"contents" : contents,
"caption" : _("Boot Loader Settings: Section Management"),
"back_button" : Label::BackButton (),
@@ -135,6 +136,7 @@
"main" : ``(MainDialog ()),
"installation_details" : ``(DetailsDialog ("installation")),
"loader_details" : ``(DetailsDialog ("loader")),
+ "t_grub" : ``(DetailsDialog ("trusted_grub")),
"add_new_section" : ``(AddNewSectionDialog ()),
"store_section" : [``(GenericStoreSection ()), true],
"manual_edit" : ``(runEditFilesDialog ()),
@@ -178,8 +180,15 @@
],
"section_edit" : $[
`next : "store_section",
+ `trusted_details : "t_grub",
+ `abort : `abort,
+ ],
+ "t_grub" : $[
+ `next : "section_edit",
+ //FIXME kokso: it is good idea handle abort via "section_edit" not
`abort
`abort : `abort,
],
+
];
foreach (string st, section_types(), {
Modified: trunk/bootloader/src/grub/Makefile.am
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/Makefile.am?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/grub/Makefile.am (original)
+++ trunk/bootloader/src/grub/Makefile.am Mon Sep 8 17:01:09 2008
@@ -6,7 +6,8 @@
ynclude_DATA = \
helps.ycp \
- misc.ycp
+ misc.ycp \
+ trusted_grub_edit.ycp
EXTRA_DIST = \
$(ynclude_DATA)
Modified: trunk/bootloader/src/grub/helps.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/helps.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/grub/helps.ycp (original)
+++ trunk/bootloader/src/grub/helps.ycp Mon Sep 8 17:01:09 2008
@@ -44,6 +44,9 @@
"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>"),
+ "trusted_grub" :
+_("<p><b>Use Trusted Grub</b> means install trusted grub and use it. Option
<i>Grafical Menu File</i> will be ignored.
+It is recommended to install grub to MBR</p>"),
"boot_mbr" :
_("<p><b>Boot from Master Boot Record</b> is not recommended if you have
another operating system
installed on your computer</p>"),
@@ -124,6 +127,16 @@
_("<p><b>Menu Description File<b></p>"),
"other_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> ,
+<b>Edit</b> and <b>Delete</b></p>"),
+ "PCRKernelHelp" :
+ _("<p><b>PCR Index of Kernel<b> is Platform Configuration Register for
kernel</p>"),
+ "PCRInitrdHelp" :
+ _("<p><b>PCR Index of Kernel<b> is Platform Configuration Register for
initrd</p>"),
+ "PCRChainloaderHelp" :
+ _("<p><b>PCR Index of Kernel<b> is Platform Configuration Register for
chainloader</p>"),
+
];
@@ -133,6 +146,7 @@
"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"),
Added: trunk/bootloader/src/grub/trusted_grub_edit.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/trusted_grub_edit.ycp?rev=50815&view=auto
==============================================================================
--- trunk/bootloader/src/grub/trusted_grub_edit.ycp (added)
+++ trunk/bootloader/src/grub/trusted_grub_edit.ycp Mon Sep 8 17:01:09 2008
@@ -0,0 +1,356 @@
+{
+
+textdomain "bootloader";
+
+import "CWM";
+import "Label";
+import "BootCommon";
+import "Popup";
+
+include "bootloader/grub/helps.ycp";
+
+
+/**
+ * Init function of widget
+ * @param widget string id of the widget
+ */
+
+void InitMeasuresTable(string widget)
+{
+ map <string, string> meas = BootCommon::current_section["measure"]:$[];
+ list measures = [];
+
+ foreach(string file, string pcr, meas, {
+ measures = add(measures, `item(`id(file), file, pcr));
+ });
+
+ UI::ChangeWidget (`id (`measures), `Items, measures);
+}
+
+
+
+void AddEditMeasure (string file, string pcr)
+{
+ map <string, string> meas = BootCommon::current_section["measure"]:$[];
+ string orig_file = file;
+ any ret = nil;
+
+ if (pcr == "")
+ pcr ="8";
+
+ UI::OpenDialog( (file != "") ? `Label( _("Edit Measure")): `Label( _("Add
New Measure") ),
+ `VBox(
+ `HBox(
+ `InputField(`id(`measur), _("Measure File"), file),
+ `VBox ( `Label(""),
+ `PushButton(`id(`br), Label::BrowseButton())
+ )
+ ),
+ `Left(`IntField(`id(`pcr), _("PCR Index of File"),0, 100,
tointeger(pcr))),
+ `HBox(
+ `PushButton(`id(`cancel), Label::CancelButton()),
+ `PushButton(`id(`ok), Label::OKButton())
+ )
+ )
+ ); // end of UI::OpenDialog(
+
+ while (true) {
+ ret = UI::UserInput();
+ if (ret == `br) {
+ string val = UI::AskForExistingFile ("/","*.*",_("Please Select
File"));
+ UI::ChangeWidget(`id(`measur), `Value, val);
+ } else if ( ret == `ok ) {
+ string new_file = tostring(UI::QueryWidget(`id(`measur), `Value));
+ string new_pcr = tostring(UI::QueryWidget(`id(`pcr), `Value));
+ if (file != "")
+ {
+ meas = remove(meas, file);
+ }
+ meas[new_file] = new_pcr;
+ break;
+ } else if (ret == `cancel) {
+ break;
+ }
+ };
+ BootCommon::current_section["measure"] = meas;
+
+ UI::CloseDialog();
+}
+
+/**
+ * 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
+ */
+symbol HandleMeasuresTable (string widget, map event)
+{
+
+ any op = event["ID"]:nil;
+ if (event["ID"]:nil == `measures
+ && event["EventReason"]:"" == "Activated"
+ && event["EventType"]:"" == "WidgetEvent")
+ {
+ op = `edit;
+ }
+ map <string, string> meas = BootCommon::current_section["measure"]:$[];
+
+ string current = (string)UI::QueryWidget (`id (`measures), `CurrentItem);
+ string act_file = "";
+ string act_pcr = "";
+
+ if ((current != nil) && (current != ""))
+ {
+ act_file = current;
+ act_pcr = meas[current]:"";
+ }
+ if (op == `add)
+ {
+ AddEditMeasure("", "");
+ InitMeasuresTable(widget);
+ } else if (op == `edit) {
+
+ AddEditMeasure(act_file, act_pcr);
+ InitMeasuresTable(widget) ;
+ } else if (op == `delete) {
+ string message = sformat(_("Really delete measured file: %1 with PCR:
%2 ?"), act_file, act_pcr);
+ if (Popup::YesNo(message))
+ {
+ meas = remove(meas,act_file);
+ BootCommon::current_section["measure"] = meas;
+ InitMeasuresTable(widget);
+ }
+ }
+
+}
+/**
+ * Store function of a widget
+ * @param widget string widget key
+ * @param event map event that caused the operation
+ */
+void StoreMeasuresTable (string widget, map event)
+{
+ if ((size(BootCommon::current_section["measure"]:$[]) == 0) &&
+ (haskey(BootCommon::current_section, "measure")))
+ BootCommon::current_section = remove(BootCommon::current_section,
"measure");
+}
+
+/**
+ * Init function of widget
+ * @param widget string id of the widget
+ */
+
+void InitPCRKernel (string widget) {
+ if ((BootCommon::current_section["type"]:"" == "image") ||
(BootCommon::current_section["type"]:"" == "xen"))
+ {
+ UI::ChangeWidget (`id ("PCRKernel"), `Enabled, true);
+ UI::ChangeWidget (`id ("PCRKernel"), `Value,
tointeger(BootCommon::current_section["imagepcr"]:"8"));
+ } else {
+ UI::ChangeWidget (`id ("PCRKernel"), `Enabled, false);
+ }
+}
+
+
+/**
+ * Store function of a widget
+ * @param widget string widget key
+ * @param event map event that caused the operation
+ */
+void StorePCRKernel (string widget, map event) {
+ if ((BootCommon::current_section["type"]:"" == "image") ||
+ (BootCommon::current_section["type"]:"" == "xen"))
+ BootCommon::current_section["imagepcr"] = tostring(UI::QueryWidget (`id
("PCRKernel"), `Value));
+}
+
+/**
+ * Init function of widget
+ * @param widget string id of the widget
+ */
+
+void InitPCRInitrd (string widget) {
+ if ((BootCommon::current_section["type"]:"" == "image") ||
(BootCommon::current_section["type"]:"" == "xen"))
+ {
+ UI::ChangeWidget (`id ("PCRInitrd"), `Enabled, true);
+ UI::ChangeWidget (`id ("PCRInitrd"), `Value,
tointeger(BootCommon::current_section["initrdpcr"]:"8"));
+ } else {
+ UI::ChangeWidget (`id ("PCRInitrd"), `Enabled, false);
+ }
+}
+
+
+/**
+ * Store function of a widget
+ * @param widget string widget key
+ * @param event map event that caused the operation
+ */
+void StorePCRInitrd (string widget, map event) {
+ if ((BootCommon::current_section["type"]:"" == "image") ||
+ (BootCommon::current_section["type"]:"" == "xen"))
+ BootCommon::current_section["initrdpcr"] = tostring(UI::QueryWidget
(`id ("PCRInitrd"), `Value));
+}
+
+
+
+/**
+ * Init function of widget
+ * @param widget string id of the widget
+ */
+
+void InitPCRChainloader (string widget) {
+ if (BootCommon::current_section["type"]:"" != "other")
+ UI::ChangeWidget (`id ("PCRChainloader"), `Enabled, false);
+ else
+ UI::ChangeWidget (`id ("PCRChainloader"), `Value,
tointeger(BootCommon::current_section["chainloaderpcr"]:"8"));
+}
+
+
+/**
+ * Store function of a widget
+ * @param widget string widget key
+ * @param event map event that caused the operation
+ */
+void StorePCRChainloader (string widget, map event) {
+ if (BootCommon::current_section["type"]:"" == "other")
+ BootCommon::current_section["chainloaderpcr"] =
tostring(UI::QueryWidget (`id ("PCRChainloader"), `Value));
+}
+
+
+
+map<string,map<string,any> > wid_handling = $[
+
+
+ "MeasuresTable" : $[
+ //TRANSLATORS: RadioButtonGroup Label
+ "label" : _("Measurement of Grub"),
+ "widget" : `custom,
+ "custom_widget" : `VBox(`Frame (_("Measures"),
+ `HBox (`HSpacing (2), `VBox (
+ `VSpacing (1),
+ `Table (`id (`measures),
+ `opt (`keepSorting, `notify),
+ `header (
+ // table header, Measure
+ _("Measure"),
+ // table header, PCR
+ _("PCR")
+ ), []
+ ),
+
+ `HBox (
+ `HStretch (),
+ `PushButton (`id (`add), `opt (`key_F3),
Label::AddButton ()),
+ `PushButton (`id (`edit), `opt(`key_F5),
Label::EditButton ()),
+ `PushButton (`id (`delete), `opt(`key_F5),
Label::DeleteButton ()),
+ `HStretch ()
+ ),
+ `VSpacing (1)
+ )
+
+ )
+ )),
+ "init" : InitMeasuresTable,
+ "handle" : HandleMeasuresTable,
+ "store" : StoreMeasuresTable,
+ "help" : grub_help_messages["MeasuresTableHelp"]:"",
+
+ ],
+
+ "PCRKernel" : $[
+ //TRANSLATORS: IntField Label
+ "label" : _("PCR Index of &Kernel"),
+ "widget" : `intfield,
+ "minimum" : 0,
+ "maximum" : 100,
+ "init" : InitPCRKernel,
+ //"handle" :
+ "store" : StorePCRKernel,
+ "help" : grub_help_messages["PCRKernelHelp"]:"",
+ ],
+
+
+
+ "PCRInitrd" : $[
+ //TRANSLATORS: IntField Label
+ "label" : _("PCR Index of &Initrd"),
+ "widget" : `intfield,
+ "minimum" : 0,
+ "maximum" : 100,
+ "init" : InitPCRInitrd,
+ //"handle" :
+ "store" : StorePCRInitrd,
+ "help" : grub_help_messages["PCRInitrdHelp"]:"",
+ ],
+
+
+ "PCRChainloader" : $[
+ //TRANSLATORS: IntField Label
+ "label" : _("PCR &Index of Chainloader"),
+ "widget" : `intfield,
+ "minimum" : 0,
+ "maximum" : 100,
+ "init" : InitPCRChainloader,
+ //"handle" :
+ "store" : StorePCRChainloader,
+ "help" : grub_help_messages["PCRChainloaderHelp"]:"",
+ ],
+
+];
+
+
+
+
+symbol TrustedGrubDetails () {
+ y2milestone ("Running i386 loader details dialog");
+
+ term contents = `HBox (`HSpacing (2), `VBox (
+ "MeasuresTable",
+ `VSpacing (1),
+ "PCRKernel",
+ `VSpacing (1),
+ "PCRInitrd",
+ `VSpacing (1),
+ "PCRChainloader",
+ `VStretch ()
+ ), `HSpacing (2));
+
+ list<string> widget_names = ["MeasuresTable", "PCRKernel", "PCRInitrd",
"PCRChainloader",];
+ map<string,map<string,any> > widget_descr = wid_handling;
+ // dialog caption
+ string caption = _("Trusted GRUB Options");
+ 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 (),
+ ]);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
Modified: trunk/bootloader/src/modules/BootCommon.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootCommon.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootCommon.ycp (original)
+++ trunk/bootloader/src/modules/BootCommon.ycp Mon Sep 8 17:01:09 2008
@@ -118,6 +118,13 @@
*/
global string BootPartitionDevice = "";
+
+/**
+ * The variable indicate using of trusted GRUB
+ */
+
+global boolean isTrustedGrub = true;
+
/**
* string representing device name of / partition
*/
@@ -654,7 +661,8 @@
*/
global define boolean Import (map settings) {
globals = settings["global"]:$[];
- sections = settings["sections"]:[];
+ sections = importSections(settings["sections"]:[]);
+
// FIXME: for grub, repl_mbr is replaced by globals["generic_mbr"]; same
// for activate; remove the following when no bootloader uses these
// variables any more
@@ -792,11 +800,12 @@
// FATE: #110038: Serial console
// check and add console key with value for sections
addConsole();
+ /*
list<map<string,string> > sects = maplist (map<string,any> s, sections, {
return (map<string,string>)
filter (string k, any v, s, { return is (v, string); });
});
-
+ */
/* it is done
// convert root device names in sections to the device names indicated by
// "mountby"
@@ -831,7 +840,7 @@
});
ret = ret && SetDeviceMap (my_device_mapping);
- ret = ret && SetSections (sects);
+ ret = ret && SetSections (sections);
ret = ret && SetGlobal (my_globals);
if (flush)
{
@@ -1070,6 +1079,16 @@
bootloader_packages = bootloader_attribs[bootloader,
"required_packages"]:[];
}
+ //FIXME kokso: it is important deselect grub from installation proposal
not only delete from bootloader_packages
+ if (globals["trusted_grub"]:"" == "true")
+ {
+ bootloader_packages = bootloader_attribs[bootloader,
"trustedgrub", "required_packages"]:[];
+ if (contains(bootloader_packages, "grub"))
+ bootloader_packages = filter(string key,
bootloader_packages, {return (key !="grub"); });
+
+ bootloader_packages = add(bootloader_packages, "trustedgrub");
+ }
+
// don't configure package manager during autoinstallation preparing
if (Mode::normal () && (! (Mode::config () || Mode::repair ())))
{
Modified: trunk/bootloader/src/modules/BootGRUB.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootGRUB.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootGRUB.ycp (original)
+++ trunk/bootloader/src/modules/BootGRUB.ycp Mon Sep 8 17:01:09 2008
@@ -63,7 +63,7 @@
include "bootloader/grub/helps.ycp";
include "bootloader/generic/device_map_edit_widget.ycp";
include "bootloader/generic/dialogs.ycp";
-
+include "bootloader/grub/trusted_grub_edit.ycp";
// end of mandatory functions
//----------------------------------------------------------------------------
@@ -281,12 +281,12 @@
BootCommon::InitializeLibrary (false, "grub");
BootCommon::SetFilesContents (files);
- list<map<string,string> > sects
+ list<map<string,any> > sects
= BootCommon::GetSections ();
y2debug ("Found sections %1", sects);
// look only for "default" == "initial" entries, not all
entries
- sects = filter (map<string,string> s, sects, {
+ sects = filter (map<string,any> s, sects, {
return s["initial"]:nil != nil;
});
@@ -762,6 +762,7 @@
return $[
"installation" : i386InstallDetailsDialog,
"loader" : genericBootLoaderOptionsDialog,
+ "trusted_grub" : TrustedGrubDetails,
];
}
Modified: trunk/bootloader/src/modules/Bootloader_API.pm
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/Bootloader_API.pm?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/modules/Bootloader_API.pm (original)
+++ trunk/bootloader/src/modules/Bootloader_API.pm Mon Sep 8 17:01:09 2008
@@ -197,7 +197,7 @@
return $ret;
}
-BEGIN { $TYPEINFO{getSections} = ["function", ["list", ["map", "string",
"string"]]]; }
+BEGIN { $TYPEINFO{getSections} = ["function", ["list", ["map", "string",
"any"]]]; }
sub getSections() {
my @sections = @{$lib_ref->GetSections () || []};
@@ -214,7 +214,7 @@
return \@sections;
}
-BEGIN { $TYPEINFO{setSections} = ["function", "boolean", ["list", ["map",
"string", "string"]]]; }
+BEGIN { $TYPEINFO{setSections} = ["function", "boolean", ["list", ["map",
"string", "any"]]]; }
sub setSections($) {
my ($sections) = @_;
Modified: trunk/bootloader/src/routines/helps.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/helps.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/routines/helps.ycp (original)
+++ trunk/bootloader/src/routines/helps.ycp Mon Sep 8 17:01:09 2008
@@ -304,4 +304,17 @@
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/lib_iface.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/lib_iface.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/routines/lib_iface.ycp (original)
+++ trunk/bootloader/src/routines/lib_iface.ycp Mon Sep 8 17:01:09 2008
@@ -151,16 +151,16 @@
* @param sections a list of all loader sections (as maps)
* @return boolean true on success
*/
-global boolean SetSections (list<map<string,string> > sections) {
+global boolean SetSections (list<map<string,any> > sections) {
y2milestone ("Storing bootloader sections %1", sections);
- sections = maplist (map<string,string> s, sections, {
+ /*sections = maplist (map<string,string> s, sections, {
s["__modified"] = "1";
s = filter (string key, string value, s, {
return (! is (value, string)) || (value != "");
});
return s;
- });
+ });*/
boolean ret = System::Bootloader_API::setSections (sections);
if (! ret)
y2error ("Storing bootloader sections failed");
@@ -171,9 +171,9 @@
* Get boot loader sections
* @return a list of all loader sections (as maps)
*/
-global list<map<string,string> > GetSections () {
+global list<map<string,any> > GetSections () {
y2milestone ("Reading bootloader sections");
- list<map<string,string> > sects = System::Bootloader_API::getSections ();
+ list<map<string,any> > sects = System::Bootloader_API::getSections ();
if (sects == nil)
{
y2error ("Reading sections failed");
Modified: trunk/bootloader/src/routines/misc.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/misc.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/routines/misc.ycp (original)
+++ trunk/bootloader/src/routines/misc.ycp Mon Sep 8 17:01:09 2008
@@ -323,7 +323,8 @@
global map<string,string> remapDeviceMap(map<string,string> device_map)
{
symbol by_mount = Storage::GetDefaultMountBy();
-
+
+ //symbol by_mount = `id;
if (by_mount == `label)
return device_map;
@@ -347,7 +348,7 @@
global map<string,string> remapGlobals(map<string,string> globals_set)
{
symbol by_mount = Storage::GetDefaultMountBy();
-
+ //symbol by_mount = `id;
if (by_mount == `label)
return globals_set;
@@ -410,16 +411,97 @@
}
/**
+ * Function remap measure in section to autoyast format
+ *
+ * @param map<string,string> map of measures $["file": "pcr"]
+ * @return list<map<string,string> > list of measures for autoyast format
+ */
+
+list <map <string, string> > remapMeasure(map <string, string> measure)
+{
+ list <map <string, string> > ret = [];
+ if (size(measure) >0)
+ {
+ foreach(string k, string v, measure,
+ {
+ map <string, string> tmp_map = $[];
+ tmp_map["file"] = k;
+ tmp_map["pcr"] = v;
+ ret = add(ret,tmp_map);
+ });
+ }
+
+ return ret;
+}
+
+
+/**
+ * Function remap measure in section from autoyast format
+ *
+ * @param list<map<string,string> > list of measures [$["file": "/tmp/file1",
"pcr" : "8"]]
+ * @return map<string,string> map of measures
+ */
+
+map <string, string> importMeasure(list<map<string, string> > measure)
+{
+ map <string, string> ret = $[];
+ if (size(measure) >0)
+ {
+ maplist(map <string, string> m, measure,
+ {
+ string file = m["file"]:"";
+ string pcr = m["pcr"]:"";
+ ret[file]=pcr;
+ });
+ }
+
+ return ret;
+}
+
+
+/**
* Function remap section "root" and "resume" to device name (/dev/sda)
* or to label (ufo_partition)
* @param list<map<string,any> > list of sections
* @return list<map<string,any> > list of sections
*/
+global list<map<string,any> > importSections(list<map<string,any> >sec)
+{
+ y2debug("import section before remapping %1", sec);
+ list<map<string,any> >temp_sec = [];
+ temp_sec = maplist (map<string,any> s, sec,
+ {
+
+ if (haskey(s,"measures"))
+ {
+ map <string, string> tmp = $[];
+ tmp = importMeasure(s["measures"]:[]);
+ s = remove(s,"measures");
+ if (size(tmp) > 0)
+ s["measure"]=tmp;
+ }
+
+ return s;
+ });
+ y2debug("import section after remapping %1", temp_sec);
+ return temp_sec;
+}
+
+
+
+
+/**
+ * Function remap section "root" and "resume" to device name (/dev/sda)
+ * or to label (ufo_partition)
+ * it also prepared measured files for export
+ * @param list<map<string,any> > list of sections
+ * @return list<map<string,any> > list of sections
+ */
global list<map<string,any> > remapSections(list<map<string,any> >sec)
{
symbol by_mount = Storage::GetDefaultMountBy();
-
+ //symbol by_mount = `id;
if (by_mount == `label)
return sec;
@@ -443,6 +525,15 @@
if (s["chainloader"]:"" != "")
s["chainloader"] =
BootCommon::MountByDev2Dev(s["chainloader"]:"");
+ if (haskey(s,"measure"))
+ {
+ list <map <string, string> > tmp =[];
+ tmp = remapMeasure(s["measure"]:$[]);
+ s = remove(s,"measure");
+ if (size(tmp) > 0)
+ s["measures"]=tmp;
+ }
+
return s;
});
@@ -466,7 +557,7 @@
// (`id,`uuid,`path,`device,`label)
symbol by_mount = Storage::GetDefaultMountBy();
-
+ //symbol by_mount = `id;
y2milestone("Default mount by is %1", by_mount);
map<string,map> devices = (map<string,map>)Storage::GetTargetMap();
Modified: trunk/bootloader/src/routines/section_widgets.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/section_widgets.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/routines/section_widgets.ycp (original)
+++ trunk/bootloader/src/routines/section_widgets.ycp Mon Sep 8 17:01:09 2008
@@ -28,6 +28,7 @@
import "Storage";
import "StorageDevices";
import "TablePopup";
+import "Popup";
include "bootloader/routines/helps.ycp";
@@ -325,6 +326,46 @@
return nil;
}
+
+/**
+ * Init function of widget
+ * @param widget any id of the widget
+ */
+void InitTrustedDetails (string widget) {
+
+ if (BootCommon::globals["trusted_grub"]:"" != "true")
+ UI::ChangeWidget (`id ("trusted"), `Enabled, false);
+
+}
+
+
+
+/**
+ * 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
+ */
+symbol TrustedDetailsButtonHandle (string widget, map event) {
+
+ string lt = Bootloader::getLoaderType ();
+ if (lt == "none" || lt == "default")
+ {
+ NoLoaderAvailable ();
+ return nil;
+ }
+
+ return `trusted_details;
+}
+/**
+ * Store function of the root device widget
+ * @param widget any widget key
+ * @param event map event description of event that occured
+ */
+void StoreTrustedDetails (string widget, map event) {
+ y2debug("Fake store function for trusted GRUB");
+
+}
/**
* Cache for CommonSectionWidgets
*/
@@ -335,6 +376,7 @@
* @return a map describing common loader section related widgets
*/
map<string,map<string,any> > CommonSectionWidgets () {
+
if (_common_section_widgets == nil)
{
_common_section_widgets = $[
@@ -442,8 +484,21 @@
"handle" : SectionTypeHandle,
"help" : SectionTypeHelp (),
],
+
];
}
+
+ _common_section_widgets["trusted"] = $[
+ "widget" : `push_button,
+ // push button
+ "label" : _("&Trusted GRUB Details"),
+ "init" : InitTrustedDetails,
+ "handle" : TrustedDetailsButtonHandle,
+ "handle_events" : [ "trusted" ],
+ "store" : StoreTrustedDetails,
+ "help" : TrustedGrubHelp (),
+ ];
+
return _common_section_widgets;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
Date: Mon Sep 8 17:01:09 2008
New Revision: 50815
URL: http://svn.opensuse.org/viewcvs/yast?rev=50815&view=rev
Log:
added support for trusted grub
M bootloader/src/grub/helps.ycp
* added help text
A bootloader/src/grub/trusted_grub_edit.ycp
* added new UI for detail editing measured files
M bootloader/src/grub/Makefile.am
* update makefile
M bootloader/src/config/bootloader.rnc
* update autoyast profile of bootloader
M bootloader/src/modules/BootCommon.ycp
* update import/export
M bootloader/src/modules/BootGRUB.ycp
* added new dialog
M bootloader/src/routines/lib_iface.ycp
M bootloader/src/modules/Bootloader_API.pm
* changed type of map section from map <string, string> to
map <string, any>
M bootloader/src/routines/section_widgets.ycp
* update UI
M bootloader/src/routines/misc.ycp
* added new function for handling import/export
M bootloader/src/routines/helps.ycp
* update help text
M bootloader/src/generic/boot_loader_locations_widget.ycp
M bootloader/src/generic/global_options_widget.ycp
M bootloader/src/generic/wizards.ycp
* update UI
Added:
trunk/bootloader/src/grub/trusted_grub_edit.ycp
Modified:
trunk/bootloader/src/config/bootloader.rnc
trunk/bootloader/src/generic/boot_loader_locations_widget.ycp
trunk/bootloader/src/generic/global_options_widget.ycp
trunk/bootloader/src/generic/wizards.ycp
trunk/bootloader/src/grub/Makefile.am
trunk/bootloader/src/grub/helps.ycp
trunk/bootloader/src/modules/BootCommon.ycp
trunk/bootloader/src/modules/BootGRUB.ycp
trunk/bootloader/src/modules/Bootloader_API.pm
trunk/bootloader/src/routines/helps.ycp
trunk/bootloader/src/routines/lib_iface.ycp
trunk/bootloader/src/routines/misc.ycp
trunk/bootloader/src/routines/section_widgets.ycp
Modified: trunk/bootloader/src/config/bootloader.rnc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/config/bootloader.rnc?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/config/bootloader.rnc (original)
+++ trunk/bootloader/src/config/bootloader.rnc Mon Sep 8 17:01:09 2008
@@ -43,6 +43,7 @@
element global {
element boot_custom { text }? &
element generic_mbr { text }? &
+ element trusted_grub{ text }? &
element serial { text }? &
element terminal { text }? &
lines_cache_id? &
@@ -55,6 +56,7 @@
boot_mbr? &
stage1_dev?
}
+
lines_cache_id = element lines_cache_id { text }
stage1_dev = element stage1_dev { text }
bl_timeout = element timeout { INTEGER }
@@ -88,6 +90,7 @@
element sectors {text}? &
element blockoffset {text}? &
element vgamode {text}? &
+ element measures ? &
element xen {text}? &
element xen_append {text}? &
element noverifyroot { "true" | "false" }? &
@@ -97,3 +100,15 @@
element image {text}?
}
kernel_parameters = element kernel_parameters { text }
+
+measure =
+ element measure {
+ element file { text } &
+ element pcr { text }
+ }
+
+measures =
+ element measures {
+ LIST,
+ measure+
+}
Modified: trunk/bootloader/src/generic/boot_loader_locations_widget.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/generic/boot_loader_locations_widget.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/generic/boot_loader_locations_widget.ycp (original)
+++ trunk/bootloader/src/generic/boot_loader_locations_widget.ycp Mon Sep 8
17:01:09 2008
@@ -32,6 +32,12 @@
map<string,any> _bll_options = nil;
/**
+ * option once propose
+ */
+
+boolean once_to_mbr = true;
+
+/**
* return map of boot loader options from global_options, cache them if
* necessary
*/
@@ -53,6 +59,13 @@
* @param widget string widget key
*/
void BLL_Init (string widget) {
+ // propose install grub to MBR if trusted GRUB is selected (only once)
+
+ if ((BootCommon::globals["trusted_grub"]:"" == "true") && (once_to_mbr))
+ {
+ BootCommon::globals["boot_mbr"] = "true";
+ once_to_mbr = false;
+ }
generic_Init(widget, BLL_options(), BootCommon::globals);
}
Modified: trunk/bootloader/src/generic/global_options_widget.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/generic/global_options_widget.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/generic/global_options_widget.ycp (original)
+++ trunk/bootloader/src/generic/global_options_widget.ycp Mon Sep 8 17:01:09
2008
@@ -30,6 +30,21 @@
map<string,any> _gow_options = nil;
map<string,any> GOW_options () {
+ // HACK add checkbox for enabling trusted GRUB
+ if (BootCommon::getLoaderType (false) == "grub")
+ {
+ BootCommon::global_options["trusted_grub"] = "bool:Use Trusted
Grub:true";
+ } else {
+ if (haskey(BootCommon::global_options, "trusted_grub"))
+ BootCommon::global_options = remove(BootCommon::global_options,
"trusted_grub");
+ }
+ // HACK delete fallback and former_default_image_flavor
+ if (haskey(BootCommon::global_options, "former_default_image_flavor"))
+ BootCommon::global_options = remove(BootCommon::global_options,
"former_default_image_flavor");
+
+ if (haskey(BootCommon::global_options, "fallback"))
+ BootCommon::global_options = remove(BootCommon::global_options,
"fallback");
+
if ( _gow_options == nil)
{
_gow_options = filter( string key, any value,
BootCommon::global_options, {
Modified: trunk/bootloader/src/generic/wizards.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/generic/wizards.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/generic/wizards.ycp (original)
+++ trunk/bootloader/src/generic/wizards.ycp Mon Sep 8 17:01:09 2008
@@ -54,13 +54,12 @@
}
string se_type = "section_edit_" + type;
map<string,map<string,any> > widget_descr = (map<string,map<string,any> >)
- union (CommonSectionWidgets (), Bootloader::blWidgetMaps ());
+ union (CommonSectionWidgets (), Bootloader::blWidgetMaps ());
if (! haskey(widget_descr, se_type) ) {
y2error("Could not find a dialog %1", se_type);
return nil;
}
-
term contents = `HBox (
`HSpacing (2),
`VBox (
@@ -78,6 +77,8 @@
`HSpacing (2)
)
),
+ "trusted",
+
`VStretch ()
),
`HSpacing (2)
@@ -85,7 +86,7 @@
return CWM::ShowAndRun ($[
"widget_descr" : widget_descr,
- "widget_names" : ["name", se_type],
+ "widget_names" : ["name", "trusted", se_type],
"contents" : contents,
"caption" : _("Boot Loader Settings: Section Management"),
"back_button" : Label::BackButton (),
@@ -135,6 +136,7 @@
"main" : ``(MainDialog ()),
"installation_details" : ``(DetailsDialog ("installation")),
"loader_details" : ``(DetailsDialog ("loader")),
+ "t_grub" : ``(DetailsDialog ("trusted_grub")),
"add_new_section" : ``(AddNewSectionDialog ()),
"store_section" : [``(GenericStoreSection ()), true],
"manual_edit" : ``(runEditFilesDialog ()),
@@ -178,8 +180,15 @@
],
"section_edit" : $[
`next : "store_section",
+ `trusted_details : "t_grub",
+ `abort : `abort,
+ ],
+ "t_grub" : $[
+ `next : "section_edit",
+ //FIXME kokso: it is good idea handle abort via "section_edit" not
`abort
`abort : `abort,
],
+
];
foreach (string st, section_types(), {
Modified: trunk/bootloader/src/grub/Makefile.am
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/Makefile.am?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/grub/Makefile.am (original)
+++ trunk/bootloader/src/grub/Makefile.am Mon Sep 8 17:01:09 2008
@@ -6,7 +6,8 @@
ynclude_DATA = \
helps.ycp \
- misc.ycp
+ misc.ycp \
+ trusted_grub_edit.ycp
EXTRA_DIST = \
$(ynclude_DATA)
Modified: trunk/bootloader/src/grub/helps.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/helps.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/grub/helps.ycp (original)
+++ trunk/bootloader/src/grub/helps.ycp Mon Sep 8 17:01:09 2008
@@ -44,6 +44,9 @@
"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>"),
+ "trusted_grub" :
+_("<p><b>Use Trusted Grub</b> means install trusted grub and use it. Option
<i>Grafical Menu File</i> will be ignored.
+It is recommended to install grub to MBR</p>"),
"boot_mbr" :
_("<p><b>Boot from Master Boot Record</b> is not recommended if you have
another operating system
installed on your computer</p>"),
@@ -124,6 +127,16 @@
_("<p><b>Menu Description File<b></p>"),
"other_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> ,
+<b>Edit</b> and <b>Delete</b></p>"),
+ "PCRKernelHelp" :
+ _("<p><b>PCR Index of Kernel<b> is Platform Configuration Register for
kernel</p>"),
+ "PCRInitrdHelp" :
+ _("<p><b>PCR Index of Kernel<b> is Platform Configuration Register for
initrd</p>"),
+ "PCRChainloaderHelp" :
+ _("<p><b>PCR Index of Kernel<b> is Platform Configuration Register for
chainloader</p>"),
+
];
@@ -133,6 +146,7 @@
"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"),
Added: trunk/bootloader/src/grub/trusted_grub_edit.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/grub/trusted_grub_edit.ycp?rev=50815&view=auto
==============================================================================
--- trunk/bootloader/src/grub/trusted_grub_edit.ycp (added)
+++ trunk/bootloader/src/grub/trusted_grub_edit.ycp Mon Sep 8 17:01:09 2008
@@ -0,0 +1,356 @@
+{
+
+textdomain "bootloader";
+
+import "CWM";
+import "Label";
+import "BootCommon";
+import "Popup";
+
+include "bootloader/grub/helps.ycp";
+
+
+/**
+ * Init function of widget
+ * @param widget string id of the widget
+ */
+
+void InitMeasuresTable(string widget)
+{
+ map <string, string> meas = BootCommon::current_section["measure"]:$[];
+ list measures = [];
+
+ foreach(string file, string pcr, meas, {
+ measures = add(measures, `item(`id(file), file, pcr));
+ });
+
+ UI::ChangeWidget (`id (`measures), `Items, measures);
+}
+
+
+
+void AddEditMeasure (string file, string pcr)
+{
+ map <string, string> meas = BootCommon::current_section["measure"]:$[];
+ string orig_file = file;
+ any ret = nil;
+
+ if (pcr == "")
+ pcr ="8";
+
+ UI::OpenDialog( (file != "") ? `Label( _("Edit Measure")): `Label( _("Add
New Measure") ),
+ `VBox(
+ `HBox(
+ `InputField(`id(`measur), _("Measure File"), file),
+ `VBox ( `Label(""),
+ `PushButton(`id(`br), Label::BrowseButton())
+ )
+ ),
+ `Left(`IntField(`id(`pcr), _("PCR Index of File"),0, 100,
tointeger(pcr))),
+ `HBox(
+ `PushButton(`id(`cancel), Label::CancelButton()),
+ `PushButton(`id(`ok), Label::OKButton())
+ )
+ )
+ ); // end of UI::OpenDialog(
+
+ while (true) {
+ ret = UI::UserInput();
+ if (ret == `br) {
+ string val = UI::AskForExistingFile ("/","*.*",_("Please Select
File"));
+ UI::ChangeWidget(`id(`measur), `Value, val);
+ } else if ( ret == `ok ) {
+ string new_file = tostring(UI::QueryWidget(`id(`measur), `Value));
+ string new_pcr = tostring(UI::QueryWidget(`id(`pcr), `Value));
+ if (file != "")
+ {
+ meas = remove(meas, file);
+ }
+ meas[new_file] = new_pcr;
+ break;
+ } else if (ret == `cancel) {
+ break;
+ }
+ };
+ BootCommon::current_section["measure"] = meas;
+
+ UI::CloseDialog();
+}
+
+/**
+ * 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
+ */
+symbol HandleMeasuresTable (string widget, map event)
+{
+
+ any op = event["ID"]:nil;
+ if (event["ID"]:nil == `measures
+ && event["EventReason"]:"" == "Activated"
+ && event["EventType"]:"" == "WidgetEvent")
+ {
+ op = `edit;
+ }
+ map <string, string> meas = BootCommon::current_section["measure"]:$[];
+
+ string current = (string)UI::QueryWidget (`id (`measures), `CurrentItem);
+ string act_file = "";
+ string act_pcr = "";
+
+ if ((current != nil) && (current != ""))
+ {
+ act_file = current;
+ act_pcr = meas[current]:"";
+ }
+ if (op == `add)
+ {
+ AddEditMeasure("", "");
+ InitMeasuresTable(widget);
+ } else if (op == `edit) {
+
+ AddEditMeasure(act_file, act_pcr);
+ InitMeasuresTable(widget) ;
+ } else if (op == `delete) {
+ string message = sformat(_("Really delete measured file: %1 with PCR:
%2 ?"), act_file, act_pcr);
+ if (Popup::YesNo(message))
+ {
+ meas = remove(meas,act_file);
+ BootCommon::current_section["measure"] = meas;
+ InitMeasuresTable(widget);
+ }
+ }
+
+}
+/**
+ * Store function of a widget
+ * @param widget string widget key
+ * @param event map event that caused the operation
+ */
+void StoreMeasuresTable (string widget, map event)
+{
+ if ((size(BootCommon::current_section["measure"]:$[]) == 0) &&
+ (haskey(BootCommon::current_section, "measure")))
+ BootCommon::current_section = remove(BootCommon::current_section,
"measure");
+}
+
+/**
+ * Init function of widget
+ * @param widget string id of the widget
+ */
+
+void InitPCRKernel (string widget) {
+ if ((BootCommon::current_section["type"]:"" == "image") ||
(BootCommon::current_section["type"]:"" == "xen"))
+ {
+ UI::ChangeWidget (`id ("PCRKernel"), `Enabled, true);
+ UI::ChangeWidget (`id ("PCRKernel"), `Value,
tointeger(BootCommon::current_section["imagepcr"]:"8"));
+ } else {
+ UI::ChangeWidget (`id ("PCRKernel"), `Enabled, false);
+ }
+}
+
+
+/**
+ * Store function of a widget
+ * @param widget string widget key
+ * @param event map event that caused the operation
+ */
+void StorePCRKernel (string widget, map event) {
+ if ((BootCommon::current_section["type"]:"" == "image") ||
+ (BootCommon::current_section["type"]:"" == "xen"))
+ BootCommon::current_section["imagepcr"] = tostring(UI::QueryWidget (`id
("PCRKernel"), `Value));
+}
+
+/**
+ * Init function of widget
+ * @param widget string id of the widget
+ */
+
+void InitPCRInitrd (string widget) {
+ if ((BootCommon::current_section["type"]:"" == "image") ||
(BootCommon::current_section["type"]:"" == "xen"))
+ {
+ UI::ChangeWidget (`id ("PCRInitrd"), `Enabled, true);
+ UI::ChangeWidget (`id ("PCRInitrd"), `Value,
tointeger(BootCommon::current_section["initrdpcr"]:"8"));
+ } else {
+ UI::ChangeWidget (`id ("PCRInitrd"), `Enabled, false);
+ }
+}
+
+
+/**
+ * Store function of a widget
+ * @param widget string widget key
+ * @param event map event that caused the operation
+ */
+void StorePCRInitrd (string widget, map event) {
+ if ((BootCommon::current_section["type"]:"" == "image") ||
+ (BootCommon::current_section["type"]:"" == "xen"))
+ BootCommon::current_section["initrdpcr"] = tostring(UI::QueryWidget
(`id ("PCRInitrd"), `Value));
+}
+
+
+
+/**
+ * Init function of widget
+ * @param widget string id of the widget
+ */
+
+void InitPCRChainloader (string widget) {
+ if (BootCommon::current_section["type"]:"" != "other")
+ UI::ChangeWidget (`id ("PCRChainloader"), `Enabled, false);
+ else
+ UI::ChangeWidget (`id ("PCRChainloader"), `Value,
tointeger(BootCommon::current_section["chainloaderpcr"]:"8"));
+}
+
+
+/**
+ * Store function of a widget
+ * @param widget string widget key
+ * @param event map event that caused the operation
+ */
+void StorePCRChainloader (string widget, map event) {
+ if (BootCommon::current_section["type"]:"" == "other")
+ BootCommon::current_section["chainloaderpcr"] =
tostring(UI::QueryWidget (`id ("PCRChainloader"), `Value));
+}
+
+
+
+map<string,map<string,any> > wid_handling = $[
+
+
+ "MeasuresTable" : $[
+ //TRANSLATORS: RadioButtonGroup Label
+ "label" : _("Measurement of Grub"),
+ "widget" : `custom,
+ "custom_widget" : `VBox(`Frame (_("Measures"),
+ `HBox (`HSpacing (2), `VBox (
+ `VSpacing (1),
+ `Table (`id (`measures),
+ `opt (`keepSorting, `notify),
+ `header (
+ // table header, Measure
+ _("Measure"),
+ // table header, PCR
+ _("PCR")
+ ), []
+ ),
+
+ `HBox (
+ `HStretch (),
+ `PushButton (`id (`add), `opt (`key_F3),
Label::AddButton ()),
+ `PushButton (`id (`edit), `opt(`key_F5),
Label::EditButton ()),
+ `PushButton (`id (`delete), `opt(`key_F5),
Label::DeleteButton ()),
+ `HStretch ()
+ ),
+ `VSpacing (1)
+ )
+
+ )
+ )),
+ "init" : InitMeasuresTable,
+ "handle" : HandleMeasuresTable,
+ "store" : StoreMeasuresTable,
+ "help" : grub_help_messages["MeasuresTableHelp"]:"",
+
+ ],
+
+ "PCRKernel" : $[
+ //TRANSLATORS: IntField Label
+ "label" : _("PCR Index of &Kernel"),
+ "widget" : `intfield,
+ "minimum" : 0,
+ "maximum" : 100,
+ "init" : InitPCRKernel,
+ //"handle" :
+ "store" : StorePCRKernel,
+ "help" : grub_help_messages["PCRKernelHelp"]:"",
+ ],
+
+
+
+ "PCRInitrd" : $[
+ //TRANSLATORS: IntField Label
+ "label" : _("PCR Index of &Initrd"),
+ "widget" : `intfield,
+ "minimum" : 0,
+ "maximum" : 100,
+ "init" : InitPCRInitrd,
+ //"handle" :
+ "store" : StorePCRInitrd,
+ "help" : grub_help_messages["PCRInitrdHelp"]:"",
+ ],
+
+
+ "PCRChainloader" : $[
+ //TRANSLATORS: IntField Label
+ "label" : _("PCR &Index of Chainloader"),
+ "widget" : `intfield,
+ "minimum" : 0,
+ "maximum" : 100,
+ "init" : InitPCRChainloader,
+ //"handle" :
+ "store" : StorePCRChainloader,
+ "help" : grub_help_messages["PCRChainloaderHelp"]:"",
+ ],
+
+];
+
+
+
+
+symbol TrustedGrubDetails () {
+ y2milestone ("Running i386 loader details dialog");
+
+ term contents = `HBox (`HSpacing (2), `VBox (
+ "MeasuresTable",
+ `VSpacing (1),
+ "PCRKernel",
+ `VSpacing (1),
+ "PCRInitrd",
+ `VSpacing (1),
+ "PCRChainloader",
+ `VStretch ()
+ ), `HSpacing (2));
+
+ list<string> widget_names = ["MeasuresTable", "PCRKernel", "PCRInitrd",
"PCRChainloader",];
+ map<string,map<string,any> > widget_descr = wid_handling;
+ // dialog caption
+ string caption = _("Trusted GRUB Options");
+ 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 (),
+ ]);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
Modified: trunk/bootloader/src/modules/BootCommon.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootCommon.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootCommon.ycp (original)
+++ trunk/bootloader/src/modules/BootCommon.ycp Mon Sep 8 17:01:09 2008
@@ -118,6 +118,13 @@
*/
global string BootPartitionDevice = "";
+
+/**
+ * The variable indicate using of trusted GRUB
+ */
+
+global boolean isTrustedGrub = true;
+
/**
* string representing device name of / partition
*/
@@ -654,7 +661,8 @@
*/
global define boolean Import (map settings) {
globals = settings["global"]:$[];
- sections = settings["sections"]:[];
+ sections = importSections(settings["sections"]:[]);
+
// FIXME: for grub, repl_mbr is replaced by globals["generic_mbr"]; same
// for activate; remove the following when no bootloader uses these
// variables any more
@@ -792,11 +800,12 @@
// FATE: #110038: Serial console
// check and add console key with value for sections
addConsole();
+ /*
list<map<string,string> > sects = maplist (map<string,any> s, sections, {
return (map<string,string>)
filter (string k, any v, s, { return is (v, string); });
});
-
+ */
/* it is done
// convert root device names in sections to the device names indicated by
// "mountby"
@@ -831,7 +840,7 @@
});
ret = ret && SetDeviceMap (my_device_mapping);
- ret = ret && SetSections (sects);
+ ret = ret && SetSections (sections);
ret = ret && SetGlobal (my_globals);
if (flush)
{
@@ -1070,6 +1079,16 @@
bootloader_packages = bootloader_attribs[bootloader,
"required_packages"]:[];
}
+ //FIXME kokso: it is important deselect grub from installation proposal
not only delete from bootloader_packages
+ if (globals["trusted_grub"]:"" == "true")
+ {
+ bootloader_packages = bootloader_attribs[bootloader,
"trustedgrub", "required_packages"]:[];
+ if (contains(bootloader_packages, "grub"))
+ bootloader_packages = filter(string key,
bootloader_packages, {return (key !="grub"); });
+
+ bootloader_packages = add(bootloader_packages, "trustedgrub");
+ }
+
// don't configure package manager during autoinstallation preparing
if (Mode::normal () && (! (Mode::config () || Mode::repair ())))
{
Modified: trunk/bootloader/src/modules/BootGRUB.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/BootGRUB.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/modules/BootGRUB.ycp (original)
+++ trunk/bootloader/src/modules/BootGRUB.ycp Mon Sep 8 17:01:09 2008
@@ -63,7 +63,7 @@
include "bootloader/grub/helps.ycp";
include "bootloader/generic/device_map_edit_widget.ycp";
include "bootloader/generic/dialogs.ycp";
-
+include "bootloader/grub/trusted_grub_edit.ycp";
// end of mandatory functions
//----------------------------------------------------------------------------
@@ -281,12 +281,12 @@
BootCommon::InitializeLibrary (false, "grub");
BootCommon::SetFilesContents (files);
- list<map<string,string> > sects
+ list<map<string,any> > sects
= BootCommon::GetSections ();
y2debug ("Found sections %1", sects);
// look only for "default" == "initial" entries, not all
entries
- sects = filter (map<string,string> s, sects, {
+ sects = filter (map<string,any> s, sects, {
return s["initial"]:nil != nil;
});
@@ -762,6 +762,7 @@
return $[
"installation" : i386InstallDetailsDialog,
"loader" : genericBootLoaderOptionsDialog,
+ "trusted_grub" : TrustedGrubDetails,
];
}
Modified: trunk/bootloader/src/modules/Bootloader_API.pm
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/modules/Bootloader_API.pm?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/modules/Bootloader_API.pm (original)
+++ trunk/bootloader/src/modules/Bootloader_API.pm Mon Sep 8 17:01:09 2008
@@ -197,7 +197,7 @@
return $ret;
}
-BEGIN { $TYPEINFO{getSections} = ["function", ["list", ["map", "string",
"string"]]]; }
+BEGIN { $TYPEINFO{getSections} = ["function", ["list", ["map", "string",
"any"]]]; }
sub getSections() {
my @sections = @{$lib_ref->GetSections () || []};
@@ -214,7 +214,7 @@
return \@sections;
}
-BEGIN { $TYPEINFO{setSections} = ["function", "boolean", ["list", ["map",
"string", "string"]]]; }
+BEGIN { $TYPEINFO{setSections} = ["function", "boolean", ["list", ["map",
"string", "any"]]]; }
sub setSections($) {
my ($sections) = @_;
Modified: trunk/bootloader/src/routines/helps.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/helps.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/routines/helps.ycp (original)
+++ trunk/bootloader/src/routines/helps.ycp Mon Sep 8 17:01:09 2008
@@ -304,4 +304,17 @@
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/lib_iface.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/lib_iface.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/routines/lib_iface.ycp (original)
+++ trunk/bootloader/src/routines/lib_iface.ycp Mon Sep 8 17:01:09 2008
@@ -151,16 +151,16 @@
* @param sections a list of all loader sections (as maps)
* @return boolean true on success
*/
-global boolean SetSections (list<map<string,string> > sections) {
+global boolean SetSections (list<map<string,any> > sections) {
y2milestone ("Storing bootloader sections %1", sections);
- sections = maplist (map<string,string> s, sections, {
+ /*sections = maplist (map<string,string> s, sections, {
s["__modified"] = "1";
s = filter (string key, string value, s, {
return (! is (value, string)) || (value != "");
});
return s;
- });
+ });*/
boolean ret = System::Bootloader_API::setSections (sections);
if (! ret)
y2error ("Storing bootloader sections failed");
@@ -171,9 +171,9 @@
* Get boot loader sections
* @return a list of all loader sections (as maps)
*/
-global list<map<string,string> > GetSections () {
+global list<map<string,any> > GetSections () {
y2milestone ("Reading bootloader sections");
- list<map<string,string> > sects = System::Bootloader_API::getSections ();
+ list<map<string,any> > sects = System::Bootloader_API::getSections ();
if (sects == nil)
{
y2error ("Reading sections failed");
Modified: trunk/bootloader/src/routines/misc.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/misc.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/routines/misc.ycp (original)
+++ trunk/bootloader/src/routines/misc.ycp Mon Sep 8 17:01:09 2008
@@ -323,7 +323,8 @@
global map<string,string> remapDeviceMap(map<string,string> device_map)
{
symbol by_mount = Storage::GetDefaultMountBy();
-
+
+ //symbol by_mount = `id;
if (by_mount == `label)
return device_map;
@@ -347,7 +348,7 @@
global map<string,string> remapGlobals(map<string,string> globals_set)
{
symbol by_mount = Storage::GetDefaultMountBy();
-
+ //symbol by_mount = `id;
if (by_mount == `label)
return globals_set;
@@ -410,16 +411,97 @@
}
/**
+ * Function remap measure in section to autoyast format
+ *
+ * @param map<string,string> map of measures $["file": "pcr"]
+ * @return list<map<string,string> > list of measures for autoyast format
+ */
+
+list <map <string, string> > remapMeasure(map <string, string> measure)
+{
+ list <map <string, string> > ret = [];
+ if (size(measure) >0)
+ {
+ foreach(string k, string v, measure,
+ {
+ map <string, string> tmp_map = $[];
+ tmp_map["file"] = k;
+ tmp_map["pcr"] = v;
+ ret = add(ret,tmp_map);
+ });
+ }
+
+ return ret;
+}
+
+
+/**
+ * Function remap measure in section from autoyast format
+ *
+ * @param list<map<string,string> > list of measures [$["file": "/tmp/file1",
"pcr" : "8"]]
+ * @return map<string,string> map of measures
+ */
+
+map <string, string> importMeasure(list<map<string, string> > measure)
+{
+ map <string, string> ret = $[];
+ if (size(measure) >0)
+ {
+ maplist(map <string, string> m, measure,
+ {
+ string file = m["file"]:"";
+ string pcr = m["pcr"]:"";
+ ret[file]=pcr;
+ });
+ }
+
+ return ret;
+}
+
+
+/**
* Function remap section "root" and "resume" to device name (/dev/sda)
* or to label (ufo_partition)
* @param list<map<string,any> > list of sections
* @return list<map<string,any> > list of sections
*/
+global list<map<string,any> > importSections(list<map<string,any> >sec)
+{
+ y2debug("import section before remapping %1", sec);
+ list<map<string,any> >temp_sec = [];
+ temp_sec = maplist (map<string,any> s, sec,
+ {
+
+ if (haskey(s,"measures"))
+ {
+ map <string, string> tmp = $[];
+ tmp = importMeasure(s["measures"]:[]);
+ s = remove(s,"measures");
+ if (size(tmp) > 0)
+ s["measure"]=tmp;
+ }
+
+ return s;
+ });
+ y2debug("import section after remapping %1", temp_sec);
+ return temp_sec;
+}
+
+
+
+
+/**
+ * Function remap section "root" and "resume" to device name (/dev/sda)
+ * or to label (ufo_partition)
+ * it also prepared measured files for export
+ * @param list<map<string,any> > list of sections
+ * @return list<map<string,any> > list of sections
+ */
global list<map<string,any> > remapSections(list<map<string,any> >sec)
{
symbol by_mount = Storage::GetDefaultMountBy();
-
+ //symbol by_mount = `id;
if (by_mount == `label)
return sec;
@@ -443,6 +525,15 @@
if (s["chainloader"]:"" != "")
s["chainloader"] =
BootCommon::MountByDev2Dev(s["chainloader"]:"");
+ if (haskey(s,"measure"))
+ {
+ list <map <string, string> > tmp =[];
+ tmp = remapMeasure(s["measure"]:$[]);
+ s = remove(s,"measure");
+ if (size(tmp) > 0)
+ s["measures"]=tmp;
+ }
+
return s;
});
@@ -466,7 +557,7 @@
// (`id,`uuid,`path,`device,`label)
symbol by_mount = Storage::GetDefaultMountBy();
-
+ //symbol by_mount = `id;
y2milestone("Default mount by is %1", by_mount);
map<string,map> devices = (map<string,map>)Storage::GetTargetMap();
Modified: trunk/bootloader/src/routines/section_widgets.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/bootloader/src/routines/section_widgets.ycp?rev=50815&r1=50814&r2=50815&view=diff
==============================================================================
--- trunk/bootloader/src/routines/section_widgets.ycp (original)
+++ trunk/bootloader/src/routines/section_widgets.ycp Mon Sep 8 17:01:09 2008
@@ -28,6 +28,7 @@
import "Storage";
import "StorageDevices";
import "TablePopup";
+import "Popup";
include "bootloader/routines/helps.ycp";
@@ -325,6 +326,46 @@
return nil;
}
+
+/**
+ * Init function of widget
+ * @param widget any id of the widget
+ */
+void InitTrustedDetails (string widget) {
+
+ if (BootCommon::globals["trusted_grub"]:"" != "true")
+ UI::ChangeWidget (`id ("trusted"), `Enabled, false);
+
+}
+
+
+
+/**
+ * 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
+ */
+symbol TrustedDetailsButtonHandle (string widget, map event) {
+
+ string lt = Bootloader::getLoaderType ();
+ if (lt == "none" || lt == "default")
+ {
+ NoLoaderAvailable ();
+ return nil;
+ }
+
+ return `trusted_details;
+}
+/**
+ * Store function of the root device widget
+ * @param widget any widget key
+ * @param event map event description of event that occured
+ */
+void StoreTrustedDetails (string widget, map event) {
+ y2debug("Fake store function for trusted GRUB");
+
+}
/**
* Cache for CommonSectionWidgets
*/
@@ -335,6 +376,7 @@
* @return a map describing common loader section related widgets
*/
map<string,map<string,any> > CommonSectionWidgets () {
+
if (_common_section_widgets == nil)
{
_common_section_widgets = $[
@@ -442,8 +484,21 @@
"handle" : SectionTypeHandle,
"help" : SectionTypeHelp (),
],
+
];
}
+
+ _common_section_widgets["trusted"] = $[
+ "widget" : `push_button,
+ // push button
+ "label" : _("&Trusted GRUB Details"),
+ "init" : InitTrustedDetails,
+ "handle" : TrustedDetailsButtonHandle,
+ "handle_events" : [ "trusted" ],
+ "store" : StoreTrustedDetails,
+ "help" : TrustedGrubHelp (),
+ ];
+
return _common_section_widgets;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
| < Previous | Next > |