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