home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
boot
/
i386
/
root
/
usr
/
share
/
YaST2
/
clients
/
desktop_finish.ycp
< prev
next >
Wrap
Text File
|
2006-11-29
|
6KB
|
220 lines
/**
* File:
* desktop_finish.ycp
*
* Module:
* Step of base installation finish
*
* Authors:
* Jiri Srain <jsrain@suse.cz>
*
* $Id: desktop_finish.ycp 31885 2006-07-17 08:14:59Z jsrain $
*
*/
{
textdomain "installation";
import "DefaultDesktop";
import "Directory";
import "Mode";
import "ProductFeatures";
any ret = nil;
string func = "";
map param = $[];
/* Check arguments */
if(size(WFM::Args()) > 0 && is(WFM::Args(0), string)) {
func = (string)WFM::Args(0);
if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
param = (map)WFM::Args(1);
}
y2milestone ("starting desktop_finish");
y2debug("func=%1", func);
y2debug("param=%1", param);
if (func == "Info")
{
return (any)$[
"steps" : 1,
// progress step title
"title" : _("Initializing default window manager..."),
"when" : [ `installation, `autoinst ],
];
}
else if (func == "Write")
{
boolean doc_server = false;
// check who provides suse_help_viewer
// if kdebase3-SuSE isn't installed by apache or apache2, set /etc/sysconfig/apache:DOC_SERVER
if ((!(Pkg::IsProvided ("kdebase3-SuSE") || Pkg::IsSelected ("kdebase3-SuSE")))
&&
(Pkg::IsProvided ("apache2") || Pkg::IsSelected ("apache2")
|| Pkg::IsProvided ("apache") || Pkg::IsSelected ("apache")))
{
doc_server = true;
}
// this detects WM and DM according to selected patterns and
// installed packages
if ( !Mode::update () )
{
map<string,map<string,string> > desktop_data = $[
"gnome" : $[
"package" : "gdm",
"wm" : "gnome",
"dm" : "gdm",
"cursor" : "Industrial",
],
"kde" : $[
"package" : "kdebase3-kdm",
"wm" : "kde",
"dm" : "kdm",
"cursor" : "crystalwhite",
],
"twm" : $[
"package" : "xorg-x11",
"wm" : "",
"dm" : "xdm",
"cursor" : "crystalwhite",
],
];
string default_wm = "gnome";
string default_dm = "gdm";
string default_cursor = "Industrial";
string selected_desktop = DefaultDesktop::Desktop ();
if (selected_desktop != "" && selected_desktop != nil)
{
y2milestone ("Desktop was set to %1", selected_desktop);
default_wm = desktop_data[selected_desktop, "wm"]:"";
default_dm = desktop_data[selected_desktop, "dm"]:"";
default_cursor = desktop_data[selected_desktop, "cursor"]:"";
}
else
{
list<map<string,any> > patterns
= Pkg::ResolvableDependencies ("", `pattern, "");
patterns = filter (map<string,any> p, patterns, {
return p["status"]:nil == `installed
|| p["status"]:nil == `selected;
});
list<list<string> > packages2 = [];
foreach (map<string,any> p, patterns, {
y2internal ("P: %1", p);
list<map<string,any> > deps = p["dependencies"]:[];
y2internal ("Deps: %1", deps);
deps = filter (map<string,any> d, deps, {
return d["res_kind"]:"" == "package"
&& contains (["recommends", "suggests", "requires"],
d["dep_kind"]:"");
});
packages2 = add (packages2, maplist (map<string,any> d, deps, {
return d["name"]:"";
}));
y2internal ("Packages2: %1", packages2);
});
list<string> packages = (list<string>)toset (flatten (packages2));
y2debug ("All packages in selected patterns: %1", packages);
list<string> desktop_order = ["gnome", "kde"];
boolean desktop_found = false;
string pattern_desktop = "gnome";
// check what packages are in the patterns
// and adjust logon and window manager according to it
find (string d, desktop_order, {
if (contains (packages, desktop_data[d, "package"]:""))
{
if (! desktop_found)
{
desktop_found = true;
pattern_desktop = d;
y2milestone ("Setting desktop according to pattern to %1", pattern_desktop);
}
}
return desktop_found;
});
// if no desktop was found according to pattern, try
// installed packages
// first the logon manager
desktop_order = add (desktop_order, "twm");
desktop_order = prepend (desktop_order, pattern_desktop);
desktop_found = false;
find (string d, desktop_order, {
string package = desktop_data[d, "package"]:"";
if (Pkg::IsProvided (package)
|| Pkg::IsSelected (package))
{
y2milestone ("package %1 selected or installed", package);
if (! desktop_found)
{
desktop_found = true;
default_dm = desktop_data[d, "dm"]:"";
y2milestone (
"Setting logon manager %1 - package selecteed",
default_dm);
default_wm = desktop_data[d, "wm"]:"";
y2milestone (
"Setting window manager %1 - package selecteed",
default_wm);
default_cursor
= desktop_data[d, "cursor"]:default_cursor;
y2milestone (
"Setting cursor theme %1 - package selected",
default_cursor);
}
}
else if (! desktop_found)
{
y2milestone ("Package %1 not selected or installed, trying next desktop...", package);
}
return desktop_found;
});
}
y2milestone ("Default desktop: %1", default_wm);
y2milestone ("Default logon manager: %1", default_dm);
y2milestone ("Default cursor theme: %1", default_cursor);
SCR::Write (.sysconfig.windowmanager.DEFAULT_WM, default_wm);
SCR::Write (.sysconfig.windowmanager.X_MOUSE_CURSOR, default_cursor);
SCR::Write (.sysconfig.windowmanager, nil);
string dm_shutdown = ProductFeatures::GetStringFeature ("globals",
"displaymanager_shutdown");
y2milestone ("Logon manager shutdown: %1", dm_shutdown);
if (dm_shutdown != nil && dm_shutdown != "")
{
SCR::Write (.sysconfig.displaymanager.DISPLAYMANAGER_SHUTDOWN,
dm_shutdown);
}
SCR::Write (.sysconfig.displaymanager.DISPLAYMANAGER, default_dm);
SCR::Write (.sysconfig.displaymanager, nil);
}
if (doc_server)
{
SCR::Write (.sysconfig.apache.DOC_SERVER, doc_server);
SCR::Write (.sysconfig.apache, nil);
}
}
else
{
y2error ("unknown function: %1", func);
ret = nil;
}
y2debug("ret=%1", ret);
y2milestone("desktop_finish finished");
return ret;
} /* EOF */