ACC SHELL
/**
* File: clients/inst_ask_online_update.ycp
* Module: Installation
* Summary: Ask if the user wants to run an online update during installation
* Authors: J. Daniel Schmidt <jdsn@suse.de>
*
* Ask if the user wants to run an online update during installation
*
* $Id: inst_ask_online_update.ycp 1 2006-02-17 13:20:02Z jdsn $
*/
{
textdomain "installation";
// FIXME: move to yast2-registration later, it doesn't belog here
import "Wizard";
import "Popup";
import "GetInstArgs";
import "CustomDialogs";
import "Directory";
import "Language";
import "Mode";
import "String";
import "Label";
import "Internet";
import "Installation";
import "NetworkService";
// BNC #572734
if (GetInstArgs::going_back()) {
y2milestone ("going_back -> returning `auto");
return `auto;
}
// BNC #450229
// There used to be >if (!Internet::do_you)<
if (NetworkService::isNetworkRunning() != true) {
y2milestone ("No network running, skipping online update...");
return `auto;
}
map ui = UI::GetDisplayInfo();
map argmap = GetInstArgs::argmap();
/* strings for "ask for online update"-popup */
string ask_update_run_btn = _("Run Update");
string ask_update_skip_btn = _("Skip Update");
string online_update = _("Online Update");
string ask_update_main = _("Run Online Update now?");
string help = _("Select whether to run an online update now.
You may skip this step and run an online update later.
");
/* vv MAIN (WIZARD) LAYOUT vv */
term sr_layout=nil;
sr_layout=`HVCenter(
`VBox(
`Left( `Label( ask_update_main ) ),
`Left( `RadioButtonGroup(`id(`run_update) ,
`HBox( `HSpacing(1),
`VBox(
`Left( `RadioButton(`id(`update), ask_update_run_btn, true )),
`Left( `RadioButton(`id(`noupdate), ask_update_skip_btn))),
`HSpacing(1)
) ) )
));
term contents = `VBox ( `VSpacing (0.5), sr_layout, `VSpacing (0.5));
/* ^^ END MAIN LAYOUT ^^ */
// check if there are some patches available
// BNC #447080
Pkg::TargetInitialize (Installation::destdir);
Pkg::TargetLoad();
Pkg::SourceStartManager (true);
// Patches need solver run to be selected
Pkg::PkgSolve (true);
integer selected = Pkg::ResolvableCountPatches (`affects_pkg_manager);
y2milestone ("Available patches for pkg management: %1", selected);
if (selected < 1)
{
selected = Pkg::ResolvableCountPatches (`all);
y2milestone ("All available patches: %1", selected);
if (selected < 1)
{
y2milestone ("No patch available, skiping offer to run YOU");
Internet::do_you = false;
return `next;
}
}
// check if we are in installation workflow or running independently (for development)
if (Mode::normal()) Wizard::CreateDialog();
Wizard::SetContents (online_update, contents, help, GetInstArgs::enable_back(), GetInstArgs::enable_next());
any ret=nil;
repeat {
ret = Wizard::UserInput();
if (ret == `abort)
{
if (Mode::normal()) break;
if (Popup::ConfirmAbort (`incomplete)) break;
}
else if (ret == `help)
{
Wizard::ShowHelp (help);
}
else if ( ret == `next )
{
// Skipping online update
if ((boolean) UI::QueryWidget(`id(`noupdate), `Value)) {
Internet::do_you = false;
} else {
// needed later
// BNC #450229
Internet::do_you = true;
}
}
} until ( ret == `next || ret == `back );
return (symbol)ret;
}
ACC SHELL 2018