/[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.7 - (hide annotations) (download) (as text)
Tue Aug 23 16:53:20 2005 UTC (19 years, 2 months ago) by slords
Branch: MAIN
Changes since 1.6: +1 -5 lines
Content type: text/x-python
Fix language selection for cdrom install

1 slords 1.1 from installclass import BaseInstallClass
2     from autopart import getAutopartitionBoot, autoCreatePartitionRequests, autoCreateLVMPartitionRequests
3     from fsset import *
4     from rhpl.translate import N_, _
5     from rhpl.log import log
6     from constants import *
7    
8     import os
9     import iutil
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     "setfilecon",
100     "complete"
101     )
102    
103 slords 1.2 # 'partition' can be used on the command line to force
104     # verification of partitions. useful in some cases...
105     cmdline = open("/proc/cmdline", "r").read()
106     cmdline = cmdline.split()
107     if "partition" in cmdline:
108     dispatch.skipStep("partition", skip = 0)
109     else:
110     dispatch.skipStep("partition", skip = 1)
111    
112 slords 1.1 def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1):
113     diskset = partedUtils.DiskSet()
114     drives = diskset.driveList()
115     if len(drives) > 0:
116     uniqueID = 100
117     raid1 = []
118     raid2 = []
119     (swapMin, swapMax) = iutil.swapSuggestion()
120    
121     for drive in drives:
122     filesystem = fileSystemTypeGet("software RAID")
123     request = partRequests.PartitionSpec(filesystem, drive=[drive], size=100, primary=1, format=1)
124     request.uniqueID = uniqueID
125     raid1.append(uniqueID)
126     partitions.autoPartitionRequests.append(request)
127    
128     filesystem = fileSystemTypeGet("software RAID")
129     request = partRequests.PartitionSpec(filesystem, drive=[drive], size=swapMin+1500,
130     grow=1, format=1);
131     request.uniqueID = uniqueID + 10
132     raid2.append(uniqueID + 10)
133     partitions.autoPartitionRequests.append(request)
134    
135     uniqueID = uniqueID + 1
136    
137     filesystem = fileSystemTypeGet("ext3")
138     request = partRequests.RaidRequestSpec(filesystem, mountpoint="/boot", raidminor=1,
139     raidmembers=raid1, raidlevel="RAID1", format=1, raidspares=0)
140     partitions.autoPartitionRequests.append(request)
141    
142     if len(drives) > 5:
143     raidLevel = "RAID6"
144     elif len(drives) > 2:
145     raidLevel = "RAID5"
146     else:
147     raidLevel = "RAID1"
148    
149     filesystem = fileSystemTypeGet("physical volume (LVM)")
150     request = partRequests.RaidRequestSpec(filesystem, raidmembers=raid2, raidminor=2,
151     raidlevel=raidLevel, format=1, raidspares=0)
152     request.uniqueID = 200
153     partitions.autoPartitionRequests.append(request)
154    
155     request = partRequests.VolumeGroupRequestSpec(vgname="vg_primary", physvols=[200],
156 slords 1.2 pesize=32768, format=1)
157 slords 1.1 request.uniqueID = 201
158     partitions.autoPartitionRequests.append(request)
159    
160     filesystem = fileSystemTypeGet("swap")
161     request = partRequests.LogicalVolumeRequestSpec(filesystem, format=1, grow=1,
162     size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="lv_swap")
163     partitions.autoPartitionRequests.append(request)
164    
165     filesystem = fileSystemTypeGet("ext3")
166     (size, maxSizeMB) = iutil.swapSuggestion()
167     request = partRequests.LogicalVolumeRequestSpec(filesystem, format=1, grow=1,
168     mountpoint="/", size=1300, volgroup=201, lvname="lv_root")
169     partitions.autoPartitionRequests.append(request)
170     else:
171     BaseInstallClass.setDefaultPartitioning(self, partitions, clear, doClear)
172    
173     def setGroupSelection(self, grpset, intf):
174     grpset.unselectAll()
175     grpset.selectGroup("Base")
176    
177     def postAction(self, rootPath, serial):
178 slords 1.3 script = ( "/sbin/syslogd &\n"
179     "sleep 2\n"
180     "/sbin/e-smith/signal-event post-install\n" )
181 slords 1.2 s = Script(script, interp="/bin/sh", inChroot=1)
182     log("%s", s)
183     s.run(rootPath, serial)
184 slords 1.1
185     def setInstallData(self, id, intf = None):
186     BaseInstallClass.setInstallData(self, id)
187     self.setAuthentication(id, useShadow=1, useMd5=1)
188     self.setRootPassword(id, pw="ThisIsGoingToBeDisabledAnyway", isCrypted=0)
189     self.setZeroMbr(id, zeroMbr=1)
190     self.setClearParts(id, clear=CLEARPART_TYPE_ALL, initAll=1)
191     self.setDefaultPartitioning(id.partitions, doClear=0)
192     self.setBootloader(id, useLilo=0, location="mbr", linear=1)
193    
194     def __init__(self, expert):
195     BaseInstallClass.__init__(self, expert)

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