69 |
"will be repartitioned and formated.") |
"will be repartitioned and formated.") |
70 |
|
|
71 |
sortPriority = 1 |
sortPriority = 1 |
|
doPartition = False |
|
72 |
|
|
73 |
parentClass = ( _("Install SME Server"), "smeserver.png" ) |
parentClass = ( _("Install SME Server"), "smeserver.png" ) |
74 |
|
|
75 |
def requiredDisplayMode(self): |
def requiredDisplayMode(self): |
76 |
return 't' |
return 't' |
77 |
|
|
|
def driveIsRemovable(self, device): |
|
|
try: |
|
|
removable = bool(int(open("/sys/block/%s/removable" % device).read())) |
|
|
except: |
|
|
removable = False |
|
|
|
|
|
return removable |
|
|
|
|
78 |
def setSteps(self, dispatch): |
def setSteps(self, dispatch): |
79 |
dispatch.setStepList( |
dispatch.setStepList( |
80 |
|
"betanag", |
81 |
"language", |
"language", |
82 |
"keyboard", |
"keyboard", |
83 |
"findrootparts", |
"findrootparts", |
|
"betanag", |
|
|
"installtype", |
|
84 |
"partitionobjinit", |
"partitionobjinit", |
85 |
"autopartitionexecute", |
"autopartitionexecute", |
|
"parttype", |
|
|
"partition", |
|
86 |
"partitiondone", |
"partitiondone", |
87 |
"bootloadersetup", |
"bootloadersetup", |
88 |
"timezone", |
"timezone", |
99 |
"postinstallconfig", |
"postinstallconfig", |
100 |
"writeconfig", |
"writeconfig", |
101 |
"instbootloader", |
"instbootloader", |
|
"dopostaction", |
|
102 |
"writeksconfig", |
"writeksconfig", |
|
"methodcomplete", |
|
|
"copylogs", |
|
103 |
"setfilecon", |
"setfilecon", |
104 |
|
"copylogs", |
105 |
|
"methodcomplete", |
106 |
|
"dopostaction", |
107 |
"complete" |
"complete" |
108 |
) |
) |
109 |
|
|
110 |
|
dispatch.skipStep("bootloader", permanent = 1) |
111 |
# 'partition' can be used on the command line to force |
# 'partition' can be used on the command line to force |
112 |
# verification of partitions. useful in some cases... |
# verification of partitions. useful in some cases... |
113 |
if self.doPartition or flags.cmdline.has_key("partition"): |
dispatch.skipStep("partition", skip = (1,0)[flags.cmdline.has_key("partition")]) |
|
if not self.doPartition: |
|
|
dispatch.skipStep("parttype", skip = 1) |
|
|
dispatch.skipStep("partition", skip = 0) |
|
|
else: |
|
|
dispatch.skipStep("parttype", skip = 1) |
|
|
dispatch.skipStep("partition", skip = 1) |
|
114 |
|
|
115 |
def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1): |
def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1): |
116 |
diskset = partedUtils.DiskSet() |
diskset = self.anaconda.id.diskset |
117 |
|
|
118 |
if flags.cmdline.has_key("exclude"): |
if flags.cmdline.has_key("exclude"): |
119 |
alldrives = filter(lambda x:not x in flags.cmdline["exclude"].split(","), diskset.driveList()) |
alldrives = filter(lambda x:not (partedUtils.hasProtectedPartitions(x, self.anaconda) or |
120 |
|
x in flags.cmdline["exclude"].split(",")), diskset.disks.keys()) |
121 |
else: |
else: |
122 |
alldrives = diskset.driveList() |
alldrives = filter(lambda x:not partedUtils.hasProtectedPartitions(x, self.anaconda), diskset.disks.keys()) |
123 |
|
|
124 |
if flags.cmdline.has_key("drives"): |
if flags.cmdline.has_key("drives"): |
125 |
if flags.cmdline["drives"] == "all": |
if flags.cmdline["drives"] == "all": |
126 |
drives = filter(lambda x:isys.mediaPresent(x), alldrives) |
drives = alldrives |
127 |
else: |
else: |
128 |
drives = filter(lambda x:isys.mediaPresent(x) and |
drives = filter(lambda x:x in flags.cmdline["drives"].split(","), alldrives) |
|
x in flags.cmdline["drives"].split(","), alldrives) |
|
129 |
else: |
else: |
130 |
drives = filter(lambda x:not self.driveIsRemovable(x) and |
drives = filter(lambda x:not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives) |
|
isys.mediaPresent(x) and |
|
|
not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives) |
|
131 |
|
|
132 |
if flags.cmdline.has_key("spares"): |
if flags.cmdline.has_key("spares"): |
133 |
if flags.cmdline["spares"] == "none": |
if flags.cmdline["spares"] == "none": |
156 |
if spares > 1 and not flags.cmdline.has_key("spares"): |
if spares > 1 and not flags.cmdline.has_key("spares"): |
157 |
spares = 1 |
spares = 1 |
158 |
del drives[2+spares:] |
del drives[2+spares:] |
159 |
|
elif len(drives) > 1 and len(drives) == len(filter(lambda x:x.startswith('mapper/'), alldrives)): |
160 |
|
level = -1 |
161 |
|
del drives[1:] |
162 |
|
spares = 0 |
163 |
else: |
else: |
164 |
if len(drives) - spares >= 6: |
if len(drives) - spares >= 6: |
165 |
level = 6 |
level = 6 |
169 |
level = 1 |
level = 1 |
170 |
|
|
171 |
if len(drives) >= 1: |
if len(drives) >= 1: |
|
excluded = filter(lambda x:x not in drives, diskset.driveList()) |
|
172 |
log.info("Using the following drives: %s" % drives) |
log.info("Using the following drives: %s" % drives) |
173 |
log.info("Excluding the following drives: %s" % excluded) |
excluded = filter(lambda x:x not in drives, diskset.disks.keys()) |
174 |
|
if excluded: |
175 |
|
log.info("Excluding the following drives: %s" % excluded) |
176 |
|
skipped = filter(lambda x:x not in diskset.disks.keys(), diskset.driveList()) |
177 |
|
if skipped: |
178 |
|
log.info("Skipping the following drives: %s" % skipped) |
179 |
if level >= 1: |
if level >= 1: |
180 |
log.info("Installing using RAID%s" % level) |
log.info("Installing using RAID%s" % level) |
181 |
log.info("Using %s spare drives" % spares) |
log.info("Using %s spare drives" % spares) |
182 |
|
elif level < 0: |
183 |
|
log.warning("Detected BIOS raid (skipping raid)") |
184 |
else: |
else: |
185 |
log.warning("Installing without using RAID") |
log.warning("Installing without using RAID") |
186 |
|
|
187 |
|
fstype = "ext3" |
188 |
|
if flags.cmdline.has_key("ext4"): |
189 |
|
fstype = "ext4" |
190 |
|
|
191 |
(swapMin, swapMax) = iutil.swapSuggestion() |
(swapMin, swapMax) = iutil.swapSuggestion() |
192 |
if level >= 1: |
if level >= 1: |
193 |
raid1 = [] |
raid1 = [] |
203 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
204 |
|
|
205 |
if not flags.cmdline.has_key("nolvm"): |
if not flags.cmdline.has_key("nolvm"): |
206 |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
if not flags.cmdline.has_key("multipart"): |
207 |
size=(swapMin+4096)/(len(drives)-spares-max(0,level-4)), |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
208 |
drive=[drive], primary=1, grow=1, format=1) |
size=(swapMin+1536)/(len(drives)-spares-max(0,level-4)), |
209 |
|
drive=[drive], primary=1, grow=1, format=1) |
210 |
|
else: |
211 |
|
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
212 |
|
size=(swapMin+5120)/(len(drives)-spares-max(0,level-4)), |
213 |
|
drive=[drive], primary=1, grow=1, format=1) |
214 |
request.uniqueID = uniqueID + 50 |
request.uniqueID = uniqueID + 50 |
215 |
raid2.append(uniqueID + 50) |
raid2.append(uniqueID + 50) |
216 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
223 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
224 |
|
|
225 |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
226 |
size=1500/(len(drives)-spares-max(0,level-4)), |
size=1536/(len(drives)-spares-max(0,level-4)), |
227 |
drive=[drive], grow=1, primary=1, format=1) |
drive=[drive], grow=1, primary=1, format=1) |
228 |
request.uniqueID = uniqueID + 60 |
request.uniqueID = uniqueID + 60 |
229 |
raid3.append(uniqueID + 60) |
raid3.append(uniqueID + 60) |
245 |
partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("swap"), |
246 |
raidmembers=raid2, raidlevel="RAID"+str(level), raidminor=2, format=1, raidspares=spares)) |
raidmembers=raid2, raidlevel="RAID"+str(level), raidminor=2, format=1, raidspares=spares)) |
247 |
|
|
248 |
partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet(fstype), |
249 |
mountpoint="/", raidmembers=raid3, raidlevel="RAID"+str(level), raidminor=3, format=1, |
mountpoint="/", raidmembers=raid3, raidlevel="RAID"+str(level), raidminor=3, format=1, |
250 |
raidspares=spares)) |
raidspares=spares)) |
251 |
|
|
255 |
mountpoint="/boot", drive=[drive], size=100, primary=1, format=1)) |
mountpoint="/boot", drive=[drive], size=100, primary=1, format=1)) |
256 |
|
|
257 |
if not flags.cmdline.has_key("nolvm"): |
if not flags.cmdline.has_key("nolvm"): |
258 |
request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"), |
if not flags.cmdline.has_key("multipart"): |
259 |
drive=[drive], size=swapMin+4096, grow=1, primary=1, format=1) |
request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"), |
260 |
|
drive=[drive], size=swapMin+1536, grow=1, primary=1, format=1) |
261 |
|
else: |
262 |
|
request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"), |
263 |
|
drive=[drive], size=swapMin+5120, grow=1, primary=1, format=1) |
264 |
request.uniqueID = 200 |
request.uniqueID = 200 |
265 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
266 |
else: |
else: |
267 |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet(fstype), |
268 |
mountpoint="/", drive=[drive], size=4096, grow=1, primary=1, format=1)) |
mountpoint="/", drive=[drive], size=1536, grow=1, primary=1, format=1)) |
269 |
|
|
270 |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("swap"), |
271 |
drive=[drive], size=swapMin, maxSizeMB=swapMax, grow=1, primary=1, format=1)) |
drive=[drive], size=swapMin, maxSizeMB=swapMax, grow=1, primary=1, format=1)) |
276 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
277 |
|
|
278 |
if not flags.cmdline.has_key("multipart"): |
if not flags.cmdline.has_key("multipart"): |
279 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet(fstype), |
280 |
mountpoint="/", size=1300, volgroup=201, lvname="root", grow=1, format=1)) |
mountpoint="/", size=1536, volgroup=201, lvname="root", grow=1, format=1)) |
281 |
|
|
282 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
283 |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
284 |
else: |
else: |
285 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet(fstype), |
286 |
mountpoint="/", size=2048, maxSizeMB=4096, volgroup=201, lvname="root", grow=1, format=1)) |
mountpoint="/", size=2048, maxSizeMB=4096, volgroup=201, lvname="root", grow=1, format=1)) |
287 |
|
|
288 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet(fstype), |
289 |
mountpoint="/var", size=1024, maxSizeMB=4096, volgroup=201, lvname="var", grow=1, format=1)) |
mountpoint="/var", size=1024, maxSizeMB=4096, volgroup=201, lvname="var", grow=1, format=1)) |
290 |
|
|
291 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet(fstype), |
292 |
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)) |
293 |
|
|
294 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet(fstype), |
295 |
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)) |
296 |
|
|
297 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
298 |
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 |
|
|
300 |
partitions.autoClearPartType = CLEARPART_TYPE_ALL |
partitions.autoClearPartType = CLEARPART_TYPE_ALL |
301 |
partitions.autoClearPartDrives = drives |
partitions.autoClearPartDrives = drives |
|
self.doPartition = False |
|
302 |
else: |
else: |
303 |
log.warning("Not useable drives found. Enabling manual partitioning.") |
log.warning("Not useable drives found. Enabling manual partitioning.") |
304 |
self.doPartition = True |
BaseInstallClass.setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_ALL, doClear = True) |
305 |
BaseInstallClass.setDefaultPartitioning(self, partitions, clear, doClear) |
self.anaconda.dispatch.skipStep("parttype", skip = 0) |
306 |
|
self.anaconda.dispatch.skipStep("partition", skip = 0) |
307 |
|
|
308 |
def setAsHeadless(self, dispatch, isHeadless = 0): |
def setAsHeadless(self, dispatch, isHeadless = 0): |
309 |
if isHeadless == 0: |
if isHeadless == 0: |
327 |
|
|
328 |
def setInstallData(self, anaconda): |
def setInstallData(self, anaconda): |
329 |
BaseInstallClass.setInstallData(self, anaconda) |
BaseInstallClass.setInstallData(self, anaconda) |
330 |
self.setDefaultPartitioning(anaconda.id.partitions, CLEARPART_TYPE_ALL) |
self.anaconda = anaconda |
331 |
self.setSELinux(anaconda.id, SELINUX_DISABLED) |
self.setSELinux(anaconda.id, SELINUX_DISABLED) |
332 |
|
|
333 |
def setGroupSelection(self, anaconda): |
def setGroupSelection(self, anaconda): |