ACC SHELL

Path : /usr/share/YaST2/include/installation/
File Upload :
Current File : //usr/share/YaST2/include/installation/inst_inc_all.ycp

/**
 * File: include/installation/inst_inc_all.ycp
 * Module: System installation
 * Summary: Miscelaneous functions
 * Authors: Lukas Ocilka <locilka@suse.cz>
 *
 * $Id: inst_inc_all.ycp 59301 2009-11-04 15:32:29Z mzugec $
 *
 */
{

    textdomain "installation";

    import "ProductControl";
    import "Label";
    import "Linuxrc";
    import "Wizard";
    import "Arch";
    import "Report";
    import "Installation";
    import "Stage";
    import "Mode";

    void SetInitializingUI () {
	// dialog content - busy message
	string ui_message = _("Initializing the installation environment...");
	// help for the dialog - busy message
	string ui_help = _("<p>Initializing the installation...</p>");

	// another texts for second stage
	if (Stage::cont()) {
	    // dialog content - busy message
	    ui_message = _("Preparing the 1st system configuration...");
	    // help for the dialog - busy message
	    ui_help = _("<p>Please wait...</p>");
	}

        Wizard::SetContents(
            // dialog caption
            _("Initializing..."),
	    `Label(ui_message),
	    ui_help,
            false, false
        );
        Wizard::SetTitleIcon("yast-inst-mode");
    }

    void SetUIContent () {
        // Wizard::OpenNextBackStepsDialog();
	SetInitializingUI ();
    }

    void SetGlobalInstallationFeatures () {
	// FATE #304395: Disabling (or handling) screensaver during installation
	// Disabling screen-saver on startup
	if (WFM::Read (.local.size, "/usr/bin/xset") != -1) {
	    y2milestone ("Disabling Energy Star (DPMS) features");
	    // DPMS off values, disable DPMS, disable screen-saver
	    WFM::Execute (.local.bash, "/usr/bin/xset dpms 0 0 0; /usr/bin/xset -dpms; /usr/bin/xset s 0 0; /usr/bin/xset s off");
	}
    }

    void FinishInstallation (symbol ret) {
        y2milestone("Finishing the installation...");

	if (ret == `reboot || ret == `restart_yast || ret == `restart_same_step || ret == `abort) {
    	    // TRANSLATORS: busy message
    	    UI::OpenDialog (`Label(_("Writing YaST Configuration...")));	// #2
	} else {
	    // FATE #304395: Disabling (or handling) screensaver during installation
	    // Enabling screen-saver on exit
	    if (WFM::Read (.local.size, "/usr/bin/xset") != -1) {
		y2milestone ("Enabling Energy Star (DPMS) features");
		// default DPMS values, enable DPMS, enable screen-saver
		WFM::Execute (.local.bash, "/usr/bin/xset dpms 1200 1800 2400; /usr/bin/xset +dpms; /usr/bin/xset s on; /usr/bin/xset s default;");
	    }

	    // TRANSLATORS: busy message
	    UI::OpenDialog (`Label(_("Finishing the installation...")));	// #2
	}
	
        UI::CloseDialog();							// #2
    }

    /**
     * Sets autoinstallation behavior.
     */
    void SetAutoinstHandling () {
	if (! Mode::autoinst())
	    return;

    	map reportMap = $[
	    "errors":$[ "timeout":0 ],
	    "warnings":$[ "timeout":10 ],
    	    "yesno_messages":$[ "timeout":10 ]
    	];
    	Report::Import( reportMap );

    	Report::DisplayErrors  (true, 0);
    	Report::DisplayWarnings(true, 10);
    	Report::DisplayMessages(true, 10);
    }

    void ShowTextFallbackMessage () {
        if (
            (Installation::text_fallback () || Installation::no_x11 ())
            && (Installation::x11_setup_needed () && Arch::x11_setup_needed ())
            && !Installation::shown_text_mode_warning
        ) {
            string x11_msg = "";
            if ((Installation::no_x11 () || Installation::text_fallback ()) && Stage::initial ()) {
                // Somehow the graphical frontend failed and we're running in
                // text mode. Inform the user about this fact.
                x11_msg = sformat(_("Your computer does not fulfill all requirements for
a graphical installation. There is less than %1 MB
memory or the X server could not be started.

As a fallback, the text front-end of YaST2 will guide you
through the installation. This front-end offers the
same functionality as the graphical one, but the screens
differ from those in the manual.
"), "96");

            } else if (
                (Installation::no_x11 () || Installation::text_fallback ()) && Stage::cont ()
            ) {
                // The script YaST2 wants to inform about a problem with the
                // option no_x11 but it's broken.
                // else if (Installation::no_x11 ())

                // Somehow the graphical frontend failed and we're running in
                // text mode. Inform the user about this fact.
                x11_msg = _("The graphical interface could not be started.

The required packages were not installed (minimal installation) or
the graphics card is not properly supported.

As a fallback, the text front-end of YaST2 will guide you
through the installation. This front-end offers the
same functionality as the graphical one, but the screens
differ from those in the manual.
");
            }

            if (x11_msg != "") {
                Report::Message(x11_msg);
            } else {
                y2error ("There should be a more detailed message displayed here,
but something went wrong, that's why it is only in the log");
            }

            // show this warning only once
            Installation::shown_text_mode_warning = true;
        }
    }

    /**
     * Re-translate static part of wizard dialog and other predefined messages
     * after language change
     */
    void retranslateWizardDialog() {
            y2milestone( "Retranslating messages" );

            // Make sure the labels for default function keys are retranslated, too.
            // Using Label::DefaultFunctionKeyMap() from Label module.
            UI::SetFunctionKeys( Label::DefaultFunctionKeyMap() );

            // Activate language changes on static part of wizard dialog
            ProductControl::RetranslateWizardSteps();
            Wizard::RetranslateButtons();
            Wizard::SetFocusToNextButton();
            return;
    }

    void SetNetworkActivationModule () {
        // update the workflow according to current situation
        // disable lan activation if not needed

        if (!(Linuxrc::InstallInf("ConfigureNetwork")=="1") ) {
            y2milestone ("Disabling network activation module");
            ProductControl::DisableModule ("lan");
        }
    }

    void SetDiskActivationModule () {
        // update the workflow according to current situation
        // disable disks activation if not needed
        boolean iscsi = Linuxrc::InstallInf("WithiSCSI") == "1";

        if (! (Arch::s390() || iscsi)) {
            y2milestone ("Disabling disk activation module");
            ProductControl::DisableModule ("disks_activate");
        }
    }

} //end of include

ACC SHELL 2018