ACC SHELL

Path : /var/lib/named/proc/self/root/usr/share/YaST2/clients/
File Upload :
Current File : //var/lib/named/proc/self/root/usr/share/YaST2/clients/inst_do_net_test.ycp

/*
 * File:	clients/inst_do_net_test.ycp
 * Package:	Network configuration
 * Summary:	Configuration dialogs for installation
 * Authors:	Michal Svec <msvec@suse.cz>
 *		Arvin Schnell <arvin@suse.de>
 *
 * $Id: inst_do_net_test.ycp 57377 2009-06-01 10:00:40Z mzugec $
 */

{

textdomain "network";

import "Directory";
import "Internet";
import "Label";
import "Mode";
import "Popup";
import "Product";
import "Wizard";
import "PackageCallbacks";
import "Proxy";
import "GetInstArgs";
import "Report";
import "String";

include "network/routines.ycp";
include "network/installation/dialogs.ycp";


/* Called backwards */
if(GetInstArgs::going_back())
   return `auto;

if(!Internet::do_test)
{
    // no internet test - no suse register
    // suse register then only informs about its existence
    Internet::suse_register = false;
    return `auto;
}

Internet::suse_register = true;

boolean we_have_patches = false;

// do we have a connection already?
// then don't open or close it, don't show respective steps
boolean already_up = false;

// curl return code of downloading release notes
// useful to tell apart misconfigured network 
// from server side error (#236371)
integer curl_ret_code = 0;

//subset of curl return codes, indicating misconfigured network
list <integer> curl_ret_codes_bad = 
[ 5, //couldn't resolve proxy
  6, //couldn't resolve host
  7  //couldn't connect()
];

// Stage transitions in handle_stage:
// open: wait (test), copy, finish (failure), wait
// wait: copy (test), finish (failure), copy
// copy: relnotes
// relnotes: patches
// patches: close
// close: finish
// finish
symbol test_stage = `open;

symbol test_result = `success;

// list of all log files to show
list<map> logs = [];

// dir of log files
// Formerly it was under tmpdir and thus got erased automatically.
// Now we want to keep it (#46285), so let's put it under logdir.
string logdir = Directory::logdir + "/internet-test";


if(!Mode::test ())
    already_up = Internet::Status();


/* Progress step 1/3 */
string l1 = _("Connecting to Internet...");
/* Progress step 2/3 */
string l2 = _("Downloading the latest release notes...");
/* Progress step 3/3 */
string l4 = _("Closing connection...");


/**
 * Return current language with .UTF-8 appended.
 * FIXME: there must be a better way!
 */
define string GetLanguageUTF8 ()
{
    string tmp = WFM::GetLanguage ();
    integer pos = findfirstof (tmp, "@.");
    if (pos != nil)
	tmp = substring (tmp, 0, pos);
    return tmp + ".UTF-8";
};


