]>
Commit | Line | Data |
---|---|---|
f928b1c5 | 1 | from installclass import BaseInstallClass |
f928b1c5 | 2 | from constants import * |
bf69ea3b | 3 | from filer import * |
d86ad723 | 4 | from flags import flags |
f928b1c5 ER |
5 | import os |
6 | import iutil | |
d86ad723 PZ |
7 | import types |
8 | import yuminstall | |
9 | try: | |
10 | import instnum | |
11 | except ImportError: | |
12 | instnum = None | |
13 | ||
bf69ea3b PZ |
14 | import gettext |
15 | _ = lambda x: gettext.ldgettext("anaconda", x) | |
16 | ||
d86ad723 PZ |
17 | import logging |
18 | log = logging.getLogger("anaconda") | |
f928b1c5 ER |
19 | |
20 | # custom installs are easy :-) | |
21 | class InstallClass(BaseInstallClass): | |
22 | # name has underscore used for mnemonics, strip if you dont need it | |
23 | id = "pld" | |
24 | name = N_("PLD Linux") | |
25 | pixmap = "custom.png" | |
bf69ea3b PZ |
26 | _description = N_("The default installation of %s includes a set of " |
27 | "software applicable for general internet usage. " | |
28 | "What additional tasks would you like your system " | |
29 | "to include support for?") | |
d86ad723 | 30 | _descriptionFields = (productName,) |
f928b1c5 | 31 | sortPriority = 10000 |
d86ad723 | 32 | allowExtraRepos = True |
f928b1c5 | 33 | |
a1af9494 | 34 | repopaths = { "base": ["PLD/i686/RPMS", "PLD/noarch/RPMS"], } |
bf69ea3b | 35 | taskMap = {'client': [ |
ccf949ed ER |
36 | (N_("GNOME Desktop"), [ |
37 | "gnome", | |
38 | "gnome_complete", | |
39 | "gnome_games", | |
40 | "gnome_themes", | |
41 | ]), | |
42 | (N_("KDE Desktop"), [ | |
43 | "kde_kdepim", | |
44 | "kde_kdeedu", | |
45 | "kde_multimedia", | |
46 | "kde_koffice", | |
47 | "kde_network", | |
48 | "kde_graphics", | |
49 | "kde_admin", | |
50 | "kde_games", | |
51 | "kde_look" | |
52 | ]), | |
53 | (N_("Basic IceWM"), [ | |
54 | "icewm", | |
55 | ]), | |
56 | (N_("WindowMaker"), [ | |
57 | "wmaker", | |
58 | ]), | |
59 | (N_("General Development Tools"), [ | |
60 | "devel" | |
61 | ]), | |
62 | (N_("Java Development Tools"), [ | |
63 | "java" | |
64 | ]), | |
bf69ea3b | 65 | ]} |
f928b1c5 | 66 | |
d86ad723 PZ |
67 | def setInstallData(self, anaconda): |
68 | BaseInstallClass.setInstallData(self, anaconda) | |
69 | if not anaconda.isKickstart: | |
70 | BaseInstallClass.setDefaultPartitioning(self, | |
71 | anaconda.id.partitions, | |
72 | CLEARPART_TYPE_LINUX) | |
73 | ||
74 | def setGroupSelection(self, anaconda): | |
75 | grps = anaconda.backend.getDefaultGroups(anaconda) | |
76 | map(lambda x: anaconda.backend.selectGroup(x), grps) | |
77 | ||
78 | def setSteps(self, anaconda): | |
79 | dispatch = anaconda.dispatch | |
80 | BaseInstallClass.setSteps(self, anaconda); | |
81 | dispatch.skipStep("partition") | |
a1af9494 | 82 | dispatch.skipStep("regkey") |
d86ad723 PZ |
83 | |
84 | # for rhel, we're putting the metadata under productpath | |
85 | def getPackagePaths(self, uri): | |
86 | rc = {} | |
87 | for (name, path) in self.repopaths.items(): | |
88 | if not type(uri) == types.ListType: | |
89 | uri = [uri,] | |
90 | if not type(path) == types.ListType: | |
91 | path = [path,] | |
92 | ||
93 | lst = [] | |
94 | for i in uri: | |
95 | for p in path: | |
96 | lst.append("%s/%s" % (i, p)) | |
97 | ||
98 | rc[name] = lst | |
99 | ||
100 | log.info("package paths is %s" %(rc,)) | |
101 | return rc | |
102 | ||
103 | def handleRegKey(self, key, intf, interactive = True): | |
104 | self.repopaths = { "base": "%s" %(productPath,) } | |
105 | self.tasks = self.taskMap[productPath.lower()] | |
106 | self.installkey = key | |
107 | ||
108 | try: | |
109 | inum = instnum.InstNum(key) | |
110 | except Exception, e: | |
111 | if True or not BETANAG: # disable hack keys for non-beta | |
112 | # make sure the log is consistent | |
113 | log.info("repopaths is %s" %(self.repopaths,)) | |
114 | raise | |
115 | else: | |
116 | inum = None | |
f928b1c5 | 117 | |
d86ad723 PZ |
118 | if inum is not None: |
119 | # make sure the base products match | |
120 | if inum.get_product_string().lower() != productPath.lower(): | |
121 | raise ValueError, "Installation number incompatible with media" | |
122 | ||
123 | for name, path in inum.get_repos_dict().items(): | |
124 | # virt is only supported on i386/x86_64. so, let's nuke it | |
125 | # from our repo list on other arches unless you boot with | |
126 | # 'linux debug' | |
127 | if name.lower() == "virt" and ( \ | |
128 | rhpl.getArch() not in ("x86_64","i386") | |
129 | and not flags.debug): | |
130 | continue | |
131 | self.repopaths[name.lower()] = path | |
132 | log.info("Adding %s repo" % (name,)) | |
133 | ||
134 | else: | |
135 | key = key.upper() | |
136 | # simple and stupid for now... if C is in the key, add Clustering | |
137 | # if V is in the key, add Virtualization. etc | |
138 | if key.find("C") != -1: | |
139 | self.repopaths["cluster"] = "Cluster" | |
140 | log.info("Adding Cluster option") | |
141 | if key.find("S") != -1: | |
142 | self.repopaths["clusterstorage"] = "ClusterStorage" | |
143 | log.info("Adding ClusterStorage option") | |
144 | if key.find("W") != -1: | |
145 | self.repopaths["workstation"] = "Workstation" | |
146 | log.info("Adding Workstation option") | |
147 | if key.find("V") != -1: | |
148 | self.repopaths["virt"] = "VT" | |
149 | log.info("Adding Virtualization option") | |
150 | ||
151 | for repo in self.repopaths.values(): | |
152 | if not self.taskMap.has_key(repo.lower()): | |
153 | continue | |
154 | ||
155 | for task in self.taskMap[repo.lower()]: | |
156 | if task not in self.tasks: | |
157 | self.tasks.append(task) | |
158 | self.tasks.sort() | |
159 | ||
160 | log.info("repopaths is %s" %(self.repopaths,)) | |
161 | ||
bf69ea3b | 162 | def getBackend(self): |
d86ad723 | 163 | return yuminstall.YumBackend |
f928b1c5 ER |
164 | |
165 | def __init__(self, expert): | |
d86ad723 PZ |
166 | BaseInstallClass.__init__(self, expert) |
167 | ||
168 | self.repopaths = { "base": "%s" %(productPath,) } | |
169 | ||
170 | # minimally set up tasks in case no key is provided | |
171 | self.tasks = self.taskMap[productPath.lower()] | |
172 |