class PartitionType: filesystem = None needsmtab = True supportedFileSystems = [fs("ext4"), fs("ext3"), fs("reiserfs"), fs("xfs")] #fs("btrfs")] def setFileSystem(self, filesystem): self.filesystem = fs(filesystem)
class SwapPartitionType(PartitionType): name = _("Swap") filesystem = fs("swap") mountpoint = None mountoptions = "sw" parted_type = parted.PARTITION_PRIMARY parted_flags = [] label = "PARDUS_SWAP" supportedFileSystems = [fs("swap")] desc = _("as Swap Space (optional)")
class HomePartitionType(PartitionType): name = _("Users' Files") mountpoint = "/home" filesystem = fs("ext4") mountoptions = "noatime" parted_type = parted.PARTITION_PRIMARY parted_flags = [] label = "PARDUS_HOME" desc = _("as User Files (optional)")
class RootPartitionType(PartitionType): name = _("Install Root") mountpoint = "/" filesystem = fs("ext4") mountoptions = "noatime" parted_type = parted.PARTITION_PRIMARY parted_flags = [parted.PARTITION_BOOT] label = "PARDUS_ROOT" desc = _("as Pardus System Files (mandatory)")
class ArchivePartitionType(PartitionType): name = _("Archive Partition") mountpoint = "/mnt/archive" filesystem = fs("ntfs") mountoptions = "noatime" needsmtab = False parted_type = parted.PARTITION_PRIMARY parted_flags = [] label = "ARCHIVE" supportedFileSystems = [ fs("ext4"), fs("ext3"), fs("reiserfs"), fs("xfs"), fs("ntfs"), fs("fat32") ] #fs("btrfs")] desc = _("as Storage Area")
def autoPartDevice(self): self.info.updateAndShow(_("Writing disk tables ...")) ctx.partrequests.remove_all() dev = ctx.installData.autoPartDev # first delete partitions on device dev.deleteAllPartitions() dev.commit() ctx.mainScreen.processEvents() p = dev.addPartition(None, parttype.root.parted_type, fs("lvm"), dev.getFreeMB(), parttype.root.parted_flags) partition = dev.getPartition(p.num) # get partition.Partition # create the partition dev.commit() ctx.mainScreen.processEvents() #Use LVM physicalVolume = lvm.PhysicalVolume(partition.getPath, partition.getMB()) volumeGroup = lvm.VolumeGroup("volumegroup", pvs=[physicalVolume], preexist_size=physicalVolume.size) logicalVolume = lvm.LogicalVolume("logicalVolume1", volumeGroup=volumeGroup) ctx.partrequests.append(request.PhysicalVolumeRequest(physicalVolume, parttype.physicalVolume)) ctx.partrequests.append(request.VolumeGroupRequest(volumeGroup, parttype.volumeGroup)) ctx.partrequests.append(request.LogicalVolumeRequest(logicalVolume, parttype.logicalVolume)) # make partition requests ctx.partrequests.append(request.MountRequest(logicalVolume.path, parttype.root)) ctx.partrequests.append(request.FormatRequest(logicalVolume.path, parttype.root)) ctx.partrequests.append(request.LabelRequest(logicalVolume.path, parttype.root)) ctx.partrequests.append(request.SwapFileRequest(logicalVolume.path, parttype.root)) time.sleep(2)
def autoPartUseAvail(self): dev = ctx.installData.autoPartDev _part = ctx.installData.autoPartPartition part = _part["partition"] if part.isLogical(): ptype = PARTITION_LOGICAL else: ptype = PARTITION_PRIMARY if part.isResizable(): newPartSize = int(_part["newSize"]/2) - 2 ctx.debugger.log("UA: newPartSize : %s " % newPartSize) ctx.debugger.log("UA: resizing to : %s " % (int(part.getMB()) - newPartSize)) _np = dev.resizePartition(part._fsname, part.getMB() - newPartSize, part) self.info.updateMessage(_("Resize Finished ...")) ctx.debugger.log("UA: Resize finished.") time.sleep(1) newStart = _np.geom.end np = dev.getPartition(_np.num) self.info.updateMessage(_("Creating new partition ...")) ctx.debugger.log("UA: newStart : %s " % newStart) _newPart = dev.addPartition(None, ptype, parttype.root.filesystem, newPartSize - 8, parttype.root.parted_flags, newStart) newPart = dev.getPartition(_newPart.num) elif part.isFreespace(): newPartSize = part.getMB() - 8 newStart = part.getStart() _newPart = dev.addPartition(part._partition, ptype, fs("lvm"), newPartSize, parttype.root.parted_flags) newPart = dev.getPartition(_newPart.num) else: raise YaliError, _("Failed to use partition for automatic installation " % part.getPath()) dev.commit() ctx.mainScreen.processEvents() #Use LVM physicalVolume = lvm.PhysicalVolume(partition.getPath, partition.getMB()) volumeGroup = lvm.VolumeGroup("volumegroup", pvs=[physicalVolume], preexist_size=physicalVolume.size) logicalVolume = lvm.LogicalVolume("logicalVolume1", volumeGroup=volumeGroup) ctx.partrequests.append(request.PhysicalVolumeRequest(physicalVolume, parttype.physicalVolume)) ctx.partrequests.append(request.VolumeGroupRequest(volumeGroup, parttype.volumeGroup)) ctx.partrequests.append(request.LogicalVolumeRequest(logicalVolume, parttype.logicalVolume)) # make partition requests ctx.partrequests.append(request.MountRequest(logicalVolume.path, parttype.root)) ctx.partrequests.append(request.FormatRequest(logicalVolume.path, parttype.root)) ctx.partrequests.append(request.LabelRequest(logicalVolume.path, parttype.root)) ctx.partrequests.append(request.SwapFileRequest(logicalVolume.path, parttype.root)) time.sleep(2)
def setFileSystem(self, filesystem): self.filesystem = fs(filesystem)