--- cdrom.image/sme8/updates/installclasses/smeinstallclass.py 2009/11/30 23:46:26 1.5 +++ cdrom.image/sme8/updates/installclasses/smeinstallclass.py 2013/07/03 00:38:24 1.10 @@ -65,36 +65,24 @@ class InstallClass(BaseInstallClass): name = N_("New _SME Server Install") pixmap = "smeserver.png" description = N_("This option performs a new install of " - "SME Server. All attached hard drives " - "will be repartitioned and formated.") + "SME Server. All hard drives, including " + "removable media, 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,15 +169,25 @@ 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") + fstype = "ext3" + if flags.cmdline.has_key("ext4"): + fstype = "ext4" + (swapMin, swapMax) = iutil.swapSuggestion() if level >= 1: raid1 = [] @@ -250,7 +245,7 @@ class InstallClass(BaseInstallClass): partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("swap"), raidmembers=raid2, raidlevel="RAID"+str(level), raidminor=2, format=1, raidspares=spares)) - partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("ext3"), + partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet(fstype), mountpoint="/", raidmembers=raid3, raidlevel="RAID"+str(level), raidminor=3, format=1, raidspares=spares)) @@ -269,7 +264,7 @@ class InstallClass(BaseInstallClass): request.uniqueID = 200 partitions.autoPartitionRequests.append(request) else: - partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"), + partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet(fstype), mountpoint="/", drive=[drive], size=1536, grow=1, primary=1, format=1)) partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("swap"), @@ -281,22 +276,22 @@ class InstallClass(BaseInstallClass): partitions.autoPartitionRequests.append(request) if not flags.cmdline.has_key("multipart"): - partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), + partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet(fstype), mountpoint="/", size=1536, volgroup=201, lvname="root", grow=1, format=1)) partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) else: - partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), + partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet(fstype), mountpoint="/", size=2048, maxSizeMB=4096, volgroup=201, lvname="root", grow=1, format=1)) - partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), + partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet(fstype), mountpoint="/var", size=1024, maxSizeMB=4096, volgroup=201, lvname="var", grow=1, format=1)) - partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), + partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet(fstype), mountpoint="/home/e-smith/files", size=1024, maxSizeMB=8192, volgroup=201, lvname="files", grow=1, format=1)) - partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), + partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet(fstype), mountpoint="/tmp", size=1024, maxSizeMB=4096, volgroup=201, lvname="tmp", grow=1, format=1)) partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), @@ -304,11 +299,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 +327,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):