home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
boot
/
i386
/
root
/
usr
/
share
/
YaST2
/
clients
/
bootloader_proposal.ycp
< prev
next >
Wrap
Text File
|
2006-11-29
|
6KB
|
208 lines
/**
* Module: bootloader_proposal.ycp
*
* $Id: bootloader_proposal.ycp 34495 2006-11-20 15:13:00Z jplack $
*
* Author: Klaus Kaempf <kkaempf@suse.de>
*
* Purpose: Proposal function dispatcher - bootloader.
*
* See also file proposal-API.txt for details.
*/
{
textdomain "bootloader";
import "Arch";
import "BootCommon";
import "Bootloader";
import "Storage";
import "Mode";
include "bootloader/routines/wizards.ycp";
string func = (string)WFM::Args(0);
map param = (map)WFM::Args(1);
map<string,any> ret = $[];
// This will be called every time we enter the proposal widget. Here we can
// return cached data, but when force_reset is set, we must create a new
// proposal based on freshly discovered data (ie. from Storage:: and
// perl-Bootloader (etc.?)).
if ( func == "MakeProposal" )
{
boolean force_reset = param["force_reset" ]:false;
boolean language_changed = param["language_changed"]:false;
// use the cache if possible
// if not asked to recreate and we have a cached proposal and
if (false
&& !force_reset
&& Bootloader::cached_proposal != nil
// has the configuration been changed?
&& Bootloader::cached_settings == Bootloader::Export()
// has the partitioning been changed?
// This is correct as long as the proposal is only dependent on the
// settings in Storage. AFAICT all information relevant to a
// proposal in yast2-bootloader comes from yast2-storage. Even the
// information from perl-Bootloader only depends on the settings in
// Storage or libstorage. So this should be OK. At this point all
// changes relevant to the yast2-bootloader settings are made
// through Storage, so the change time of Storage data should be
// sufficient.
&& Bootloader::cached_settings_base_data_change_time == Storage::GetTargetChangeTime())
// FIXME: has the software selection changed?: esp. has the
// Xen pattern been activated ? then we'd have to make the
// proposal again.
{
y2milestone("Using cached proposal");
return Bootloader::cached_proposal;
}
if (force_reset && !Mode::autoinst ())
{
// force re-calculation of bootloader proposal
// this deletes any internally cached values, a new proposal will
// not be partially based on old data now any more
y2milestone ("Recalculation of bootloader configuration forced");
Bootloader::Reset ();
}
if (! Bootloader::proposed_cfg_changed && ! Mode::autoinst ())
{
y2milestone ("Cfg not changed before, recreating");
Bootloader::ResetEx (false);
BootCommon::setLoaderType (nil);
}
if (Bootloader::getLoaderType () == "grub")
{
import "BootGRUB";
BootGRUB::merge_level = `main;
Bootloader::Propose ();
BootGRUB::merge_level = `none;
}
else
{
Bootloader::Propose ();
}
// to make sure packages will get installed
BootCommon::setLoaderType (BootCommon::getLoaderType (false));
ret = $[ "raw_proposal" : Bootloader::Summary ()];
if (Bootloader::getLoaderType () == "")
{
y2error ("No bootloader selected");
ret = add (ret, "warning_level", `error);
// warning text in the summary rixhtext
ret = add (ret, "warning",
_("No boot loader is selected for installation. Your system might not be bootable."));
}
if (! BootCommon::BootloaderInstallable ())
{
ret = $[
"warning_level" : `error,
// error in the proposal
"warning" : _("Because of the partitioning, the bootloader cannot be installed properly"),
];
}
else if (Bootloader::getLoaderType () == "ppc")
{
if (Arch::board_chrp ())
{
if (BootCommon::globals["activate"]:"false" == "false")
{
ret = (map<string,any>)
union(ret,
$[
"warning_level" : `error,
"warning" :
_("The selected boot path will not be activated for your installation. Your system may not be bootable."),
]);
}
}
if (Arch::board_iseries()) {
// FIXME: handle consistency test for iseries configuration
// currently: none
y2debug("No consistency check implemented for iSeries boot configuration");
}
else {
// FIXME: better eliminate use of loader_device in the
// future, no one knows what it is for
if ( BootCommon::loader_device == "" ) {
ret = (map<string,any>)union (ret, $[
"warning_level" : `blocker,
"warning" :
ret["warning"]:"" +
_("Configure a valid boot loader location before continuing.<br>
In case that no selection can be made it may be necessary to create a PReP Boot partition."),
]
);
}
}
}
// cache the values
Bootloader::cached_settings = Bootloader::Export();
Bootloader::cached_settings_base_data_change_time = Storage::GetTargetChangeTime();
Bootloader::cached_proposal = ret;
}
// This is a request to start some dialog and interact with the user to set
// up the Bootloader setting. Called when the user presses the link to set
// up the Bootloader.
else if ( func == "AskUser" )
{
boolean has_next = param["has_next"]:false;
map settings = Bootloader::Export ();
// don't ask for abort confirm if nothing was changed (#29496)
BootCommon::changed = false;
symbol result = BootloaderAutoSequence ();
// set to true, simply because must be saved during installation
BootCommon::changed = true;
if (result != `next)
Bootloader::Import ((map<string,any>)settings);
else
Bootloader::proposed_cfg_changed = true;
// Fill return map
ret = $[ "workflow_sequence" : result ];
}
// This describes the "active" parts of the Bootloader proposal section.
else if ( func == "Description" )
{
// Fill return map.
//
// Static values do just nicely here, no need to call a function.
ret =
$[
// proposal part - bootloader label
"rich_text_title" : _("Booting"),
// menubutton entry
"menu_title" : _("&Booting"),
"id" : "bootloader_stuff"
];
}
// Before the system is installed there is no place to write to yet. This
// code is not called. The bootloader will be installed later during
// inst_finish.
else if (func == "Write")
{
boolean succ = Bootloader::Write ();
ret =
$[
"success" : succ
];
}
return ret;
}