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
/
partitions_proposal.ycp
< prev
next >
Wrap
Text File
|
2006-11-29
|
5KB
|
197 lines
/**
* Module: proposal_partitions.ycp
*
* $Id: partitions_proposal.ycp 29761 2006-04-05 16:36:41Z fehr $
*
* Author: Klaus Kaempf <kkaempf@suse.de>
*
* Purpose: Proposal function dispatcher - partitions.
*
* See also file proposal-API.txt for details.
*/
{
textdomain "storage";
import "Arch";
include "wizard/sequencer.ycp";
include "partitioning/partition_defines.ycp";
include "partitioning/do_proposal_flexible.ycp";
string func = (string) WFM::Args(0);
map param = (map) WFM::Args(1);
map ret = $[];
define void HandlePackages()
``{
Pkg::DoRemove( ["lvm2"] );
list<string> pack = Storage::AddPackageList();
if( size(pack)>0 )
{
Pkg::DoProvide( pack );
}
}
y2milestone( "func:%1 param:%2", func, param );
if( func == "MakeProposal" && Mode::autoinst() )
{
ret["preformatted_proposal"] = Storage::ChangeText();
}
else if( func == "MakeProposal" )
{
boolean force_reset = param["force_reset" ]:false;
boolean language_changed = param["language_changed"]:false;
y2milestone( "force_reset:%1 lang_changed:%2",
force_reset, language_changed );
if( force_reset || Storage::GetPartProposalFirst() )
{
if( !Storage::GetPartProposalFirst() )
{
Storage::ResetOndiskTarget();
Storage::AddMountPointsForWin(Storage::GetTargetMap());
}
map prop = $[];
prop = get_inst_prop( Storage::GetTargetMap());
y2milestone( "prop ok:%1", prop["ok"]:false );
if( prop["ok"]:false )
{
Storage::SetTargetMap( prop["target"]:$[] );
Storage::SetPartProposalMode( "accept" );
y2milestone( "PROPOSAL: %1", Storage::ChangeText());
}
else
{
Storage::SetPartProposalMode( "impossible" );
}
Storage::SetPartProposalFirst( false );
Storage::SetPartProposalActive( true );
y2milestone( "prop=%1", prop );
}
if( Storage::GetPartProposalMode() != "impossible" ||
!Storage::GetPartProposalActive() )
{
ret["preformatted_proposal"] = Storage::ChangeText();
}
else
{
ret["raw_proposal"] = [];
// popup text
ret["warning"] = _("No automatic proposal possible.
Specify mount points manually in the 'Partitioner' dialog.");
ret["warning_level"] = `blocker;
}
HandlePackages();
}
else if ( func == "AskUser" )
{
boolean has_next = param["has_next"]:false;
// call some function that displays a user dialog
// or a sequence of dialogs here:
//
// sequence = DummyMod::AskUser( has_next );
map aliases =
$[ "disk" :
``(WFM::CallFunction("inst_disk", [true, true])),
"target_sel" :
``(WFM::CallFunction("inst_target_selection", [true, true])),
"target_part" :
``(WFM::CallFunction("inst_target_part", [true, true])),
"resize_ui" :
``(WFM::CallFunction("inst_resize_ui", [true, true])),
"part_proposal" :
``(WFM::CallFunction("inst_part_proposal", [true, true]))
];
map seq = $[];
if( Storage::GetPartProposalMode() != "impossible" )
{
Storage::SetPartProposalMode( "accept" );
}
else
{
Storage::SetPartMode( "USE_DISK" );
}
seq["disk"] = $[ `abort : `abort, `cancel: `cancel, `next: `next ];
if( Arch::s390 ())
{
Storage::SetPartMode("PROP_MODIFY");
seq["ws_start"] = "disk";
}
else if (Mode::autoinst ())
{
Storage::SetPartMode("PROP_MODIFY");
seq["ws_start"] = "disk";
}
else
{
y2milestone( "ProposalActive %1 ProposalMode %2 PartMode %3",
Storage::GetPartProposalActive(),
Storage::GetPartProposalMode(),
Storage::GetPartMode() );
seq["target_sel"] = $[ `abort : `abort, `cancel: `cancel,
`next : "target_part" ];
seq["target_part"] = $[ `abort : `abort, `cancel: `cancel,
`next : "disk" ];
if( Arch::i386 () )
{
seq["resize_ui"] = $[ `abort : `abort, `cancel: `cancel,
`next : "disk" ];
seq["target_part",`next] = "resize_ui";
}
seq["disk"] = $[ `abort : `abort, `cancel: `cancel, `next : `next ];
if( Storage::GetPartProposalMode() != "impossible" &&
Storage::GetPartProposalActive() )
{
seq["part_proposal"] = $[ `abort : `abort, `cancel: `cancel,
`next : "target_sel" ];
seq["ws_start"] = "part_proposal";
}
else if( Storage::GetPartMode()=="USE_DISK" )
{
seq["ws_start"] = "target_sel";
}
else
{
seq["ws_start"] = "disk";
}
}
y2milestone( "propsal sequence %1", seq );
Wizard::OpenNextBackDialog();
symbol result = WizardSequencer(aliases, seq);
Wizard::CloseDialog();
y2milestone( "AskUser Mode:%1 ProActive:%2", Storage::GetPartMode(),
Storage::GetPartProposalActive() );
// Fill return map
HandlePackages();
ret = $[ "workflow_sequence" : result ];
}
else if ( func == "Description" )
{
// Fill return map.
//
// Static values do just nicely here, no need to call a function.
ret =
$[
// label text
"rich_text_title" : _("Partitioning"),
// label text
"menu_title" : _("&Partitioning"),
"id" : "partitions_stuff"
];
}
return ret;
}