/* fix checkycp complaints */
string dash = "-   ";
string excl = "!   ";

    /**
     * Create the dialog contents
     */
    define void make_dialog ()
    {
	/* Test dialog caption */
	string caption = _("Running Internet Connection Test");

	/* help for dialog "Running Internet Connection Test" */
	string help = _("<p>Here, view the progress of the
Internet connection test.</p>
") +

	    /* help for dialog "Running Internet Connection Test" */
	    _("<p>The test can be aborted by pressing
<b>Abort Test</b>.</p>
");

	// In update mode there's no network setup, #50381
	// Actually it depends on the control file, but it's only a help text
	if (!Mode::update ())
	{
	    help = help +
		/* help for dialog "Running Internet Connection Test" */
		_("<p>If the test fails, return to the network configuration
and correct the settings.</p>
");
	}

	/* Progress labels */
	term progress = `VBox();

	// do not connect to internet when already connected
	if(!already_up)
	    progress = add(progress, `Left(`HBox(`Heading(`id(`s1), dash), `Label(l1))));
	if(true)
	    progress = add(progress, `Left(`HBox(`Heading(`id(`s2), dash), `Label(l2))));
	// do not shutdown the connection when already connected
	if(!already_up)
	    progress = add(progress, `Left(`HBox(`Heading(`id(`s3), dash), `Label(l4))));

	progress = add(progress, `VStretch());

	progress = add(progress, `HBox(
				       /* Label for result of internet test */
				       `Label(_("Test Result:")),
				       `HSpacing(2),
				       `Label(`id(`res), `opt(`outputField, `hstretch), "")
				       ));

	progress = add(progress, `VSpacing(1));

	/* Push Button to abort internet test */
	progress = add(progress, `PushButton(`id(`abort_test), _("&Abort Test")));

	/* Frame label: status of internet test */
	progress = `Frame (_("Test Status"),
			   `VBox (
			       `VSpacing (1),
			       `HBox (
				   `HSpacing (1),
				   progress,
				   `HSpacing (1)
				   ),
			       `VSpacing (1)
			       )
	    );

	/* Test dialog contents */
	term contents = `VBox(
			      `VStretch(),
			      `VBox(`HVCenter(`HSquash(progress))),
			      `VStretch(),
			      /* Push Button to see logs of internet test */
			      `PushButton(`id(`view_log), `opt(`disabled), _("&View Logs...")),
			      `VStretch()
			      );

	Wizard::SetContents(caption, contents, help, true, true);
	Wizard::SetTitleIcon ("yast-network");
    }


    /**
     * @param i step number 1..4
     * @param s bullet: `arrow: current, `check: done, `dash: not done or failed
     */
    define void mark_label (integer i, symbol s)
    {
	list<symbol> widgets = [nil, `s1, `s2, `s3, `s4];
	map<symbol, string> bullets = $[
	    `arrow : UI::Glyph (`BulletArrowRight),
	    `check : UI::Glyph (`CheckMark),
	    `dash : excl,
	    ];

	if (UI::WidgetExists(`id(widgets[i]:nil))) {
	    UI::ChangeWidget (`id (widgets[i]:nil), `Value, bullets[s]:"?");
	} else {
	    y2error("No such widget with ID: %1", widgets[i]:nil);
	}
    }


    define void show_result ()
    {
	if(test_result == `success) {
	    Internet::test = true;
	    /* result of internet test */
	    UI::ChangeWidget(`id(`res), `Value, _("Success"));
	} else {
	    Internet::test = false;
	    /* result of internet test */
	    UI::ChangeWidget(`id(`res), `Value, _("Failure"));
	}
    }


    define void copy_logs1 ()
    {
	integer ret_command = nil;
	string  run_command = nil;
    
	// label of combobox where the log is selected
	logs = add (logs, $[ `menuname : _("Kernel Network Interfaces"),
			     `filename : "ifconfig.log" ]);
	run_command = "/sbin/ifconfig > '" + String::Quote (logdir) + "/ifconfig.log'";
	ret_command = (integer) SCR::Execute (.target.bash, run_command,
		      $["LANG" : GetLanguageUTF8 ()]);
	if (ret_command != 0) y2error("Command '%1' failed -> %2", run_command, ret_command);

	// label of combobox where the log is selected
	logs = add (logs, $[ `menuname : _("Kernel Routing Table"),
			     `filename : "route.log" ]);
	run_command = "/sbin/route -n > '" + String::Quote (logdir) + "/route.log'";
	ret_command = (integer) SCR::Execute (.target.bash, run_command,
		      $["LANG" : GetLanguageUTF8 ()]);
	if (ret_command != 0) y2error("Command '%1' failed -> %2", run_command, ret_command);

	// label of combobox where the log is selected
	logs = add (logs, $[ `menuname : _("Hostname Lookup"),
			     `filename : "resolv.conf" ]);
	run_command = "/bin/cp /etc/resolv.conf '" + String::Quote (logdir) + "/resolv.conf'";
	ret_command = (integer) SCR::Execute (.target.bash, run_command);
	if (ret_command != 0) y2error("Command '%1' failed -> %2", run_command, ret_command);
    }


    define void copy_logs2 ()
    {
	integer ret_command = nil;
	string  run_command = nil;

	// label of combobox where the log is selected
	logs = add (logs, $[ `menuname : _("Kernel Messages"),
			     `filename : "messages" ]);
	run_command = Directory::ybindir + "/cut-messages > '" + String::Quote (logdir) + "/messages'";
	ret_command = (integer) SCR::Execute (.target.bash, run_command);
	if (ret_command != 0) y2error("Command '%1' failed -> %2", run_command, ret_command);

	if (Internet::logfile != "") {
	    // label of combobox where the log is selected
	    logs = add (logs, $[ `menuname : _("PPP Daemon"),
				 `filename : "smpppd.log",
				 `prio : 20 ]);
	    run_command = "/bin/cp '" + String::Quote (Internet::logfile) + "' '" + String::Quote (logdir) + "/smpppd.log'";
	    ret_command = (integer) SCR::Execute (.target.bash, run_command);
	    if (ret_command != 0) y2error("Command '%1' failed -> %2", run_command, ret_command);
	}
    }


    define integer wait_for_test ()
    {
	while ( (boolean)SCR::Read(.background.output_open) || (boolean)SCR::Read(.background.isrunning) )
	{
	    sleep (100);

	    any ret = UI::PollInput ();

	    if (ret == `abort || ret == `abort_test)
	    {
		// Abort pressed by the user
		y2milestone ("Test aborted by user");
		SCR::Execute (.background.kill);
		return -1;
	    }
	}

	// check the exit code of the test
	integer res = (integer)SCR::Read(.background.status);

	y2milestone ("Command returned: %1", res);

	return res;
    }

    // File names of downloaded release notes
    list <string> release_notes_filenames = [];

    // RPM names of downloaded release notes
    map <string, string> release_notes_rpms = $[];

    /**
     * Download all release notes mentioned in Product::relnotesurl_all
     *
     * @return true when successful
     */
    define boolean download_release_notes () {
	// At least one release notes downloaded means success
	// but the default is false in case of some release-notes
	// available for download
	// @see Bug #181094
	boolean test_ret = false;

	integer relnotes_counter = 0;

	Product::relnotesurl_all = toset(Product::relnotesurl_all);

	//#390738: only one URL now
	//works well with the list of all products
//	string url = Product::relnotesurl;
	foreach (string url, Product::relnotesurl_all, {
	    // protect from wrong urls
	    if (url == nil || url == "") {
		y2warning("Skipping relnotesurl '%1'", url);
		return false;
	    }

	    integer pos = findlastof (url, "/") + 1;
	    if (pos == nil) {
		y2error ("broken url for release notes: %1", url);
		return false;
	    }

	    //relnotes_counter = relnotes_counter + 1;
	    // Where we want to store the downloaded release notes
	    string filename = sformat("%1/%2-%3",
		(string) SCR::Read (.target.tmpdir),
		relnotes_counter,
		substring (url, pos)
	    );
	    // Package name
	    release_notes_rpms[filename] = substring (url, pos);
	    release_notes_rpms[filename] = regexpsub(release_notes_rpms[filename]:"\.rpm", "(.*)\.rpm", "\\1");

	    // Where to store the curl log
	    string log_filename = sformat("curl_%1.log", relnotes_counter);

	    // Get proxy settings (if any)
	    string proxy = "";
	    Proxy::Read();

	    // Test if proxy works
	    if (Proxy::enabled) {
		//it is enough to test http proxy, release notes are downloaded via http
	        map <string, map <string, any> > proxy_ret = Proxy::RunTestProxy(Proxy::http, "", "", Proxy::user, Proxy::pass);

	        if ( (proxy_ret["HTTP", "tested"]:true == true) && ((integer) proxy_ret["HTTP", "exit"]:1 == 0 ) ) {
		    string user_pass = (Proxy::user != "") ? (Proxy::user + ":" + Proxy::pass) : "";
		    proxy = "--proxy " + Proxy::http + ((user_pass != "") ? (" --proxy-user '" + user_pass + "'") : "");
		}
	    }

	    //Include also proxy option (if applicable) - #162800, #260407 
	    string cmd = " /usr/bin/curl -s -S -v -f -m 300 " + proxy + " " + url + " -o " + filename;
	    cmd = cmd + " > " + logdir + "/" + log_filename + " 2>&1";

	    // env["LANG"] = GetLanguageUTF8 ();

	    y2milestone ("Downloading release notes: %1", cmd);
//	    SCR::Execute(.background.run, cmd);
//	    integer ret = wait_for_test ();
	    integer ret = (integer)SCR::Execute(.target.bash, cmd);
	    if (ret == 0) {
		release_notes_filenames = add (release_notes_filenames, filename);
		y2milestone("Successful");
		// At least one successfully installed -> internet test succeeded
		test_ret = true;
	    } else {
		y2error("Downloading failed");
		curl_ret_code = ret;
	    }

	    // label of combobox where the log is selected
	    string menu_name = _("Download of Release Notes");
	    // identify release notes by name of the product, bug 180581
	    if (Product::product_of_relnotes[url]:"" != "") {
		menu_name = menu_name + sformat(" (%1)", Product::product_of_relnotes[url]:"");
	    }
	    logs = add (logs, $[ `menuname : menu_name, `filename : log_filename ]);

	});
	return test_ret;
    }

    /**
     * Function checks two versions of installed rpm and decides whether the second one is
     * newer than the first one. This function ignores non-numerical values in versions
     *
     * @param string first version
     * @param string second version
     * @return boolean true if the second one is newer than the first one
     */
    boolean IsDownloadedVersionNewer (string installed_rpm_version, string downloaded_rpm_version) {
	list <string> installed_rpm_version_l = filter(string one_item, splitstring(installed_rpm_version, "-\."), {
	    return regexpmatch(one_item, "^[0123456789]+$");
	});
	list <string> downloaded_rpm_version_l = filter(string one_item, splitstring(downloaded_rpm_version, "-\."), {
	    return regexpmatch(one_item, "^[0123456789]+$");
	});
	
	y2milestone("Evaluating installed %1 and downloaded %2 versions", installed_rpm_version_l, downloaded_rpm_version_l);
	
	integer installed_version_item = nil;
	integer downloaded_version_item = nil;
	
	boolean downloaded_version_is_newer = false;
	integer loop_counter = 0;
	foreach (string i_item, installed_rpm_version_l, {
	    installed_version_item  = tointeger(i_item);
	    downloaded_version_item = tointeger(downloaded_rpm_version_l[loop_counter]:"0");
	    if (downloaded_version_item != installed_version_item) {
		downloaded_version_is_newer = (downloaded_version_item > installed_version_item);
		break;
	    }
	    loop_counter = loop_counter + 1;
	});
	
	y2milestone("%1 > %2 -> %3", downloaded_rpm_version, installed_rpm_version, downloaded_version_is_newer);
	return downloaded_version_is_newer;
    }

    /**
     * Function checks whether the downloaded and installed versions are different
     */
    boolean IsDownloadedRPMInstallable(string rpm_name, string disk_file) {
	string query_format = "%{NAME}-%{VERSION}";
	
	// Checking the installed version of RPM
	map cmd_installed_rpm_version = (map) SCR::Execute(.target.bash_output,
	    sformat("/bin/rpm -q --queryformat \"%1\" %2", query_format, rpm_name)
	);
	if (cmd_installed_rpm_version["exit"]:-1 != 0) {
	    y2warning("Cannot check the installed RPM version: %1 -> %2", disk_file, cmd_installed_rpm_version);
	    return true;
	}
	string installed_rpm_version = cmd_installed_rpm_version["stdout"]:"undefined-i";
	y2milestone("Installed version: '%1'", installed_rpm_version);
	
	// Checking the downloaded version of RPM
	map cmd_downloaded_rpm_version = (map) SCR::Execute(.target.bash_output,
	    sformat("/bin/rpm -qp --queryformat \"%1\" %2", query_format, disk_file)
	);
	if (cmd_downloaded_rpm_version["exit"]:-1 != 0) {
	    y2warning("Cannot check the downloaded RPM version: %1 -> %2", disk_file, cmd_downloaded_rpm_version);
	    return true;
	}
	string downloaded_rpm_version = cmd_downloaded_rpm_version["stdout"]:"undefined-d";
	y2milestone("Downloaded version: '%1'", downloaded_rpm_version);
	
	// The same or older versions -> false
	return IsDownloadedVersionNewer(installed_rpm_version, downloaded_rpm_version);
    }

    define boolean install_release_notes () {
	boolean test_ret = true;

	foreach (string filename, release_notes_filenames, {
	    boolean ret1 = Pkg::RpmChecksig (filename);

	    if (!ret1) {
		y2error ("checksig of release notes failed");
		// popup error message
		Report::Error(_("Cannot install downloaded release notes.
RPM signature check failed."));
		test_ret = false;
		// next loop
		return;
	    }
	    
	    // Checking whether installed/new rpm versions are different (#164388)
	    // Checking whether the downloaded one is newer (#167985)
	    string rpm_name = release_notes_rpms[filename]:"";
	    if (IsDownloadedRPMInstallable(rpm_name, filename)) {
		y2milestone("Downloaded version is newer, let's install it...");
	    } else {
		y2milestone("Downloaded version is the same or older, skipping...");
		return;
	    }
	    
	    boolean old2 = PackageCallbacks::EnableAsterixPackage (false);
	    boolean ret2 = Pkg::TargetInstall (filename);
	    PackageCallbacks::EnableAsterixPackage (old2);

	    if (!ret2) {
		y2error ("installation release notes failed.");
		// popup error message
		Report::Error(_("Installation of downloaded release notes failed."));
		test_ret = false;
		// next loop
		return;
	    }
	});

	return test_ret;
    }

    define void handle_stage ()
    {
	if (test_stage == `open)		// open connection
	{
	    if(Mode::test ()) {
		mark_label(1, `arrow);
		test_stage = `wait;
		return;
	    }

	    if(already_up)
	    {
		test_stage = `wait; // not `copy. NM takes its time. #145153
	    }
	    else
	    {
		mark_label(1, `arrow);

		if(!AskForPassword()) {
		    y2error("Password required");
		    test_stage = `finish;
		    test_result = `failure;
		    mark_label (1, `dash);
		    return;
		}

		// start the connection
		y2milestone("called Start");
		// label of combobox where the log is selected
		logs = add (logs, $[ `menuname : _("Opening of Connection"),
				     `filename : "ifup.log",
				     `prio : 16 ]);
		if(!Internet::Start(logdir + "/ifup.log")) {
		    // popup to inform user about the failure
		    Report::Error(_("Connecting to the Internet failed. View
the logs for details.
"));
		    test_stage = `finish;
		    test_result = `failure;
		    mark_label (1, `dash);
		    return;
		}

		test_stage = `wait;
	    }
	    return;
	}

	if (test_stage == `wait)		// wait until really connected
	{
	    if(Mode::test ()) {
		test_stage = `copy;
		mark_label(1, `check);
		return;
	    }

	    // status must be up
	    if(!Internet::Status()) {
		// popup to inform user about the failure
		Report::Error(_("Connecting to the Internet failed. View
the logs for details.
"));
		test_stage = `finish;
		test_result = `failure;
		if (!already_up) mark_label (1, `dash);
		return;
	    }

	    // and we must be connected
	    if(Internet::Connected())
	    {
		y2milestone("Connected ok");

		// even after we get an address, the test can fail. #145153
		// so before we have the dbus event filter, let's try this
		SCR::Execute (.target.bash, "ip route list >&2");
		y2milestone("Waiting 5000 to get initialized...");
		sleep (5000);
		SCR::Execute (.target.bash, "ip route list >&2");

		test_stage = `copy;
		if (!already_up) mark_label(1, `check);
		return;
	    }

	    // ping anything (www.suse.com) to trigger dod connections
	    SCR::Execute(.target.bash_background,
			 "/bin/ping -c 1 -w 1 213.95.15.200");
	    return;
	}

	if (test_stage == `copy)		// copy some status
	{
	    copy_logs1 ();
	    test_stage = `relnotes;
	}

	if (test_stage == `relnotes)		// download release notes
	{
	    mark_label(2, `arrow);

	    boolean ret = true;

//Product::relnotesurl_all=[ "http://www.suse.com/relnotes/i386/openSUSE/10.3/release-notes.rpm" ];
//y2error("FAKE RELNOTES!");

	    //#390738: need to read available products here (hopefully only one)
	    //but need to switch off package callbacks first
	    PackageCallbacks::RegisterEmptyProgressCallbacks();
	    Product::ReadProducts();
	    PackageCallbacks::RestorePreviousProgressCallbacks();

	    y2milestone("Product::relnotesurl = %1", Product::relnotesurl);
	// Fallback for situation that mustn't exist
	if (size (Product::relnotesurl_all) == 0 && (Product::relnotesurl == nil || Product::relnotesurl == "")) {
	 Popup::Warning(_("No URL for the release notes defined. Internet test cannot be performed."));
	 ret = false;
	} else
	 {

	    if (!download_release_notes ())
	    {
		// return code is not on the blacklist (meaning misconfigured network)
		// return true if user wants to continue despite the failure, false otherwise
		if ( !contains(curl_ret_codes_bad, curl_ret_code) ) 
		{
		    //popup informing user about the failure to retrieve release notes
		    //most likely due to server-side error
		    ret = Popup::ContinueCancel(_("Download of latest release notes failed due to server-side error. 
This does not necessarily mean misconfigured network.

Click 'Continue' to proceed to the next installation step. To skip any steps
requiring internet connection or to get back to your network configuration,
click 'Cancel'."));
		}
		// return code shows misconfigured network
		// return false
		else 
		{
		    // popup to inform user about the failure
		    Report::Error(_("Download of latest release notes failed. View
the logs for details."));
		    ret = false;
		}
		test_stage = `close;
	    }
	  }
	    if (ret)
	    {
		install_release_notes ();
		mark_label(2, `check);
	    }
	    else
	    {
		test_result = `failure;
		mark_label(2, `dash);
	    }

	    // we don't check for patches anymore
	    test_stage = `close;
	    return;
	}

	if (test_stage == `patches)		// check for updates
	{
	    if(!Product::run_you)
	    {
		test_stage = `close;
		return;
	    }

	    mark_label(3, `arrow);

	    string cmd = "/usr/bin/online_update -q -V";
	    // ugly hack (see bug #42177)
	    // string cmd = "/bin/false";
	    cmd = cmd + "> " + logdir + "/you.log 2>&1";

	    y2milestone ("online_update command: %1", cmd);
	

	    SCR::Execute(.background.run, cmd,
					$["LANG" : GetLanguageUTF8 ()]);
    	    integer ret = wait_for_test ();
	    
	    // label of combobox where the log is selected
	    logs = add (logs, $[ `menuname : _("Check for Patches"),
				 `filename : "you.log" ]);

	    if(ret == 0 || ret == 1 || ret == 2) // success
	    {
		we_have_patches = ret != 0;
		mark_label(3, `check);
	    }
	    else
	    {
		// popup to inform user about the failure
		Report::Error(_("Check for latest updates failed. View
the logs for details.
"));
		test_result = `failure;
		mark_label(3, `dash);
	    }

	    test_stage = `close;
	    return;
	}

	if (test_stage == `close)		// close connection
	{
	    if(Mode::test ()) {
		mark_label(4, `arrow);
		test_stage = `finish;
		mark_label(4, `check);
		return;
	    }

	    if(!already_up) {
		mark_label(4, `arrow);

		/* Stop connection */
		y2milestone("Connection: stop");
		// label of combobox where the log is selected
		logs = add (logs, $[ `menuname : _("Closing of Connection"),
				     `filename : "ifdown.log",
				     `prio : 14 ]);
		if(Internet::Stop(logdir + "/ifdown.log"))
		{
		    mark_label (4, `check);
		}
		else
		{
		    test_result = `failure;
		    mark_label (4, `dash);

		}
	    }

	    test_stage = `finish;
	    return;
	}
    }

    /* --- internet test starts here --- */

    // Create logdir
    if (!(boolean)SCR::Execute (.target.mkdir, logdir))
	y2error ("can't create logdir");

    any ret = nil;

    make_dialog();

    Wizard::DisableBackButton();
    Wizard::DisableAbortButton();
    Wizard::DisableNextButton();
    UI::ChangeWidget(`id(`abort_test), `Enabled, true);
    UI::ChangeWidget(`id(`view_log), `Enabled, false);

    UI::BusyCursor ();

    // loop during internet test

    SCR::Execute (.target.bash, "/bin/logger BEGIN OF YAST2 INTERNET TEST");

    while (true)
    {
	handle_stage ();

	if (test_stage == `finish)
	    break;

	ret = UI::TimeoutUserInput (250);

	if (ret == `timeout)
	    continue;

	if (ret == `abort_test)
	{
	    if (!already_up)
		Internet::Stop ("");
	    test_result = `failure;
	    break;
	}

	y2error ("Unexpected return code: %1", ret);
    }

    SCR::Execute (.target.bash, "/bin/logger END OF YAST2 INTERNET TEST");

    show_result ();

    copy_logs2 ();


    Wizard::EnableBackButton();
    Wizard::DisableAbortButton();
    Wizard::EnableNextButton();
    // #105811, it lost focus when it was disabled
    Wizard::SetFocusToNextButton();
    UI::ChangeWidget(`id(`abort_test), `Enabled, false);
    UI::ChangeWidget(`id(`view_log), `Enabled, true);

    UI::NormalCursor();

    /* --- internet test ends here --- */

    // loop after internet test
    while (true)
    {
	ret = UI::UserInput();

	if (ret == `view_log)
	{
	    ShowLogs (logs, logdir);
	    continue;
	}

	if (ret == `abort || ret == `cancel)
	{
	    if (Popup::ConfirmAbort (`incomplete))
		break;
	    continue;
	}

	if (ret == `back || ret == `next)
	{
	    break;
	}

	y2error ("Unexpected return code: %1", ret);
    }


    // set internal data according the test result
    if (ret == `next)
    {
	Internet::suse_register = test_result == `success;

// we don't check for patches here anymore
//	if (we_have_patches)
//	{
//	    Internet::do_you = true;
//	    // Removed due to integration of suse_register
//	    // AskYOUDialog ();
//	}
//	else
//	    Internet::do_you = false;
    }

    return (symbol) ret;

/* EOF */
}

ACC SHELL 2018