--- cdrom.image/sme7/product/installclasses/smeinstallclass.py 2009/11/30 23:46:26 1.5 +++ cdrom.image/sme7/product/installclasses/smeinstallclass.py 2010/08/26 22:09:11 1.6 @@ -61,8 +61,6 @@ class InstallClass(BaseInstallClass): "will be repartitioned and formated.") sortPriority = 1 - doPartition = False - cmdline = {} parentClass = ( _("Install SME Server"), "smeserver.png" ) @@ -84,29 +82,18 @@ class InstallClass(BaseInstallClass): return cmdlineDict - 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 - def setSteps(self, dispatch): + self.anaconda = dispatch + self.cmdline = self.createCmdlineDict() + dispatch.setStepList( + "betanag", "language", "keyboard", "findrootparts", - "betanag", "installtype", "partitionobjinit", "autopartitionexecute", - "partition", "partitiondone", "bootloadersetup", "languagesupport", @@ -124,40 +111,34 @@ class InstallClass(BaseInstallClass): "postinstallconfig", "writeconfig", "instbootloader", - "dopostaction", "writeksconfig", - "methodcomplete", - "copylogs", "setfilecon", + "copylogs", + "dopostaction", + "methodcomplete", "complete" ) # 'partition' can be used on the command line to force # verification of partitions. useful in some cases... - if self.doPartition or self.cmdline.has_key("partition"): - dispatch.skipStep("partition", skip = 0) - else: - dispatch.skipStep("partition", skip = 1) + dispatch.skipStep("partition", skip = (1,0)[self.cmdline.has_key("partition")]) def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1): - self.cmdline = self.createCmdlineDict() - diskset = partedUtils.DiskSet() + diskset = self.anaconda.id.diskset if self.cmdline.has_key("exclude"): - alldrives = filter(lambda x:not x in self.cmdline["exclude"].split(","), diskset.driveList()) + alldrives = filter(lambda x:not (partedUtils.hasProtectedPartitions(x, self.anaconda) or + x in self.cmdline["exclude"].split(",")), diskset.driveList()) else: - alldrives = diskset.driveList() + alldrives = filter(lambda x:not partedUtils.hasProtectedPartitions(x, self.anaconda), diskset.disks.keys()) if self.cmdline.has_key("drives"): if self.cmdline["drives"] == "all": - drives = filter(lambda x:self.mediaPresent(x), alldrives) + drives = alldrives else: - drives = filter(lambda x:self.mediaPresent(x) and - x in self.cmdline["drives"].split(","), alldrives) + drives = filter(lambda x:x in self.cmdline["drives"].split(","), alldrives) else: - drives = filter(lambda x:not isys.driveIsRemovable(x) and - self.mediaPresent(x) and - not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives) + drives = filter(lambda x:not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives) if self.cmdline.has_key("spares"): if self.cmdline["spares"] == "none": @@ -186,6 +167,10 @@ class InstallClass(BaseInstallClass): if spares > 1 and not self.cmdline.has_key("spares"): spares = 1 del drives[2+spares:] + elif len(drives) > 1 and len(drives) == len(filter(lambda x:x.startswith('mapper/'), alldrives)): + level = -1 + del drives[1:] + spares = 0 else: if len(drives) - spares >= 6: level = 6 @@ -195,12 +180,18 @@ class InstallClass(BaseInstallClass): level = 1 if len(drives) >= 1: - excluded = filter(lambda x:x not in drives, diskset.driveList()) log("Using the following drives: %s" % drives) - log("Excluding the following drives: %s" % excluded) + excluded = filter(lambda x:x not in drives, diskset.disks.keys()) + if excluded: + log("Excluding the following drives: %s" % excluded) + skipped = filter(lambda x:x not in diskset.disks.keys(), diskset.driveList()) + if skipped: + log("Skipping the following drives: %s" % skipped) if level >= 1: log("Installing using RAID%s" % level) log("Using %s spare drives" % spares) + elif level < 0: + log("Detected BIOS raid (skipping raid)") else: log("Installing without using RAID") @@ -315,11 +306,10 @@ class InstallClass(BaseInstallClass): partitions.autoClearPartType = CLEARPART_TYPE_ALL partitions.autoClearPartDrives = drives - self.doPartition = False else: log("Not useable drives found. Enabling manual partitioning.") - self.doPartition = True - BaseInstallClass.setDefaultPartitioning(self, partitions, clear, doClear) + BaseInstallClass.setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_ALL, doClear = True) + self.anaconda.skipStep("partition", skip = 0) def setAsHeadless(self, dispatch, isHeadless = 0): if isHeadless == 0: @@ -353,7 +343,6 @@ class InstallClass(BaseInstallClass): self.setRootPassword(id, pw="ThisIsGoingToBeDisabledAnyway", isCrypted=0) self.setZeroMbr(id, zeroMbr=1) self.setClearParts(id, clear=CLEARPART_TYPE_ALL, initAll=1) - self.setDefaultPartitioning(id.partitions, doClear=0) self.setBootloader(id, useLilo=0, location="mbr", linear=1) def __init__(self, expert):