/
inst_custom_packages.ycp
96 lines (86 loc) · 2.71 KB
/
inst_custom_packages.ycp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/**
* Module: inst_custom_packages.ycp
*
* Authors: Anas Nashif <nashif@suse.de>
*
* Purpose: Client for 3rd prodcuts/addon products package installations
*
* $Id$
*
*/
{
textdomain "packager";
import "ProductFeatures";
import "SourceManager";
import "Directory";
import "Popup";
import "SlideShow";
import "PackageSlideShow";
import "Kernel";
import "Installation";
import "GetInstArgs";
import "Mode";
import "PackagesUI";
list<string> packages = (list<string>)ProductFeatures::GetFeature("software", "packages");
boolean probeSource (string url)
{
symbol ret = SourceManager::createSource(url);
if (ret != `ok )
{
y2error ("no repositories available on media");
return false;
} else {
SourceManager::CommitSources();
return true;
}
}
if (!probeSource("dir://" + Directory::custom_workflow_dir))
{
// error popup
Popup::Error(_("Could not read package information."));
return `abort;
}
if (size(packages) > 0 )
{
y2milestone("installing packages: %1", packages );
foreach(string pkg, packages, ``{
if (!Pkg::PkgInstall(pkg) ) {
Pkg::DoProvide ([pkg]);
}
});
boolean solve = Pkg::PkgSolve(false);
if (!solve)
{
y2error("Error solving package dependencies");
}
}
symbol result = PackagesUI::RunPackageSelector($["mode" : `summaryMode]);
y2milestone ("Package selector returned: %1", result);
if (result == `accept)
result = `next;
if (result == `next) // packages selected ?
{
boolean anyToDelete = Pkg::IsAnyResolvable(`package, `to_remove);
SlideShow::SetLanguage (UI::GetLanguage(true));
PackageSlideShow::InitPkgData(false);
SlideShow::OpenDialog();
import "PackageInstallation";
integer oldvmlinuzsize = (integer) SCR::Read(.target.size, "/boot/vmlinuz");
list commit_result = PackageInstallation::CommitPackages (0, 0); // Y: commit them !
integer newvmlinuzsize = (integer) SCR::Read(.target.size, "/boot/vmlinuz");
SlideShow::CloseDialog();
if (Installation::destdir == "/"
&& ((commit_result[0]:0 > 0)
|| anyToDelete))
{
// prepare "you must boot" popup
Kernel::SetInformAboutKernelChange (oldvmlinuzsize != newvmlinuzsize);
Kernel::InformAboutKernelChange ();
}
}
if (size(SourceManager::newSources)== 1)
{
Pkg::SourceChangeUrl( SourceManager::newSources[0]:-1 , "cd:///" );
}
return `next;
}