ACC SHELL
/**
* File: clients/inst_autoinit.ycp
* Package: Auto-installation
* Summary: Parses XML Profile for automatic installation
* Authors: Anas Nashif <nashif@suse.de>
*
* $Id: inst_autoinit.ycp 53201 2008-11-12 13:21:33Z ug $
*
*/
{
textdomain "autoinst";
import "Installation";
import "AutoInstall";
import "AutoinstConfig";
import "ProfileLocation";
import "AutoInstallRules";
import "Progress";
import "Report";
import "Profile";
// import "Arch";
import "Call";
import "Console";
import "Popup";
include "autoinstall/autoinst_dialogs.ycp";
define symbol processProfile() {
Progress::NextStage();
// Initialize Rules
Progress::Title(AutoinstConfig::message);
AutoInstallRules::Init();
boolean ret = false;
Progress::NextStep();
Progress::Title(_("Processing Profiles and Rules"));
while (true)
{
boolean r = ProfileLocation::Process();
if (r)
{
break;
}
else {
string newURI = ProfileSourceDialog(AutoinstConfig::OriginalURI);
if ( newURI == "")
{
return `abort;
}
else
{
AutoinstConfig::ParseCmdLine(newURI);
AutoinstConfig::SetProtocolMessage();
continue;
}
}
}
/*
if (!ProfileLocation::Process())
{
y2error("Aborting...");
return `abort;
}
*/
sleep(1000);
if(UI::PollInput() == `abort)
if (Popup::ConfirmAbort (`painless))
return `abort;
Progress::NextStage();
//
// Set reporting behaviour to default, changed later if required
//
Report::LogMessages(true);
Report::LogErrors(true);
Report::LogWarnings(true);
if(UI::PollInput() == `abort)
if (Popup::ConfirmAbort (`painless))
return `abort;
Progress::NextStage();
Progress::Title( _("Parsing control file"));
if (! Profile::ReadXML( AutoinstConfig::xml_tmpfile ) || Profile::current == $[] || Profile::current == nil)
{
Popup::Error(_("Error while parsing the control file.
Check the log files for more details or fix the
control file and try again.
"));
return `abort;
}
y2debug ("Autoinstall control file %1", Profile::current );
Progress::NextStage();
Progress::Title(_("Initial Configuration"));
Report::Import(Profile::current["report"]:$[]);
//
// Copy the control file for easy access by user to a pre-defined
// directory
//
SCR::Execute(.target.bash, sformat("cp %1 %2/autoinst.xml", AutoinstConfig::xml_tmpfile, AutoinstConfig::profile_dir));
return `ok;
}
Console::Init ();
string help_text = _("<p>
Please wait while the system is prepared for autoinstallation.</p>
");
list<string> progress_stages =
[
_("Probe hardware"),
_("Retrieve & Read Control File"),
_("Process Profiles and Rules"),
_("Parse control file")
];
boolean profileFetched = false;
Progress::New(
_("Preparing System for Automatic Installation"),
"", // progress_title
7 , // progress bar length
progress_stages,
[],
help_text );
Progress::NextStage();
Progress::Title(_("Preprobing stage"));
y2milestone("pre probing");
/* // moved to autoset to fulfill fate #301193
// the DASD section in an autoyast profile can't be changed via pre-script
//
if( Arch::s390 () && AutoinstConfig::remoteProfile == true ) {
y2milestone("arch=s390 and remote_profile=true");
symbol ret = processProfile();
if( ret != `ok ) {
return ret;
}
y2milestone("processProfile=ok");
profileFetched = true;
// FIXME: the hardcoded stuff should be in the control.xml later
if( haskey(Profile::current, "dasd") ) {
y2milestone("dasd found");
Call::Function("dasd_auto", ["Import", Profile::current["dasd"]:$[] ]);
}
if( haskey(Profile::current, "zfcp") ) {
y2milestone("zfcp found");
Call::Function("zfcp_auto", ["Import", Profile::current["zfcp"]:$[] ]);
}
}
*/
string tmp = (string)SCR::Read (.target.string, "/etc/install.inf");
if (tmp != nil && issubstring( tolower(tmp), "iscsi: 1" ) ) {
WFM::CallFunction("inst_iscsi-client", []);
}
Progress::Title(_("Probing hardware..."));
WFM::CallFunction("inst_system_analysis", [] );
AutoInstallRules::ProbeRules();
if( ! profileFetched ) {
symbol ret = processProfile();
if( ret != `ok ) {
return ret;
}
}
if( haskey(Profile::current, "iscsi-client") ) {
y2milestone("iscsi-client found");
WFM::CallFunction("iscsi-client_auto", ["Import", Profile::current["iscsi-client"]:$[]] );
WFM::CallFunction("iscsi-client_auto", ["Write"] );
}
if(UI::PollInput() == `abort)
if (Popup::ConfirmAbort (`painless))
return `abort;
// AutoInstall::ProcessSpecialResources();
sleep(1000);
Progress::Finish();
return `next;
}
ACC SHELL 2018