--- cdrom.image/sme8/updates/installclasses/smeinstallclass.py 2009/11/30 23:46:26 1.5 +++ cdrom.image/sme8/updates/installclasses/smeinstallclass.py 2010/08/26 22:09:11 1.6 @@ -69,32 +69,20 @@ class InstallClass(BaseInstallClass): "will be repartitioned and formated.") sortPriority = 1 - doPartition = False parentClass = ( _("Install SME Server"), "smeserver.png" ) def requiredDisplayMode(self): return 't' - def driveIsRemovable(self, device): - try: - removable = bool(int(open("/sys/block/%s/removable" % device).read())) - except: - removable = False - - return removable - def setSteps(self, dispatch): dispatch.setStepList( + "betanag", "language", "keyboard", "findrootparts", - "betanag", - "installtype", "partitionobjinit", "autopartitionexecute", - "parttype", - "partition", "partitiondone", "bootloadersetup", "timezone", @@ -111,42 +99,35 @@ class InstallClass(BaseInstallClass): "postinstallconfig", "writeconfig", "instbootloader", - "dopostaction", "writeksconfig", - "methodcomplete", - "copylogs", "setfilecon", + "copylogs", + "methodcomplete", + "dopostaction", "complete" ) + dispatch.skipStep("bootloader", permanent = 1) # 'partition' can be used on the command line to force # verification of partitions. useful in some cases... - if self.doPartition or 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) + dispatch.skipStep("partition", skip = (1,0)[flags.cmdline.has_key("partition")]) def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1): - diskset = partedUtils.DiskSet() + diskset = self.anaconda.id.diskset if flags.cmdline.has_key("exclude"): - alldrives = filter(lambda x:not x in flags.cmdline["exclude"].split(","), diskset.driveList()) + alldrives = filter(lambda x:not (partedUtils.hasProtectedPartitions(x, self.anaconda) or + x in flags.cmdline["exclude"].split(",")), diskset.disks.keys()) else: - alldrives = diskset.driveList() + alldrives = filter(lambda x:not partedUtils.hasProtectedPartitions(x, self.anaconda), diskset.disks.keys()) if flags.cmdline.has_key("drives"): if flags.cmdline["drives"] == "all": - drives = filter(lambda x:isys.mediaPresent(x), alldrives) + drives = alldrives else: - drives = filter(lambda x:isys.mediaPresent(x) and - x in flags.cmdline["drives"].split(","), alldrives) + drives = filter(lambda x:x in flags.cmdline["drives"].split(","), alldrives) else: - drives = filter(lambda x:not self.driveIsRemovable(x) and - isys.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 flags.cmdline.has_key("spares"): if flags.cmdline["spares"] == "none": @@ -175,6 +156,10 @@ class InstallClass(BaseInstallClass): if spares > 1 and not flags.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 @@ -184,12 +169,18 @@ class InstallClass(BaseInstallClass): level = 1 if len(drives) >= 1: - excluded = filter(lambda x:x not in drives, diskset.driveList()) log.info("Using the following drives: %s" % drives) - log.info("Excluding the following drives: %s" % excluded) + excluded = filter(lambda x:x not in drives, diskset.disks.keys()) + if excluded: + log.info("Excluding the following drives: %s" % excluded) + skipped = filter(lambda x:x not in diskset.disks.keys(), diskset.driveList()) + if skipped: + log.info("Skipping the following drives: %s" % skipped) if level >= 1: log.info("Installing using RAID%s" % level) log.info("Using %s spare drives" % spares) + elif level < 0: + log.warning("Detected BIOS raid (skipping raid)") else: log.warning("Installing without using RAID") @@ -304,11 +295,11 @@ class InstallClass(BaseInstallClass): partitions.autoClearPartType = CLEARPART_TYPE_ALL partitions.autoClearPartDrives = drives - self.doPartition = False else: log.warning("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.dispatch.skipStep("parttype", skip = 0) + self.anaconda.dispatch.skipStep("partition", skip = 0) def setAsHeadless(self, dispatch, isHeadless = 0): if isHeadless == 0: @@ -332,7 +323,7 @@ class InstallClass(BaseInstallClass): def setInstallData(self, anaconda): BaseInstallClass.setInstallData(self, anaconda) - self.setDefaultPartitioning(anaconda.id.partitions, CLEARPART_TYPE_ALL) + self.anaconda = anaconda self.setSELinux(anaconda.id, SELINUX_DISABLED) def setGroupSelection(self, anaconda):