ACC SHELL

Path : /usr/share/YaST2/clients/
File Upload :
Current File : //usr/share/YaST2/clients/installation_settings_finish.ycp

/**
 * File:	clients/installation_settings_finish.ycp
 * Package:	Installation
 * Summary:	Installation - save settings (used later in second stage, or ...).
 *		See bnc #364066, #390930.
 * Authors:	Lukas Ocilka <locilka@suse.cz>
 *
 * $Id: installation_settings_finish.ycp 58537 2009-09-04 16:28:41Z kmachalkova $
 *
 */

{
    textdomain "installation";

    import "ProductControl";
    import "InstData";
    import "Mode";

    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 installation_settings_finish");
    y2debug("func=%1", func);
    y2debug("param=%1", param);

    void Write () {
	if (ProductControl::GetDisabledModules() == nil) {
	    y2error ("Wrong definition of DisabledModules");
	    return;
	}

	if (InstData::wizardsteps_disabled_modules == nil) {
	    y2error ("Path to write disabled modules is not defined!");
	    return;
	}

	y2milestone (
	    "Writing disabled modules %1 into %2",
	    ProductControl::GetDisabledModules(),
	    InstData::wizardsteps_disabled_modules
	);

	if ((boolean) SCR::Write (.target.ycp, InstData::wizardsteps_disabled_modules, ProductControl::GetDisabledModules()) != true) {
	    y2error ("Cannot write disabled modules");
	}

	y2milestone (
	    "Writing disabled proposals %1 into %2",
	    ProductControl::GetDisabledProposals(),
	    InstData::wizardsteps_disabled_proposals
	);

	if ((boolean) SCR::Write (.target.ycp, InstData::wizardsteps_disabled_proposals, ProductControl::GetDisabledProposals()) != true) {
	    y2error ("Cannot write disabled proposals");
	}

	y2milestone (
	    "Writing disabled subproposals %1 into %2",
	    ProductControl::GetDisabledSubProposals(),
	    InstData::wizardsteps_disabled_subproposals
	);

	if ((boolean) SCR::Write (.target.ycp, InstData::wizardsteps_disabled_subproposals, ProductControl::GetDisabledSubProposals()) != true) {
	    y2error ("Cannot write disabled subproposals");
	}

	y2milestone (
	    "Writing disabled AC items %1 into %2",
	    ProductControl::GetDisabledACItems(),
	    InstData::wizardsteps_disabled_ac_items
	);

	if ((boolean) SCR::Write (.target.ycp, InstData::wizardsteps_disabled_ac_items, ProductControl::GetDisabledACItems()) != true) {
	    y2error ("Cannot write disabled AC items");
	}


	// bnc #390930
	// Since there is no second stage during upgrade, SuSEConfig has to be run
	// by hooks
	if (Mode::update()) {
	    y2milestone ("Creating hook-file %1", InstData::suseconfig_hookfile);
	    if ((boolean) SCR::Write (.target.string, InstData::suseconfig_hookfile, "")) {
		y2error ("Cannot write suseconfig hook-file");
	    }
	}

	y2milestone ("Anyway, successful");
    }

    if (func == "Info") {
	ret = (any) $[
	    "steps" : 1,
	    // progress step title
	    "title" : _("Writing automatic configuration..."),
	    "when" : [ `installation, `update, `autoinst ],
	];
    } else if (func == "Write") {
	Write();
    } else {
	y2error ("unknown function: %1", func);
	ret = nil;
    }

    return ret;
}

ACC SHELL 2018