ACC SHELL
/**
* File: clients/inst_license.ycp
* Package: Installation
* Summary: Generic License File
* Authors: Anas Nashif <nashif@suse.de>
* Jiri Srain <jsrain@suse.cz>
* Lukas Ocilka <locilka@suse.cz>
*
* $Id: inst_license.ycp 60126 2009-12-16 14:43:37Z locilka $
*
*/
{
textdomain "installation";
import "Directory";
import "GetInstArgs";
import "Stage";
import "ProductLicense";
import "Mode";
import "ProductFeatures";
import "Wizard";
import "Report";
// all the arguments
map argmap = GetInstArgs::argmap();
// Action if license is not accepted
// abort|continue|halt
// halt is the default
// bugzilla #252132
string action = argmap["action"]:"halt";
// Do not halt the machine in case of declining the license
// just abort
// bugzilla #330730
if (Mode::live_installation()) {
action = "abort";
}
boolean test_mode = false;
if (size (WFM::Args()) > 0 && is (WFM::Args(0), string)) {
y2milestone ("Args: %1", WFM::Args());
if (WFM::Args(0) == "test")
test_mode = true;
}
if (test_mode) Wizard::CreateDialog();
symbol ask_ret = nil;
if (Stage::initial ())
{
ask_ret = ProductLicense::AskFirstStageLicenseAgreement (0, action);
}
else
{
// #304865: Enhance YaST Modules to cooperate better handling the product licenses
string directory = argmap["directory"]:"";
// FATE #306295: More licenses in one dialog
list <string> directories = argmap["directories"]:[];
// Priority 0: More directories
if (directories != nil && directories != []) {
y2milestone ("Using directories: %1", directories);
// Priority 1: Script args
} else if (directory != nil && directory != "") {
y2milestone ("Using directory: %1", directory);
directories = [directory];
// Priority 2: Fallback - Control file
} else {
directory = ProductFeatures::GetStringFeature ("globals", "base_product_license_directory");
// control file
if (directory != nil && directory != "") {
y2milestone ("Using directory (from control file): %1", directory);
// fallback - hard-coded
} else {
directory = "/etc/YaST2/licenses/base/";
y2warning ("No 'base_product_license_directory' set, using %1", directory);
}
directories = [directory];
}
if (directories != nil) {
list <string> tmp_directories = maplist (string one_directory, directories, {
return Directory::custom_workflow_dir + one_directory;
});
directories = tmp_directories;
y2milestone ("License directories after additional modifications: %1", directories);
}
if (directories == nil || directories == []) {
// Error message
Report::Error (_("Internal error: Missing license to show"));
y2error ("Nothing to do");
ask_ret = `auto;
} else if (size (directories) > 1) {
ask_ret = ProductLicense::AskInstalledLicensesAgreement (directories, action);
} else {
ask_ret = ProductLicense::AskInstalledLicenseAgreement (directories[0]:"", action);
}
}
if (test_mode) Wizard::CloseDialog();
if (ask_ret == nil || ask_ret == `auto)
return `auto;
else if (ask_ret == `abort || ask_ret == `back)
return ask_ret;
else if (ask_ret == `halt)
{
UI::CloseDialog();
// License has been aborted
// bugzilla #282958
if (test_mode != true)
SCR::Execute(.target.bash, "/sbin/halt -f -n -p");
return `abort;
}
else if (ask_ret == `next)
return `next;
else if (ask_ret == `accepted)
return `next;
else
{
y2error ("Unknown return: %1", ask_ret);
return `next;
}
/* EOF */
}
ACC SHELL 2018