67 |
description = N_("This option performs a new install of " |
description = N_("This option performs a new install of " |
68 |
"SME Server. All attached hard drives " |
"SME Server. All attached hard drives " |
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"): |
119 |
|
alldrives = filter(lambda x:not (partedUtils.hasProtectedPartitions(x, self.anaconda) or |
120 |
|
x in flags.cmdline["exclude"].split(",")), diskset.disks.keys()) |
121 |
|
else: |
122 |
|
alldrives = filter(lambda x:not partedUtils.hasProtectedPartitions(x, self.anaconda), diskset.disks.keys()) |
123 |
|
|
|
alldrives = diskset.driveList() |
|
124 |
if flags.cmdline.has_key("drives"): |
if flags.cmdline.has_key("drives"): |
125 |
drives = filter(lambda x:isys.mediaPresent(x) and |
if flags.cmdline["drives"] == "all": |
126 |
x in flags.cmdline["drives"].split(","), alldrives) |
drives = alldrives |
127 |
|
else: |
128 |
|
drives = filter(lambda x: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 |
spares = max(0,min(int(flags.cmdline["spares"]),len(drives)-2)) |
if flags.cmdline["spares"] == "none": |
134 |
|
spares = 0 |
135 |
|
else: |
136 |
|
try: |
137 |
|
spares = max(0,min(int(flags.cmdline["spares"]),len(drives)-2)) |
138 |
|
except: |
139 |
|
spares = (len(drives)+4)/7 |
140 |
else: |
else: |
141 |
spares = (len(drives)+4)/7 |
spares = (len(drives)+4)/7 |
142 |
|
|
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 |
170 |
|
|
171 |
if len(drives) >= 1: |
if len(drives) >= 1: |
172 |
log.info("Using the following drives: %s" % drives) |
log.info("Using the following drives: %s" % drives) |
173 |
|
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 |
|
|
199 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
200 |
|
|
201 |
if not flags.cmdline.has_key("nolvm"): |
if not flags.cmdline.has_key("nolvm"): |
202 |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
if not flags.cmdline.has_key("multipart"): |
203 |
size=(swapMin+4096)/(len(drives)-spares-max(0,level-4)), |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
204 |
drive=[drive], primary=1, grow=1, format=1) |
size=(swapMin+1536)/(len(drives)-spares-max(0,level-4)), |
205 |
|
drive=[drive], primary=1, grow=1, format=1) |
206 |
|
else: |
207 |
|
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
208 |
|
size=(swapMin+5120)/(len(drives)-spares-max(0,level-4)), |
209 |
|
drive=[drive], primary=1, grow=1, format=1) |
210 |
request.uniqueID = uniqueID + 50 |
request.uniqueID = uniqueID + 50 |
211 |
raid2.append(uniqueID + 50) |
raid2.append(uniqueID + 50) |
212 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
219 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
220 |
|
|
221 |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
222 |
size=1500/(len(drives)-spares-max(0,level-4)), |
size=1536/(len(drives)-spares-max(0,level-4)), |
223 |
drive=[drive], grow=1, primary=1, format=1) |
drive=[drive], grow=1, primary=1, format=1) |
224 |
request.uniqueID = uniqueID + 60 |
request.uniqueID = uniqueID + 60 |
225 |
raid3.append(uniqueID + 60) |
raid3.append(uniqueID + 60) |
251 |
mountpoint="/boot", drive=[drive], size=100, primary=1, format=1)) |
mountpoint="/boot", drive=[drive], size=100, primary=1, format=1)) |
252 |
|
|
253 |
if not flags.cmdline.has_key("nolvm"): |
if not flags.cmdline.has_key("nolvm"): |
254 |
request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"), |
if not flags.cmdline.has_key("multipart"): |
255 |
drive=[drive], size=swapMin+4096, grow=1, primary=1, format=1) |
request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"), |
256 |
|
drive=[drive], size=swapMin+1536, grow=1, primary=1, format=1) |
257 |
|
else: |
258 |
|
request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"), |
259 |
|
drive=[drive], size=swapMin+5120, grow=1, primary=1, format=1) |
260 |
request.uniqueID = 200 |
request.uniqueID = 200 |
261 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
262 |
else: |
else: |
263 |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"), |
264 |
mountpoint="/", drive=[drive], size=4096, grow=1, primary=1, format=1)) |
mountpoint="/", drive=[drive], size=1536, grow=1, primary=1, format=1)) |
265 |
|
|
266 |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("swap"), |
267 |
drive=[drive], size=swapMin, maxSizeMB=swapMax, grow=1, primary=1, format=1)) |
drive=[drive], size=swapMin, maxSizeMB=swapMax, grow=1, primary=1, format=1)) |
273 |
|
|
274 |
if not flags.cmdline.has_key("multipart"): |
if not flags.cmdline.has_key("multipart"): |
275 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
276 |
mountpoint="/", size=1300, volgroup=201, lvname="root", grow=1, format=1)) |
mountpoint="/", size=1536, volgroup=201, lvname="root", grow=1, format=1)) |
277 |
|
|
278 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
279 |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
288 |
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)) |
289 |
|
|
290 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
291 |
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)) |
292 |
|
|
293 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
294 |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
295 |
|
|
296 |
partitions.autoClearPartType = CLEARPART_TYPE_ALL |
partitions.autoClearPartType = CLEARPART_TYPE_ALL |
297 |
partitions.autoClearPartDrives = drives |
partitions.autoClearPartDrives = drives |
|
self.doPartition = False |
|
298 |
else: |
else: |
299 |
log.warning("Not useable drives found. Enabling manual partitioning.") |
log.warning("Not useable drives found. Enabling manual partitioning.") |
300 |
self.doPartition = True |
BaseInstallClass.setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_ALL, doClear = True) |
301 |
BaseInstallClass.setDefaultPartitioning(self, partitions, clear, doClear) |
self.anaconda.dispatch.skipStep("parttype", skip = 0) |
302 |
|
self.anaconda.dispatch.skipStep("partition", skip = 0) |
303 |
|
|
304 |
def setAsHeadless(self, dispatch, isHeadless = 0): |
def setAsHeadless(self, dispatch, isHeadless = 0): |
305 |
if isHeadless == 0: |
if isHeadless == 0: |
323 |
|
|
324 |
def setInstallData(self, anaconda): |
def setInstallData(self, anaconda): |
325 |
BaseInstallClass.setInstallData(self, anaconda) |
BaseInstallClass.setInstallData(self, anaconda) |
326 |
self.setDefaultPartitioning(anaconda.id.partitions, CLEARPART_TYPE_ALL) |
self.anaconda = anaconda |
327 |
self.setSELinux(anaconda.id, SELINUX_DISABLED) |
self.setSELinux(anaconda.id, SELINUX_DISABLED) |
328 |
|
|
329 |
def setGroupSelection(self, anaconda): |
def setGroupSelection(self, anaconda): |