def dev(self): if not self._dev: self._dev = DirectoryDevice( "/dev", format=getFormat("bind", device="/dev", mountpoint="/dev", exists=True), exists=True ) return self._dev
def __init__(self, device, format=None): DeviceAction.__init__(self, device) if format: self.origFormat = device.format self.device.format = format else: self.origFormat = getFormat(None)
def __init__(self, device, format=None): DeviceOperation.__init__(self, device) if format: self.origFormat = device.format if self.device.format.exists: self.device.format.teardown() self.device.format = format else: self.origFormat = getFormat(None)
def __init__(self, device, format=None): DeviceAction.__init__(self, device) if format: self.origFormat = device.format if self.device.format.exists: self.device.format.teardown() self.device.format = format else: self.origFormat = getFormat(None)
def createSwapFile(self, device, size, rootPath=None): """ Create and activate a swap file under rootPath. """ if not rootPath: rootPath = self.rootpath filename = "/SWAP" count = 0 basedir = os.path.normpath("%s/%s" % (rootPath, device.format.mountpoint)) while os.path.exists("%s/%s" % (basedir, filename)) or self.devicetree.getDeviceByName(filename): file = os.path.normpath("%s/%s" % (basedir, filename)) count += 1 filename = "/SWAP-%d" % count dev = FileDevice(filename, size=size, parents=[device], format=getFormat("swap", device=filename)) dev.create() dev.setup() dev.format.create() dev.format.setup() self.devicetree._addDevice(dev)
def checkForSwapNoMatch(intf, storage): """Check for any partitions of type 0x82 which don't have a swap fs.""" for device in storage.partitions: if not device.exists: # this is only for existing partitions continue if device.getFlag(parted.PARTITION_SWAP) and \ not device.format.type == "swap": rc = intf.messageWindow(_("Format as Swap?"), _("%s has a partition type of 0x82 " "(Linux swap) but does not appear to " "be formatted as a Linux swap " "partition.\n\n" "Would you like to format this " "partition as a swap partition?") % device.path, type = "yesno") if rc == 1: format = getFormat("swap", device=device.path) storage.formatDevice(device, format) return
def devshm(self): if not self._devshm: self._devshm = NoDevice(format=getFormat("tmpfs", device="tmpfs", mountpoint="/dev/shm")) return self._devshm
def proc(self): if not self._proc: self._proc = NoDevice(format=getFormat("proc", device="proc", mountpoint="/proc")) return self._proc
def debugfs(self): if not self._debugfs: self._debugfs = NoDevice(format=getFormat("debugfs", device="debugfs", mountpoint="/sys/kernel/debug")) return self._debugfs
def sysfs(self): if not self._sysfs: self._sysfs = NoDevice(format=getFormat("sysfs", device="sys", mountpoint="/sys")) return self._sysfs