ACC SHELL
/**
* File: installation/general/inst_congratulate.ycp
* Module: Installation
* Summary: Display congratulation
* Authors: Arvin Schnell <arvin@suse.de>
*
* Display a congratulation message for the user.
*
* $Id: inst_congratulate.ycp 62004 2010-05-12 13:34:34Z ug $
*/
{
textdomain "installation";
import "Mode";
import "Wizard";
import "Popup";
import "Label";
import "ProductFeatures";
import "GetInstArgs";
import "Call";
import "Package";
import "ProductControl";
import "Stage";
import "AddOnProduct";
import "Service";
/**
* Function returns true when the default windowmanager is KDE
* See bug 170880 for more information
*
* @return boolean wm is is_kde
*/
boolean DisplayKDEHelp () {
string default_wm = (string) SCR::Read(.sysconfig.windowmanager."DEFAULT_WM");
y2debug("Default WM: %1", default_wm);
if (default_wm != nil && tolower(default_wm) == "kde") {
return true;
}
return false;
}
map argmap = GetInstArgs::argmap();
// show button "clone system"?
boolean show_clone_checkbox = ! (Stage::firstboot () || Mode::live_installation ());
boolean clone_checkbox_active = ProductFeatures::GetBooleanFeature("globals", "enable_clone");
boolean clone_enabled = true;
// #302495: Switching ZMD off
// by default, the checkbox is not visible
string zmd_service_name = "novell-zmd";
string zmd_package_name = "zmd";
term check_box_turnoff_zmd = `Empty();
string turnoff_zmd_help= "";
// See FATE #302495
// Param 'show_zmd_turnoff_checkbox' says whether the checkbox for stopping and
// disabling ZMD should be shown
boolean show_zmd_turnoff_checkbox = (argmap["show_zmd_turnoff_checkbox"]:"no" == "yes");
// Param 'zmd_turnoff_default_state' says whether the checkbox is selected or
// not by default
boolean turnoff_zmd_default_state = (argmap["zmd_turnoff_default_state"]:"no" == "yes");
boolean zmd_installed = Package::Installed (zmd_package_name);
// don't check for state a service that is not installed
boolean zmd_enabled_or_running = (zmd_installed && (Service::Enabled (zmd_service_name) || Service::Status (zmd_service_name) == 0));
y2milestone ("ZMD Installed: %1, Enabled/Running: %2", zmd_installed, zmd_enabled_or_running);
y2milestone ("Show TurnOffZMD checkbox: %1, default state: %2", show_zmd_turnoff_checkbox, turnoff_zmd_default_state);
// + 'show_zmd_turnoff_checkbox'
// + ZMD package needs to be installed
// + ZMD service needs to be enabled
if (show_zmd_turnoff_checkbox && zmd_installed && zmd_enabled_or_running) {
check_box_turnoff_zmd = `CheckBox (
`id (`turnoff_zmd),
// TRANSLATORS: check box, see #ZMD
_("&Disable ZMD Service"),
// control_file->software->zmd_turnoff_default_state
// says whether the checkbox is selected or not by default
turnoff_zmd_default_state
);
// TRANSLATORS: help text, see #ZMD
turnoff_zmd_help = _("<p>Select <b>Disable ZMD Service</b> to stop and disable
the ZMD service during the system start.</p>");
} else {
y2milestone ("ZMD Turnoff check-box will be invisible");
}
map display = UI::GetDisplayInfo();
integer space = display["TextMode"]:true ? 1 : 3;
string vendor_url_tmp = ProductFeatures::GetStringFeature("globals", "vendor_url");
// fallback
string vendor_url = "http://www.novell.com/linux/";
if (ProductFeatures::GetStringFeature("globals", "ui_mode") == "simple") {
vendor_url = "http://www.openSUSE.org";
}
y2milestone ("UI mode: %1", ProductFeatures::GetStringFeature("globals", "ui_mode"));
if (vendor_url_tmp != nil && vendor_url_tmp != "")
vendor_url = vendor_url_tmp;
term check_box_do_clone = `Empty();
if (show_clone_checkbox)
{
check_box_do_clone = `CheckBox (`id(`do_clone),
// Check box: start the clone process and store the AutoYaST
// profile in /root/autoinst.xml
_("&Clone This System for AutoYaST"), clone_checkbox_active);
}
// caption for dialog "Congratulation Dialog"
string caption = _("Installation Completed");
string text = ProductControl::GetTranslatedText ("congratulate");
if (text == "") {
// congratulation text 1/4
text = _("<p><b>Congratulations!</b></p>") +
// congratulation text 2/4
_("<p>The installation of &product; on your machine is complete.
After clicking <b>Finish</b>, you can log in to the system.</p>
") +
// congratulation text 3/4
sformat(_("<p>Visit us at %1.</p>"), vendor_url ) +
// congratulation text 4/4
_("<p>Have a lot of fun!<br>Your SUSE Development Team</p>");
}
else
{
text = sformat (text, vendor_url);
}
term contents = `VBox (
`VSpacing (space),
`HBox (
`HSpacing (2*space),
`VBox(
`RichText (`id (`text), text),
`VSpacing (space/2),
`Left (check_box_turnoff_zmd),
`Left (check_box_do_clone)
),
`HSpacing (2*space)
),
`VSpacing (space),
`VSpacing (2)
);
string help_file = "";
// help 1/4 for dialog "Congratulation Dialog"
string help = _("<p>Your system is ready for use.</p>") +
// help 2/4 for dialog "Congratulation Dialog"
_("<p><b>Finish</b> will close the YaST installation and continue
to the login screen.</p>
") +
// help 3/4 for dialog "Congratulation Dialog"
(DisplayKDEHelp() ? _("<p>If you choose the default graphical desktop KDE, you can
adjust some KDE settings to your hardware. Also notice
our SUSE Welcome Dialog.</p>
") : ""); // Show this help only in case of KDE as the default windowmanager
if (show_clone_checkbox)
help = help + _("<p>Use <b>Clone</b> if you want to create an AutoYaST profile.
AutoYaST is a way to do a complete SUSE Linux installation without user interaction. AutoYaST
needs a profile to know what the installed system should look like. If this option is
selected, a profile of the current system is stored in <tt>/root/autoinst.xml</tt>.</p>");
if (show_zmd_turnoff_checkbox)
help = help + turnoff_zmd_help;
void CallCloning () {
// #187558
// Load Add-On products configured in the fist stage
AddOnProduct::ReadTmpExportFilename();
if( !Package::InstallMsg( "autoyast2",
_("<p>To clone the current system, the <b>%1</b> package must be installed.</p>") +
_("<p>Install it now?</p>")) ) {
Popup::Error( _("autoyast2 package not installed. Cloning disabled.") );
} else {
// #165860
// Save sources now because cloning garbles the target
// Cloning reinitializes sources when it needs them
Pkg::SourceSaveAll ();
Call::Function("clone_system" , []);
}
}
void StopAndDisableZMD () {
y2milestone ("Stopping service: %1 -> %2", zmd_service_name, Service::Stop (zmd_service_name));
y2milestone ("Disabling service: %1 -> %2", zmd_service_name, Service::Disable (zmd_service_name));
}
Wizard::SetContents (caption, contents, help,
GetInstArgs::enable_back(), GetInstArgs::enable_next());
Wizard::SetTitleIcon ("yast-license");
Wizard::SetNextButton(`next, Label::FinishButton() );
Wizard::RestoreAbortButton();
Wizard::SetFocusToNextButton();
if( UI::WidgetExists(`id(`do_clone)) )
UI::ChangeWidget (`id(`do_clone), `Enabled, clone_enabled);
any ret = nil;
repeat {
ret = Wizard::UserInput();
if (ret == `abort)
{
if (Popup::ConfirmAbort (`incomplete))
break;
}
else if ( ret == `help )
{
Wizard::ShowHelp (help);
}
} until ( ret == `next || ret == `back );
// bugzilla #221190
if (ret == `back) {
Wizard::RestoreNextButton ();
} else if (ret == `next) {
// BNC #441452
// Remove the congrats dialog
boolean zmd = (UI::WidgetExists (`id (`turnoff_zmd)) && (boolean) UI::QueryWidget (`id (`turnoff_zmd), `Value));
boolean clone = (UI::WidgetExists (`id (`do_clone)) && (boolean) UI::QueryWidget (`id (`do_clone), `Value));
// Dialog busy message
Wizard::SetContents (caption, `Label(_("Finishing the installation...")), help,
GetInstArgs::enable_back(), GetInstArgs::enable_next());
if ( zmd )
StopAndDisableZMD();
if ( clone )
CallCloning();
}
// save all sources and finish target
// bnc #398315
Pkg::SourceSaveAll();
Pkg::TargetFinish();
return ret;
}
// indentation is f*cked up but this comes close at least
// vim: set noexpandtab:
// vim: set tabstop=8:
ACC SHELL 2018