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