ACC SHELL
/**
* File:
* save_config_finish.ycp
*
* Module:
* Step of base installation finish
*
* Authors:
* Jiri Srain <jsrain@suse.cz>
*
* $Id: save_config_finish.ycp 59739 2009-11-24 15:19:03Z kmachalkova $
*
*/
{
textdomain "installation";
import "Directory";
import "Mode";
import "Timezone";
import "Language";
import "Keyboard";
import "ProductFeatures";
import "AutoInstall";
import "Console";
import "Product";
import "Progress";
import "SignatureCheckDialogs";
import "Stage";
import "AddOnProduct";
import "FileUtils";
import "Installation";
import "String";
any ret = nil;
string func = "";
map param = $[];
/* Check arguments */
if(size(WFM::Args()) > 0 && is(WFM::Args(0), string)) {
func = (string)WFM::Args(0);
if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
param = (map)WFM::Args(1);
}
y2milestone ("starting save_config_finish");
y2debug("func=%1", func);
y2debug("param=%1", param);
if (func == "Info")
{
return (any)$[
"steps" : Mode::autoinst () ? 7 : (Mode::update() ? 5 : 6),
"when" : [ `installation, `update, `autoinst ],
];
}
else if (func == "Write")
{
// Bugzilla #209119
// ProductFeatures::Save() moved here from inst_kickoff.ycp
// (After the SCR is switched)
if (Stage::initial ()) {
y2milestone ("Saving ProductFeatures...");
SCR::Execute (.target.bash, "/bin/mkdir -p '/etc/YaST2'");
SCR::Execute (.target.bash, "touch '/etc/YaST2/ProductFeatures'");
ProductFeatures::Save();
}
// Bugzilla #187558
// Save Add-On products configuration
// to be able to restore the settings
string save_to = AddOnProduct::TmpExportFilename();
if (FileUtils::Exists (save_to)) {
SCR::Execute (.target.remove, save_to);
}
if (Stage::initial ()) {
y2milestone ("Saving Add-On configuration...");
map exported_add_ons = AddOnProduct::Export();
if (exported_add_ons == nil) {
y2error ("Error, Add-Ons returned 'nil'");
} else {
boolean saved = (boolean) SCR::Write (.target.ycp, save_to, exported_add_ons);
if (saved) {
y2milestone ("Add-Ons configuration saved successfuly");
} else {
y2error ("Error occurred when storing Add-Ons configuration!");
}
}
}
if (!Mode::update ())
{
// progress step title
Progress::Title (_("Saving time zone..."));
// clock must be set correctly in new chroot
Timezone::Set (Timezone::timezone, true);
Timezone::Save();
}
Progress::NextStep ();
if (!Mode::update ())
{
// progress step title
Progress::Title (_("Saving language..."));
Language::Save();
Progress::NextStep ();
// progress step title
Progress::Title (_("Saving console configuration..."));
Console::Save();
Progress::NextStep ();
}
// save the update language for the second stage (F300572)
else
{
string lang = Language::language;
string file = Directory::vardir + "/language.ycp";
y2milestone ("saving %1 to %2 for 2nd stage of update", lang, file);
SCR::Write (.target.ycp, file, $[ "second_stage_language" : lang ]);
}
// progress step title
Progress::Title (_("Saving keyboard configuration..."));
Keyboard::Save();
Progress::NextStep ();
// progress step title
Progress::Title (_("Saving product information..."));
ProductFeatures::Save();
if (Mode::autoinst ())
{
Progress::NextStep ();
// progress step title
Progress::Title (_("Saving automatical installation settings..."));
AutoInstall::Save();
}
Progress::NextStep ();
// progress step title
Progress::Title (_("Configuring the superuser's environment..."));
SCR::Write (.sysconfig.suseconfig.CWD_IN_USER_PATH,
contains (Product::flags, "usercwd") ? "yes" : "no");
SCR::Write (.sysconfig.suseconfig, nil);
Progress::NextStep ();
// progress step title
Progress::Title (_("Saving security settings..."));
SCR::Write (.sysconfig.security.CHECK_SIGNATURES,
SignatureCheckDialogs::CheckSignatures ());
SCR::Write (.sysconfig.security, nil);
Progress::NextStep ();
// progress step title
Progress::Title (_("Saving boot scripts settings..."));
boolean run_in_parallel = ProductFeatures::GetBooleanFeature( "globals", "run_init_scripts_in_parallel");
SCR::Write (.sysconfig.boot.RUN_PARALLEL, run_in_parallel ? "yes" : "no" );
SCR::Write (.sysconfig.boot, nil);
// save supportconfig
if(SCR::Read(.target.size,"/etc/install.inf") > 0) {
string url = (string)SCR::Read(.etc.install_inf.supporturl);
y2milestone("URL value from /etc/install.inf : %1", url);
if( url!=nil && size(url)>0){
string config_path=sformat("%1%2", String::Quote(Installation::destdir), "/etc/supportconfig.conf");
y2milestone("URL from install.inf readed, test if %1 exists", config_path);
if (FileUtils::Exists(config_path)){
y2milestone("Insert value into supportconfig.conf: %1",
SCR::Execute(.target.bash_output, sformat("echo 'VAR_OPTION_UPLOAD_TARGET=%1'>> %2", url, config_path)));
}
}
} else y2warning("/etc/install.inf not found");
}
else
{
y2error ("unknown function: %1", func);
ret = nil;
}
y2debug("ret=%1", ret);
y2milestone("save_config_finish finished");
return ret;
} /* EOF */
ACC SHELL 2018