ACC SHELL
/**
* File: clients/lan_proposal.ycp
* Package: Network configuration
* Summary: Lan configuration proposal
* Authors: Michal Svec <msvec@suse.cz>
*
* $Id: lan_proposal.ycp 62071 2010-05-27 12:00:38Z mzugec $
*/
{
textdomain "network";
/* The main () */
y2milestone("----------------------------------------");
y2milestone("Lan proposal started");
y2milestone("Arguments: %1", WFM::Args());
import "Arch";
import "Lan";
import "Linuxrc";
import "Popup";
import "Progress";
import "LanItems";
import "GetInstArgs";
include "network/lan/wizards.ycp";
list args = WFM::Args();
string func = args[0]:"";
map param = args[1]:$[];
map ret = $[];
Lan::automatic_configuration = GetInstArgs::automatic_configuration();
/* create a textual proposal */
if(func == "MakeProposal") {
string proposal = "";
string warning = nil;
symbol warning_level = nil;
boolean force_reset = param["force_reset"]:false;
if(force_reset || !LanItems::proposal_valid) {
LanItems::proposal_valid = true;
if (! GetInstArgs::automatic_configuration())
/* Popup text */
BusyPopup(_("Detecting network cards..."));
boolean progress_orig = Progress::set (false);
// NM wants us to repropose but while at it Lan::Read should not
// think it does a full reread and unset Lan::modified. #147270
Lan::Read (force_reset? `nocache: `cache);
if (Lan::virt_net_proposal==nil){
if((PackageSystem::Installed("xen") && !Arch::is_xenU()) || PackageSystem::Installed("kvm")||
PackageSystem::Installed("qemu") || PackageSystem::Installed("virtualbox-ose"))
Lan::virt_net_proposal = true;
else Lan::virt_net_proposal = false;
}
Lan::Propose();
Progress::set (progress_orig);
if (! GetInstArgs::automatic_configuration())
BusyPopupClose();
}
list sum = Lan::Summary("proposal");
proposal = sum[0]:"";
ret = $[
"preformatted_proposal" : proposal,
"warning_level" : warning_level, // TODO `warning
"warning" : warning, // TODO WiFi but no encryption
"links" : sum[1]:[],
];
}
/* run the module */
else if(func == "AskUser") {
map stored = Lan::Export();
string chosen_id = param["chosen_id"]:"";
symbol seq = `next;
list<string> match = regexptokenize (chosen_id, "^lan--wifi-encryption-(.*)");
if (match != nil && match != [])
{
y2milestone ("%1", chosen_id);
string dev = match[0]:"";
// unescape colons
dev = mergestring (splitstring (dev, "/"), ":");
// Lan::Edit (dev);
if (hasAnyValue(dev)){
foreach(integer row, any value, LanItems::Items,{
LanItems::current = row;
if (LanItems::IsItemConfigured()){
if (issubstring(dev, LanItems::getCurrentItem()["ifcfg"]:"")) {
LanItems::SetItem();
break;
}
}
});
}
// #113196: must create new dialog for proposal clients
Wizard::CreateDialog ();
Wizard::SetDesktopIcon ("lan");
seq = AddressSequence ("wire");
Wizard::CloseDialog ();
}
else
{
seq = LanAutoSequence ("proposal");
}
if(seq != `next) {
LanItems::Items = $[];
Lan::Import(stored);
}
ret = $[
"workflow_sequence" : seq
];
}
/* create titles */
else if(func == "Description") {
ret = $[
/* RichText label */
"rich_text_title" : _("Network Interfaces"),
/* Menu label */
"menu_title" : _("&Network Interfaces"),
"id" : "lan",
];
}
/* write the proposal */
else if (func == "Write") {
if (PackagesInstall (Lan::Packages ()) != `next)
{
// popup already shown
y2error("Packages installation failure, not saving");
}
else if ((!Lan::virt_net_proposal) && (Linuxrc::display_ip () || Linuxrc::vnc () || Linuxrc::usessh ()) )
{
y2milestone ("write only");
Lan::WriteOnly();
}
else {
Lan::Write();
// With a little help from my friends:
// Let yast2-printer listen for CUPS broadcasts
SCR::Execute(.target.bash_background, "test -f /usr/lib/YaST2/bin/listen_remote_ipp && /usr/lib/YaST2/bin/listen_remote_ipp 120");
}
}
/* unknown function */
else {
y2error("unknown function: %1", func);
}
/* Finish */
y2debug("ret=%1", ret);
y2milestone("Lan proposal finished");
y2milestone("----------------------------------------");
return ret;
/* EOF */
}
ACC SHELL 2018