예제 #1
0
    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
예제 #2
0
 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)
예제 #3
0
파일: operations.py 프로젝트: Tayyib/uludag
 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)
예제 #4
0
 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)
예제 #5
0
    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)
예제 #6
0
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 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
예제 #8
0
파일: storageset.py 프로젝트: Tayyib/uludag
 def devshm(self):
     if not self._devshm:
         self._devshm = NoDevice(format=getFormat("tmpfs",
                                                  device="tmpfs",
                                                  mountpoint="/dev/shm"))
     return self._devshm
예제 #9
0
파일: storageset.py 프로젝트: Tayyib/uludag
 def proc(self):
     if not self._proc:
         self._proc = NoDevice(format=getFormat("proc",
                                                device="proc",
                                                mountpoint="/proc"))
     return self._proc
예제 #10
0
파일: storageset.py 프로젝트: Tayyib/uludag
 def debugfs(self):
     if not self._debugfs:
         self._debugfs = NoDevice(format=getFormat("debugfs",
                                                  device="debugfs",
                                                  mountpoint="/sys/kernel/debug"))
     return self._debugfs
예제 #11
0
파일: storageset.py 프로젝트: Tayyib/uludag
 def sysfs(self):
     if not self._sysfs:
         self._sysfs = NoDevice(format=getFormat("sysfs",
                                                 device="sys",
                                                 mountpoint="/sys"))
     return self._sysfs