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
/
dirinstall.ycp
< prev
next >
Wrap
Text File
|
2006-11-29
|
3KB
|
109 lines
/**
* File: packager/inst_dir/instintodir.ycp
* Module: System installation
* Summary: Installation into a directory
* Authors: Anas Nashif <nashif@suse.de>
*
*/
{
textdomain "packager";
import "DirInstall";
import "PackageLock";
import "Product";
import "Report";
include "dirinstall/ui.ycp";
// check whether having the packager for ourselves
if (! PackageLock::Check ())
return `abort;
// install package callbacks
import "PackageCallbacksInit";
PackageCallbacksInit::InitPackageCallbacks();
// initializa the package manager
integer old_src = -1;
integer new_src = -1;
boolean using_patterns = false;
Pkg::TargetFinish ();
Pkg::SourceStartManager(true);
boolean have_patterns
= size (Pkg::ResolvableProperties ("", `pattern, "")) > 0;
boolean have_selections
= size (Pkg::GetSelections (`available, "base")) > 0;
have_patterns = have_patterns && ! have_selections;
if (have_patterns)
{
y2milestone ("Host system is using patterns");
Pkg::TargetInit ("/", false);
list<map<string,any> > prods = Pkg::ResolvableProperties ("", `product, "");
list<map<string,any> > base_l = filter (map<string,any> p, prods, {
return p["category"]:"" == "base";
});
map<string,any> base = base_l[0]:$[];
if (size (base_l) == 0)
{
y2warning ("No base product found, using first found product");
base = prods[0]:$[];
}
y2milestone ("Found base product: %1", base);
prods = Pkg::ResolvableProperties (base["name"]:"", `product, "");
y2milestone ("Found appropriate base products in sources: %1", prods);
if (size (prods) == 0)
{
// error report
Report::Error (_("Could not read package information."));
return `abort;
}
map<string,any> prod = prods[0]:$[];
integer source = prod["source"]:-1;
map src_data = Pkg::SourceGeneralData (source);
Pkg::SourceSetEnabled (source, false);
string url = src_data["url"]:"";
string dir = src_data["product_dir"]:"/";
if (substring (url, 0, 3) == "cd:" || substring (url, 0, 4) == "dvd:")
{
if (! Popup::ContinueCancel (sformat (_("Insert %1 CD 1"), base["summary"]:"")))
return `back;
}
new_src = Pkg::SourceCreateBase (url, dir);
old_src = source;
using_patterns = true;
string content_file = Pkg::SourceProvideFile (new_src, 1, "/content");
SCR::RegisterAgent (.media.content, `ag_ini(
`IniAgent( content_file,
$[
"options" : [ "read_only", "global_values", "flat" ],
"comments" : [ "^#.*", "^[ \t]*$", ],
"params" : [
$[ "match" : [ "^[ \t]*([a-zA-Z0-9_\.]+)[ \t]*(.*)[ \t]*$", "%s %s" ] ]
]
]
)));
any tmp1 = SCR::Read (.media.content.PATTERNS);
if (tmp1 != nil)
Product::patterns = splitstring ((string)tmp1, " ");
y2milestone ("***Patterns: %1", Product::patterns);
Pkg::TargetFinish ();
}
else
{
y2milestone ("Host system is using selections");
}
symbol ret = Run ();
y2milestone ("Sequence returned %1", ret);
DirInstall::UmountFilesystems ();
if (using_patterns)
{
Pkg::SourceDelete (new_src);
Pkg::SourceSetEnabled (old_src, true);
}
DirInstall::FinishPackageManager ();
return ret;
}