ACC SHELL
{
/**
*
* Authors: Lukas Ocilka <locilka@suse.cz>
*
* Purpose: This script detects whether there is no active network.
* In such case, user can configure network manually.
* This should be used in the first stage installation.
*
* See More: FATE #301967
*
* $Id: inst_network_check.ycp 57028 2009-04-29 10:58:09Z lslezak $
*
*/
textdomain "installation";
import "NetworkService";
import "Wizard";
import "Popup";
import "GetInstArgs";
import "Directory";
import "Icon";
boolean enable_next = true;
boolean enable_back = true;
/**
* Script can be called with some arguments
*
* @struct [$[
* "dontskip" : true, // do not skipt the dialog even if network is configured
* ]]
*/
map argmap = GetInstArgs::argmap();
y2milestone ("Script args: %1", argmap);
/*
* We don't need to run this script to setup the network
* If some network is already running...
*/
if (NetworkService::isNetworkRunning()) {
if (argmap["dontskip"]:false == true) {
y2milestone ("Network is already running, not skipping (forced)...");
} else {
y2milestone ("Network is already running, skipping...");
return `next;
}
} else {
y2milestone ("No network configuration found, offering to set it up...");
}
map displayinfo = UI::GetDisplayInfo();
boolean supports_images = displayinfo["HasImageSupport"]:false;
Wizard::SetContents (
// TRANSLATORS: dialog caption
_("Network Setup"),
`VBox (
`VStretch(),
`RadioButtonGroup (
`id ("to_do_a_network_setup_or_not_to_do"),
`HBox (
`HStretch (),
`VBox (
// TRANSLATORS: dialog label
`HBox (
(supports_images ?
`HBox (
Icon::Simple ("warning"),
`HSpacing (2)
)
:
`Empty()
),
`Left (`Label (_("No network setup has been found.
It is important if using remote repositories,
otherwise you can safely skip it.
")))
),
`VSpacing (2),
// TRANSLATORS: dialog label
`Left(`Label (_("Configure your network card now?"))),
`VSpacing (1),
`Frame (
// TRANSLATORS: frame label
_("Select"),
`MarginBox ( 1.5, 1, `VBox (
// TRANSLATORS: radio button
`Left(`RadioButton (`id ("yes_do_run_setup"), _("&Yes, Run the Network Setup"), true)),
// TRANSLATORS: radio button
`Left(`RadioButton (`id ("no_do_not_run_setup"), _("No, &Skip the Network Setup")))
))
)
),
`HStretch ()
)
),
`VStretch()
),
// TRANSLATORS: help text, part 1/2
_("<p>The current installation system does not
have a configured network.</p>
") +
// TRANSLATORS: help text, part 2/2
_("<p>A configured network is needed for using remote repositories
or add-on products. If you do not use remote repositories, skip the configuration.</p>
"),
enable_next,
enable_back
);
Wizard::SetTitleIcon ("yast-network");
any ret = nil;
boolean run_setup = nil;
symbol return_this = `next;
while (true) {
ret = UI::UserInput();
if (ret == `next) {
string option_selected = (string) UI::QueryWidget (
`id ("to_do_a_network_setup_or_not_to_do"), `CurrentButton
);
y2milestone ("Network setup? %1", option_selected);
// run net setup
if (option_selected == "yes_do_run_setup") {
y2milestone ("Running inst_network_setup");
any ret = WFM::CallFunction ("inst_network_setup", []);
y2milestone ("inst_network_setup ret: %1", ret);
// everything went fine
if (ret == `next) {
return_this = `next;
break;
// something wrong or aborted
} else {
UI::ChangeWidget (`id ("to_do_a_network_setup_or_not_to_do"), `CurrentButton, "no_do_not_run_setup");
continue;
}
// skip net setup
} else {
y2milestone ("Skipping network setup");
return_this = `next;
break;
}
} else if (ret == `back) {
y2milestone ("Going back");
return_this = `back;
break;
} else if (ret == `abort) {
if (Popup::ConfirmAbort (`painless)) {
return_this = `abort;
break;
}
} else {
y2error ("Unknown ret: %1", ret);
}
}
return return_this;
/* EOF */
}
ACC SHELL 2018