/[smeserver]/cdrom.image/product/installclasses/smeinstallclass.py
ViewVC logotype

Annotation of /cdrom.image/product/installclasses/smeinstallclass.py

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.14 - (hide annotations) (download) (as text)
Sat Apr 29 03:10:19 2006 UTC (18 years, 5 months ago) by slords
Branch: MAIN
Changes since 1.13: +13 -0 lines
Content type: text/x-python
Add keyboard back in for headless [SME: 1332]

1 slords 1.1 from installclass import BaseInstallClass
2 slords 1.13 from rhpl.translate import N_, _
3 slords 1.12 from constants import *
4     import os
5     import iutil
6 slords 1.13 from fsset import *
7 slords 1.12
8 slords 1.1 from autopart import getAutopartitionBoot, autoCreatePartitionRequests, autoCreateLVMPartitionRequests
9     from rhpl.log import log
10 slords 1.2 import string
11 slords 1.1 import partRequests
12     import partedUtils
13    
14 slords 1.2 class Script:
15     def __repr__(self):
16     str = ("(s: '%s' i: %s c: %d)") % \
17     (self.script, self.interp, self.inChroot)
18     return string.replace(str, "\n", "|")
19    
20     def __init__(self, script, interp, inChroot, logfile = None):
21     self.script = script
22     self.interp = interp
23     self.inChroot = inChroot
24     self.logfile = logfile
25    
26     def run(self, chroot, serial):
27     scriptRoot = "/"
28     if self.inChroot:
29     scriptRoot = chroot
30    
31     path = scriptRoot + "/tmp/sme-script"
32    
33     f = open(path, "w")
34     f.write(self.script)
35     f.close()
36     os.chmod(path, 0700)
37    
38     if self.logfile is not None:
39     messages = self.logfile
40     elif serial:
41     messages = "/tmp/sme-script.log"
42     else:
43     messages = "/dev/tty3"
44    
45     rc = iutil.execWithRedirect(self.interp,
46     [self.interp,"/tmp/sme-script"],
47     stdout = messages, stderr = messages,
48     root = scriptRoot)
49    
50     if rc != 0:
51     log("WARNING - Error code %s encountered running a sme script", rc)
52    
53     os.unlink(path)
54    
55 slords 1.1 class InstallClass(BaseInstallClass):
56 slords 1.2 id = "smeserver"
57     name = N_("New _SME Server Install")
58     pixmap = "smeserver.png"
59 slords 1.3 description = N_("This option performs a new install of "
60     "SME Server. All attached hard drives "
61     "will be repartitioned and formated.")
62 slords 1.1 sortPriority = 1
63    
64 slords 1.2 parentClass = ( _("Install SME Server"), "smeserver.png" )
65 slords 1.1
66     def requiredDisplayMode(self):
67     return 't'
68    
69     def setSteps(self, dispatch):
70     dispatch.setStepList(
71     "language",
72     "keyboard",
73     "findrootparts",
74 slords 1.4 "findinstall",
75     "installtype",
76 slords 1.1 "partitionobjinit",
77     "autopartitionexecute",
78 slords 1.2 "partition",
79 slords 1.1 "partitiondone",
80     "bootloadersetup",
81 slords 1.7 "languagesupport",
82 slords 1.1 "timezone",
83     "readcomps",
84     "selectlangpackages",
85     "checkdeps",
86     "dependencies",
87     "install",
88     "enablefilesystems",
89     "migratefilesystems",
90     "setuptime",
91     "preinstallconfig",
92     "installpackages",
93     "postinstallconfig",
94     "writeconfig",
95     "instbootloader",
96     "dopostaction",
97     "methodcomplete",
98     "copylogs",
99 slords 1.11 "writeksconfig",
100 slords 1.1 "setfilecon",
101     "complete"
102     )
103    
104 slords 1.2 # 'partition' can be used on the command line to force
105     # verification of partitions. useful in some cases...
106     cmdline = open("/proc/cmdline", "r").read()
107     cmdline = cmdline.split()
108     if "partition" in cmdline:
109     dispatch.skipStep("partition", skip = 0)
110     else:
111     dispatch.skipStep("partition", skip = 1)
112    
113 slords 1.1 def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1):
114     diskset = partedUtils.DiskSet()
115     drives = diskset.driveList()
116     if len(drives) > 0:
117     uniqueID = 100
118     raid1 = []
119     raid2 = []
120     (swapMin, swapMax) = iutil.swapSuggestion()
121    
122     for drive in drives:
123     filesystem = fileSystemTypeGet("software RAID")
124     request = partRequests.PartitionSpec(filesystem, drive=[drive], size=100, primary=1, format=1)
125     request.uniqueID = uniqueID
126     raid1.append(uniqueID)
127     partitions.autoPartitionRequests.append(request)
128    
129     filesystem = fileSystemTypeGet("software RAID")
130     request = partRequests.PartitionSpec(filesystem, drive=[drive], size=swapMin+1500,
131     grow=1, format=1);
132     request.uniqueID = uniqueID + 10
133     raid2.append(uniqueID + 10)
134     partitions.autoPartitionRequests.append(request)
135    
136     uniqueID = uniqueID + 1
137    
138     filesystem = fileSystemTypeGet("ext3")
139     request = partRequests.RaidRequestSpec(filesystem, mountpoint="/boot", raidminor=1,
140     raidmembers=raid1, raidlevel="RAID1", format=1, raidspares=0)
141     partitions.autoPartitionRequests.append(request)
142    
143     if len(drives) > 5:
144     raidLevel = "RAID6"
145     elif len(drives) > 2:
146     raidLevel = "RAID5"
147     else:
148     raidLevel = "RAID1"
149    
150     filesystem = fileSystemTypeGet("physical volume (LVM)")
151     request = partRequests.RaidRequestSpec(filesystem, raidmembers=raid2, raidminor=2,
152     raidlevel=raidLevel, format=1, raidspares=0)
153     request.uniqueID = 200
154     partitions.autoPartitionRequests.append(request)
155    
156 slords 1.11 request = partRequests.VolumeGroupRequestSpec(vgname="main", physvols=[200],
157 slords 1.2 pesize=32768, format=1)
158 slords 1.1 request.uniqueID = 201
159     partitions.autoPartitionRequests.append(request)
160    
161     filesystem = fileSystemTypeGet("swap")
162     request = partRequests.LogicalVolumeRequestSpec(filesystem, format=1, grow=1,
163 slords 1.11 size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap")
164 slords 1.1 partitions.autoPartitionRequests.append(request)
165    
166     filesystem = fileSystemTypeGet("ext3")
167     (size, maxSizeMB) = iutil.swapSuggestion()
168     request = partRequests.LogicalVolumeRequestSpec(filesystem, format=1, grow=1,
169 slords 1.11 mountpoint="/", size=1300, volgroup=201, lvname="root")
170 slords 1.1 partitions.autoPartitionRequests.append(request)
171     else:
172 slords 1.14 dispatch.skipStep("partition", skip = 0)
173 slords 1.1 BaseInstallClass.setDefaultPartitioning(self, partitions, clear, doClear)
174    
175 slords 1.14 def setAsHeadless(self, dispatch, isHeadless = 0):
176     if isHeadless == 0:
177     pass
178     else:
179     # dispatch.skipStep("keyboard", permanent = 1)
180     # dispatch.skipStep("mouse", permanent = 1)
181     dispatch.skipStep("handleX11pkgs", permanent = 1)
182     dispatch.skipStep("videocard", permanent = 1)
183     dispatch.skipStep("monitor", permanent = 1)
184     dispatch.skipStep("xcustom", permanent = 1)
185     dispatch.skipStep("writexconfig", permanent = 1)
186    
187 slords 1.1 def setGroupSelection(self, grpset, intf):
188     grpset.unselectAll()
189     grpset.selectGroup("Base")
190    
191 gordonr 1.10 def postAction(self, rootPath, serial, intf):
192     win = intf.waitWindow(_("Post Install Script"),
193     _("The post installation script is running..."))
194    
195 slords 1.3 script = ( "/sbin/syslogd &\n"
196     "sleep 2\n"
197     "/sbin/e-smith/signal-event post-install\n" )
198 slords 1.2 s = Script(script, interp="/bin/sh", inChroot=1)
199     log("%s", s)
200     s.run(rootPath, serial)
201 gordonr 1.10 win.pop()
202 slords 1.1
203     def setInstallData(self, id, intf = None):
204     BaseInstallClass.setInstallData(self, id)
205     self.setAuthentication(id, useShadow=1, useMd5=1)
206     self.setRootPassword(id, pw="ThisIsGoingToBeDisabledAnyway", isCrypted=0)
207     self.setZeroMbr(id, zeroMbr=1)
208     self.setClearParts(id, clear=CLEARPART_TYPE_ALL, initAll=1)
209     self.setDefaultPartitioning(id.partitions, doClear=0)
210     self.setBootloader(id, useLilo=0, location="mbr", linear=1)
211    
212     def __init__(self, expert):
213 slords 1.12 BaseInstallClass.__init__(self, expert)

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed