61 |
"will be repartitioned and formated.") |
"will be repartitioned and formated.") |
62 |
|
|
63 |
sortPriority = 1 |
sortPriority = 1 |
|
doPartition = False |
|
|
cmdline = {} |
|
64 |
|
|
65 |
parentClass = ( _("Install SME Server"), "smeserver.png" ) |
parentClass = ( _("Install SME Server"), "smeserver.png" ) |
66 |
|
|
82 |
|
|
83 |
return cmdlineDict |
return cmdlineDict |
84 |
|
|
|
def mediaPresent(self, device): |
|
|
try: |
|
|
fd = os.open("/dev/%s" % device, os.O_RDONLY) |
|
|
except OSError, (errno, strerror): |
|
|
# error 123 = No medium found |
|
|
if errno == 123: |
|
|
return False |
|
|
else: |
|
|
return True |
|
|
else: |
|
|
os.close(fd) |
|
|
return True |
|
|
|
|
85 |
def setSteps(self, dispatch): |
def setSteps(self, dispatch): |
86 |
|
self.anaconda = dispatch |
87 |
|
self.cmdline = self.createCmdlineDict() |
88 |
|
|
89 |
dispatch.setStepList( |
dispatch.setStepList( |
90 |
|
"betanag", |
91 |
"language", |
"language", |
92 |
"keyboard", |
"keyboard", |
93 |
"findrootparts", |
"findrootparts", |
|
"betanag", |
|
94 |
"installtype", |
"installtype", |
95 |
"partitionobjinit", |
"partitionobjinit", |
96 |
"autopartitionexecute", |
"autopartitionexecute", |
|
"partition", |
|
97 |
"partitiondone", |
"partitiondone", |
98 |
"bootloadersetup", |
"bootloadersetup", |
99 |
"languagesupport", |
"languagesupport", |
111 |
"postinstallconfig", |
"postinstallconfig", |
112 |
"writeconfig", |
"writeconfig", |
113 |
"instbootloader", |
"instbootloader", |
|
"dopostaction", |
|
114 |
"writeksconfig", |
"writeksconfig", |
|
"methodcomplete", |
|
|
"copylogs", |
|
115 |
"setfilecon", |
"setfilecon", |
116 |
|
"copylogs", |
117 |
|
"dopostaction", |
118 |
|
"methodcomplete", |
119 |
"complete" |
"complete" |
120 |
) |
) |
121 |
|
|
122 |
# 'partition' can be used on the command line to force |
# 'partition' can be used on the command line to force |
123 |
# verification of partitions. useful in some cases... |
# verification of partitions. useful in some cases... |
124 |
if self.doPartition or self.cmdline.has_key("partition"): |
dispatch.skipStep("partition", skip = (1,0)[self.cmdline.has_key("partition")]) |
|
dispatch.skipStep("partition", skip = 0) |
|
|
else: |
|
|
dispatch.skipStep("partition", skip = 1) |
|
125 |
|
|
126 |
def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1): |
def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1): |
127 |
self.cmdline = self.createCmdlineDict() |
diskset = self.anaconda.id.diskset |
|
diskset = partedUtils.DiskSet() |
|
128 |
|
|
129 |
if self.cmdline.has_key("exclude"): |
if self.cmdline.has_key("exclude"): |
130 |
alldrives = filter(lambda x:not x in self.cmdline["exclude"].split(","), diskset.driveList()) |
alldrives = filter(lambda x:not (partedUtils.hasProtectedPartitions(x, self.anaconda) or |
131 |
|
x in self.cmdline["exclude"].split(",")), diskset.driveList()) |
132 |
else: |
else: |
133 |
alldrives = diskset.driveList() |
alldrives = filter(lambda x:not partedUtils.hasProtectedPartitions(x, self.anaconda), diskset.disks.keys()) |
134 |
|
|
135 |
if self.cmdline.has_key("drives"): |
if self.cmdline.has_key("drives"): |
136 |
if self.cmdline["drives"] == "all": |
if self.cmdline["drives"] == "all": |
137 |
drives = filter(lambda x:self.mediaPresent(x), alldrives) |
drives = alldrives |
138 |
else: |
else: |
139 |
drives = filter(lambda x:self.mediaPresent(x) and |
drives = filter(lambda x:x in self.cmdline["drives"].split(","), alldrives) |
|
x in self.cmdline["drives"].split(","), alldrives) |
|
140 |
else: |
else: |
141 |
drives = filter(lambda x:not isys.driveIsRemovable(x) and |
drives = filter(lambda x:not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives) |
|
self.mediaPresent(x) and |
|
|
not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives) |
|
142 |
|
|
143 |
if self.cmdline.has_key("spares"): |
if self.cmdline.has_key("spares"): |
144 |
if self.cmdline["spares"] == "none": |
if self.cmdline["spares"] == "none": |
167 |
if spares > 1 and not self.cmdline.has_key("spares"): |
if spares > 1 and not self.cmdline.has_key("spares"): |
168 |
spares = 1 |
spares = 1 |
169 |
del drives[2+spares:] |
del drives[2+spares:] |
170 |
|
elif len(drives) > 1 and len(drives) == len(filter(lambda x:x.startswith('mapper/'), alldrives)): |
171 |
|
level = -1 |
172 |
|
del drives[1:] |
173 |
|
spares = 0 |
174 |
else: |
else: |
175 |
if len(drives) - spares >= 6: |
if len(drives) - spares >= 6: |
176 |
level = 6 |
level = 6 |
180 |
level = 1 |
level = 1 |
181 |
|
|
182 |
if len(drives) >= 1: |
if len(drives) >= 1: |
|
excluded = filter(lambda x:x not in drives, diskset.driveList()) |
|
183 |
log("Using the following drives: %s" % drives) |
log("Using the following drives: %s" % drives) |
184 |
log("Excluding the following drives: %s" % excluded) |
excluded = filter(lambda x:x not in drives, diskset.disks.keys()) |
185 |
|
if excluded: |
186 |
|
log("Excluding the following drives: %s" % excluded) |
187 |
|
skipped = filter(lambda x:x not in diskset.disks.keys(), diskset.driveList()) |
188 |
|
if skipped: |
189 |
|
log("Skipping the following drives: %s" % skipped) |
190 |
if level >= 1: |
if level >= 1: |
191 |
log("Installing using RAID%s" % level) |
log("Installing using RAID%s" % level) |
192 |
log("Using %s spare drives" % spares) |
log("Using %s spare drives" % spares) |
193 |
|
elif level < 0: |
194 |
|
log("Detected BIOS raid (skipping raid)") |
195 |
else: |
else: |
196 |
log("Installing without using RAID") |
log("Installing without using RAID") |
197 |
|
|
210 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
211 |
|
|
212 |
if not self.cmdline.has_key("nolvm"): |
if not self.cmdline.has_key("nolvm"): |
213 |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
if not self.cmdline.has_key("multipart"): |
214 |
size=(swapMin+4096)/(len(drives)-spares-max(0,level-4)), |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
215 |
drive=[drive], primary=1, grow=1, format=1) |
size=(swapMin+1536)/(len(drives)-spares-max(0,level-4)), |
216 |
|
drive=[drive], primary=1, grow=1, format=1) |
217 |
|
else: |
218 |
|
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
219 |
|
size=(swapMin+5120)/(len(drives)-spares-max(0,level-4)), |
220 |
|
drive=[drive], primary=1, grow=1, format=1) |
221 |
request.uniqueID = uniqueID + 50 |
request.uniqueID = uniqueID + 50 |
222 |
raid2.append(uniqueID + 50) |
raid2.append(uniqueID + 50) |
223 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
230 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
231 |
|
|
232 |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
233 |
size=1500/(len(drives)-spares-max(0,level-4)), |
size=1536/(len(drives)-spares-max(0,level-4)), |
234 |
drive=[drive], grow=1, primary=1, format=1) |
drive=[drive], grow=1, primary=1, format=1) |
235 |
request.uniqueID = uniqueID + 60 |
request.uniqueID = uniqueID + 60 |
236 |
raid3.append(uniqueID + 60) |
raid3.append(uniqueID + 60) |
262 |
mountpoint="/boot", drive=[drive], size=100, primary=1, format=1)) |
mountpoint="/boot", drive=[drive], size=100, primary=1, format=1)) |
263 |
|
|
264 |
if not self.cmdline.has_key("nolvm"): |
if not self.cmdline.has_key("nolvm"): |
265 |
request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"), |
if not self.cmdline.has_key("multipart"): |
266 |
drive=[drive], size=swapMin+4096, grow=1, primary=1, format=1) |
request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"), |
267 |
|
drive=[drive], size=swapMin+1536, grow=1, primary=1, format=1) |
268 |
|
else: |
269 |
|
request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"), |
270 |
|
drive=[drive], size=swapMin+5120, grow=1, primary=1, format=1) |
271 |
request.uniqueID = 200 |
request.uniqueID = 200 |
272 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
273 |
else: |
else: |
274 |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"), |
275 |
mountpoint="/", drive=[drive], size=4096, grow=1, primary=1, format=1)) |
mountpoint="/", drive=[drive], size=1536, grow=1, primary=1, format=1)) |
276 |
|
|
277 |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("swap"), |
278 |
drive=[drive], size=swapMin, maxSizeMB=swapMax, grow=1, primary=1, format=1)) |
drive=[drive], size=swapMin, maxSizeMB=swapMax, grow=1, primary=1, format=1)) |
284 |
|
|
285 |
if not self.cmdline.has_key("multipart"): |
if not self.cmdline.has_key("multipart"): |
286 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
287 |
mountpoint="/", size=1300, volgroup=201, lvname="root", grow=1, format=1)) |
mountpoint="/", size=1536, volgroup=201, lvname="root", grow=1, format=1)) |
288 |
|
|
289 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
290 |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
299 |
mountpoint="/home/e-smith/files", size=1024, maxSizeMB=8192, volgroup=201, lvname="files", grow=1, format=1)) |
mountpoint="/home/e-smith/files", size=1024, maxSizeMB=8192, volgroup=201, lvname="files", grow=1, format=1)) |
300 |
|
|
301 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
302 |
mountpoint="/tmp", size=512, maxSizeMB=4096, volgroup=201, lvname="tmp", grow=1, format=1)) |
mountpoint="/tmp", size=1024, maxSizeMB=4096, volgroup=201, lvname="tmp", grow=1, format=1)) |
303 |
|
|
304 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
305 |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
306 |
|
|
307 |
partitions.autoClearPartType = CLEARPART_TYPE_ALL |
partitions.autoClearPartType = CLEARPART_TYPE_ALL |
308 |
partitions.autoClearPartDrives = drives |
partitions.autoClearPartDrives = drives |
|
self.doPartition = False |
|
309 |
else: |
else: |
310 |
log("Not useable drives found. Enabling manual partitioning.") |
log("Not useable drives found. Enabling manual partitioning.") |
311 |
self.doPartition = True |
BaseInstallClass.setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_ALL, doClear = True) |
312 |
BaseInstallClass.setDefaultPartitioning(self, partitions, clear, doClear) |
self.anaconda.skipStep("partition", skip = 0) |
313 |
|
|
314 |
def setAsHeadless(self, dispatch, isHeadless = 0): |
def setAsHeadless(self, dispatch, isHeadless = 0): |
315 |
if isHeadless == 0: |
if isHeadless == 0: |
343 |
self.setRootPassword(id, pw="ThisIsGoingToBeDisabledAnyway", isCrypted=0) |
self.setRootPassword(id, pw="ThisIsGoingToBeDisabledAnyway", isCrypted=0) |
344 |
self.setZeroMbr(id, zeroMbr=1) |
self.setZeroMbr(id, zeroMbr=1) |
345 |
self.setClearParts(id, clear=CLEARPART_TYPE_ALL, initAll=1) |
self.setClearParts(id, clear=CLEARPART_TYPE_ALL, initAll=1) |
|
self.setDefaultPartitioning(id.partitions, doClear=0) |
|
346 |
self.setBootloader(id, useLilo=0, location="mbr", linear=1) |
self.setBootloader(id, useLilo=0, location="mbr", linear=1) |
347 |
|
|
348 |
def __init__(self, expert): |
def __init__(self, expert): |