예제 #1
0
    def commit(self):
        import yali4.gui.context as ctx

        attempt = 1
        maxTries = 5
        keepTrying = True

        while keepTrying and (attempt <= maxTries):
            try:
                self._disk.commit()
                keepTrying = False
                sysutils.run("sync")
            except Exception, msg:
                attempt += 1
예제 #2
0
파일: storage.py 프로젝트: Tayyib/uludag
    def commit(self):
        import yali4.gui.context as ctx

        attempt = 1
        maxTries = 5
        keepTrying = True

        while keepTrying and (attempt <= maxTries):
            try:
                self._disk.commit()
                keepTrying = False
                sysutils.run("sync")
            except Exception, msg:
                attempt += 1
예제 #3
0
파일: filesystem.py 프로젝트: Tayyib/uludag
 def setLabel(self, partition, label):
     label = self.availableLabel(label)
     cmd_path = requires("dosfslabel")
     cmd = "%s %s %s" % (cmd_path, partition.getPath(), label)
     if not sysutils.run(cmd):
         return False
     return label
예제 #4
0
 def format(self, partition):
     self.preFormat(partition)
     cmd_path = requires("mkfs.vfat")
     cmd = "%s %s" % (cmd_path, partition.getPath())
     res = sysutils.run(cmd)
     if not res:
         raise YaliException, "vfat format failed: %s" % partition.getPath()
예제 #5
0
파일: filesystem.py 프로젝트: Tayyib/uludag
 def format(self, partition):
     self.preFormat(partition)
     cmd_path = requires("mkfs.vfat")
     cmd = "%s %s" %(cmd_path,partition.getPath())
     res = sysutils.run(cmd)
     if not res:
         raise YaliException, "vfat format failed: %s" % partition.getPath()
예제 #6
0
파일: filesystem.py 프로젝트: Tayyib/uludag
 def format(self, partition):
     self.preFormat(partition)
     cmd_path = requires("mkfs.xfs")
     cmd = "%s -f %s" %(cmd_path, partition.getPath())
     res = sysutils.run(cmd)
     if not res:
         raise YaliException, "%s format failed: %s" % (self.name(), partition.getPath())
예제 #7
0
 def setLabel(self, partition, label):
     label = self.availableLabel(label)
     cmd_path = requires("xfs_admin")
     cmd = "%s -L %s %s" % (cmd_path, label, partition.getPath())
     if not sysutils.run(cmd):
         return False
     return label
예제 #8
0
파일: filesystem.py 프로젝트: Tayyib/uludag
 def setLabel(self, partition, label):
     label = self.availableLabel(label)
     cmd_path = requires("xfs_admin")
     cmd = "%s -L %s %s" % (cmd_path, label, partition.getPath())
     if not sysutils.run(cmd):
         return False
     return label
예제 #9
0
 def setLabel(self, partition, label):
     label = self.availableLabel(label)
     cmd_path = requires("dosfslabel")
     cmd = "%s %s %s" % (cmd_path, partition.getPath(), label)
     if not sysutils.run(cmd):
         return False
     return label
예제 #10
0
파일: filesystem.py 프로젝트: Tayyib/uludag
 def getLabel(self, partition):
     """ Read file system label and return """
     cmd_path = requires("e2label")
     cmd = "%s %s" % (cmd_path, partition.getPath())
     label = sysutils.run(cmd, capture=True)
     if not label:
         return False
     return label.strip()
예제 #11
0
파일: filesystem.py 프로젝트: Tayyib/uludag
 def tune2fs(self, partition):
     """ Runs tune2fs for given partition """
     cmd_path = requires("tune2fs")
     # Disable mount count and use 6 month interval to fsck'ing disks at boot
     cmd = "%s -c 0 -i 6m %s" % (cmd_path, partition.getPath())
     res = sysutils.run(cmd)
     if not res:
         raise YaliException, "tune2fs tuning failed: %s" % partition.getPath()
예제 #12
0
 def format(self, partition):
     self.preFormat(partition)
     cmd_path = requires("mkfs.xfs")
     cmd = "%s -f %s" % (cmd_path, partition.getPath())
     res = sysutils.run(cmd)
     if not res:
         raise YaliException, "%s format failed: %s" % (self.name(),
                                                        partition.getPath())
예제 #13
0
 def getLabel(self, partition):
     """ Read file system label and return """
     cmd_path = requires("e2label")
     cmd = "%s %s" % (cmd_path, partition.getPath())
     label = sysutils.run(cmd, capture=True)
     if not label:
         return False
     return label.strip()
예제 #14
0
 def setLabel(self, partition, label):
     # FIXME It formats the device twice for setting label
     # Find a better way for it...
     label = self.availableLabel(label)
     cmd_path = requires("mkfs.btrfs")
     cmd = "%s -L %s %s" % (cmd_path, label, partition.getPath())
     if not sysutils.run(cmd):
         return False
     return label
예제 #15
0
 def tune2fs(self, partition):
     """ Runs tune2fs for given partition """
     cmd_path = requires("tune2fs")
     # Disable mount count and use 6 month interval to fsck'ing disks at boot
     cmd = "%s -c 0 -i 6m %s" % (cmd_path, partition.getPath())
     res = sysutils.run(cmd)
     if not res:
         raise YaliException, "tune2fs tuning failed: %s" % partition.getPath(
         )
예제 #16
0
파일: filesystem.py 프로젝트: Tayyib/uludag
 def setLabel(self, partition, label):
     # FIXME It formats the device twice for setting label
     # Find a better way for it...
     label = self.availableLabel(label)
     cmd_path = requires("mkfs.btrfs")
     cmd = "%s -L %s %s" % (cmd_path, label, partition.getPath())
     if not sysutils.run(cmd):
         return False
     return label
예제 #17
0
파일: filesystem.py 프로젝트: Tayyib/uludag
 def setLabel(self, partition, label):
     label = self.availableLabel(label)
     cmd_path = requires("e2label")
     cmd = "%s %s %s" % (cmd_path, partition.getPath(), label)
     if not sysutils.run(cmd):
         return False
     # Check label consistency
     if not self.getLabel(partition) == label:
         return False
     return label
예제 #18
0
 def setLabel(self, partition, label):
     label = self.availableLabel(label)
     cmd_path = requires("e2label")
     cmd = "%s %s %s" % (cmd_path, partition.getPath(), label)
     if not sysutils.run(cmd):
         return False
     # Check label consistency
     if not self.getLabel(partition) == label:
         return False
     return label
예제 #19
0
    def execute(self):
        ctx.mainScreen.disableNext()

        ctx.debugger.log("Show reboot dialog.")
        InfoDialog(_("Press <b>Reboot</b> button to restart your system."), _("Reboot"))

        ctx.yali.info.updateAndShow(_('<b>Rebooting system. Please wait!</b>'))

        # remove cd...
        if not ctx.yali.install_type == YALI_FIRSTBOOT:
            ctx.debugger.log("Trying to eject the CD.")
            sysutils.ejectCdrom()

        ctx.debugger.log("Yali, reboot calling..")

        ctx.mainScreen.processEvents()
        sysutils.run("sync")
        time.sleep(4)
        sysutils.reboot()
예제 #20
0
    def setLabel(self, partition, label):
        label = self.availableLabel(label)
        cmd_path = requires("mkswap")
        cmd = "%s -v1 -L %s %s" % (cmd_path, label, partition.getPath())
        if not sysutils.run(cmd):
            return False

        # Swap on
        sysutils.swapOn(partition.getPath())

        return label
예제 #21
0
파일: filesystem.py 프로젝트: Tayyib/uludag
    def setLabel(self, partition, label):
        label = self.availableLabel(label)
        cmd_path = requires("mkswap")
        cmd = "%s -v1 -L %s %s" % (cmd_path, label, partition.getPath())
        if not sysutils.run(cmd):
            return False

        # Swap on
        sysutils.swap_on(partition.getPath())

        return label
예제 #22
0
    def execute(self):
        ctx.mainScreen.disableNext()

        ctx.debugger.log("Show reboot dialog.")
        InfoDialog(_("Press <b>Reboot</b> button to restart your system."),
                   _("Reboot"))

        ctx.yali.info.updateAndShow(_('<b>Rebooting system. Please wait!</b>'))

        # remove cd...
        if not ctx.yali.install_type == YALI_FIRSTBOOT:
            ctx.debugger.log("Trying to eject the CD.")
            sysutils.ejectCdrom()

        ctx.debugger.log("Yali, reboot calling..")

        ctx.mainScreen.processEvents()
        sysutils.run("sync")
        time.sleep(4)
        sysutils.reboot()
예제 #23
0
파일: filesystem.py 프로젝트: Tayyib/uludag
    def resize(self, size_mb, partition):
        """ Resize given partition as given size """
        minsize = self.minResizeMB(partition)
        if size_mb < minsize:
            size_mb = minsize
        cmd_path = requires("resize2fs")

        # Check before resize
        self.preResize(partition)

        res = sysutils.run("resize2fs",[partition.getPath(), "%sM" %(size_mb)])
        if not res:
            raise FSError, "Resize failed on %s" % (partition.getPath())
        return True
예제 #24
0
파일: filesystem.py 프로젝트: Tayyib/uludag
    def resize(self, size_mb, partition):
        minsize = self.minResizeMB(partition)
        if size_mb < minsize:
            size_mb = minsize

        if not self.preResize(partition):
            raise FSCheckError, _("Partition is not ready for resizing. Check it before installation.")

        cmd_path = requires("btrfsctl")
        cmd = "%s -r %dm -A %s" % (cmd_path, size_mb, partition.getPath())
        if not sysutils.run(cmd):
            raise FSError, "Resize failed on %s " % (partition.getPath())

        return True
예제 #25
0
파일: filesystem.py 프로젝트: Tayyib/uludag
    def resize(self, size_mb, partition):
        minsize = self.minResizeMB(partition)
        if size_mb < minsize:
            size_mb = minsize

        if not self.resizeSilent(size_mb, partition) or not self.preResize(partition):
            raise FSCheckError, _("The filesystem of '%s' partition is NTFS, and this partition \nwas not closed properly.Please restart your system and close \nthis partition properly!After this operation, start Pardus \ninstallation again!") % partition.getPath()

        cmd_path = requires("ntfsresize")
        cmd = "%s -P -ff -s %dM %s" % (cmd_path, size_mb, partition.getPath())

        if not sysutils.run(cmd):
            raise FSError, _("Resize failed on %s " % partition.getPath())

        return True
예제 #26
0
파일: filesystem.py 프로젝트: Tayyib/uludag
    def resize(self, size_mb, partition):
        minsize = self.minResizeMB(partition)
        if size_mb < minsize:
            size_mb = minsize

        if not self.resizeSilent(size_mb, partition) or not self.preResize(partition):
            raise FSCheckError, _("Partition is not ready for resizing. Check it before installation.")

        cmd_path = requires("ntfsresize")
        cmd = "%s -ff -s %dM %s" % (cmd_path, size_mb, partition.getPath())

        if not sysutils.run(cmd):
            raise FSError, _("Resize failed on %s " % partition.getPath())

        return True
예제 #27
0
    def resize(self, size_mb, partition):
        """ Resize given partition as given size """
        minsize = self.minResizeMB(partition)
        if size_mb < minsize:
            size_mb = minsize
        cmd_path = requires("resize2fs")

        # Check before resize
        self.preResize(partition)

        res = sysutils.run(
            "resize2fs",
            [partition.getPath(), "%sM" % (size_mb)])
        if not res:
            raise FSError, "Resize failed on %s" % (partition.getPath())
        return True
예제 #28
0
    def resize(self, size_mb, partition):
        minsize = self.minResizeMB(partition)
        if size_mb < minsize:
            size_mb = minsize

        if not self.preResize(partition):
            raise FSCheckError, _(
                "Partition is not ready for resizing. Check it before installation."
            )

        cmd_path = requires("btrfsctl")
        cmd = "%s -r %dm -A %s" % (cmd_path, size_mb, partition.getPath())
        if not sysutils.run(cmd):
            raise FSError, "Resize failed on %s " % (partition.getPath())

        return True
예제 #29
0
    def resize(self, size_mb, partition):
        minsize = self.minResizeMB(partition)
        if size_mb < minsize:
            size_mb = minsize

        if not self.resizeSilent(size_mb,
                                 partition) or not self.preResize(partition):
            raise FSCheckError, _(
                "Partition is not ready for resizing. Check it before installation."
            )

        cmd_path = requires("ntfsresize")
        cmd = "%s -P -ff -s %dM %s" % (cmd_path, size_mb, partition.getPath())

        if not sysutils.run(cmd):
            raise FSError, _("Resize failed on %s " % partition.getPath())

        return True
예제 #30
0
    def resize(self, size_mb, partition):
        minsize = self.minResizeMB(partition)
        if size_mb < minsize:
            size_mb = minsize

        if not self.resizeSilent(size_mb,
                                 partition) or not self.preResize(partition):
            raise FSCheckError, _("The filesystem of '%s' partition is NTFS, and this partition \n " \
                                  "was not closed properly. Please restart your system and close \n " \
                                  "this partition properly! After this operation, start Pardus \n " \
                                  "installation again!" % partition.getPath())

        cmd_path = requires("ntfsresize")
        cmd = "%s -P -f -s %dM %s" % (cmd_path, size_mb, partition.getPath())

        if not sysutils.run(cmd):
            raise FSError, _("Resize failed on %s " % partition.getPath())

        return True
예제 #31
0
파일: filesystem.py 프로젝트: Tayyib/uludag
    def format(self, partition):
        """ Format the given partition """
        self.preFormat(partition)

        cmd_path = requires("mkfs.%s" % self.name())

        # bug 5616: ~100MB reserved-blocks-percentage
        reserved_percentage = int(math.ceil(100.0 * 100.0 / partition.getMB()))

        # Use hashed b-trees to speed up lookups in large directories
        cmd = "%s -O dir_index -q -j -m %d %s" % (cmd_path,
                                                  reserved_percentage,
                                                  partition.getPath())

        res = sysutils.run(cmd)
        if not res:
            raise YaliException, "%s format failed: %s" % (self.name(), partition.getPath())

        # for Disabling Lengthy Boot-Time Checks
        self.tune2fs(partition)
예제 #32
0
    def format(self, partition):
        """ Format the given partition """
        self.preFormat(partition)

        cmd_path = requires("mkfs.%s" % self.name())

        # bug 5616: ~100MB reserved-blocks-percentage
        reserved_percentage = int(math.ceil(100.0 * 100.0 / partition.getMB()))

        # Use hashed b-trees to speed up lookups in large directories
        cmd = "%s -O dir_index -q -j -m %d %s" % (
            cmd_path, reserved_percentage, partition.getPath())

        res = sysutils.run(cmd)
        if not res:
            raise YaliException, "%s format failed: %s" % (self.name(),
                                                           partition.getPath())

        # for Disabling Lengthy Boot-Time Checks
        self.tune2fs(partition)
예제 #33
0
def setOrderedDiskList():
    devices = detectAll()
    devices.sort()

    import yali4.gui.context as ctx

    # Check EDD Module
    if not os.path.exists("/sys/firmware/edd"):
        cmd_path = sysutils.find_executable("modprobe")
        cmd = "%s %s" % (cmd_path, "edd")
        res = sysutils.run(cmd)
        if not res:
            ctx.installData.orderedDiskList = devices
            ctx.debugger.log("ERROR : Inserting EDD Module failed !")
            return

    edd = EDD()
    sortedList = []
    edd_list = edd.list_edd_signatures()
    mbr_list = edd.list_mbr_signatures()
    edd_keys = edd_list.keys()
    edd_keys.sort()
    for bios_num in edd_keys:
        edd_sig = edd_list[bios_num]
        if mbr_list.has_key(edd_sig):
            sortedList.append(mbr_list[edd_sig])

    if len(devices) > 1:
        a = ctx.installData.orderedDiskList = sortedList
        b = devices
        # check consistency of diskList
        if not len(filter(None, map(lambda x: x in a, b))) == len(b):
            ctx.installData.orderedDiskList = devices
            ctx.isEddFailed = True
    else:
        ctx.installData.orderedDiskList = devices
예제 #34
0
파일: storage.py 프로젝트: Tayyib/uludag
def setOrderedDiskList():
    devices = detectAll()
    devices.sort()

    import yali4.gui.context as ctx

    # Check EDD Module
    if not os.path.exists("/sys/firmware/edd"):
        cmd_path = sysutils.find_executable("modprobe")
        cmd = "%s %s" % (cmd_path, "edd")
        res = sysutils.run(cmd)
        if not res:
            ctx.installData.orderedDiskList = devices
            ctx.debugger.log("ERROR : Inserting EDD Module failed !")
            return

    edd = EDD()
    sortedList = []
    edd_list = edd.list_edd_signatures()
    mbr_list = edd.list_mbr_signatures()
    edd_keys = edd_list.keys()
    edd_keys.sort()
    for bios_num in edd_keys:
        edd_sig = edd_list[bios_num]
        if mbr_list.has_key(edd_sig):
            sortedList.append(mbr_list[edd_sig])

    if len(devices) > 1:
        a = ctx.installData.orderedDiskList = sortedList
        b = devices
        # check consistency of diskList
        if not len(filter(None, map(lambda x: x in a,b))) == len(b):
            ctx.installData.orderedDiskList = devices
            ctx.isEddFailed = True
    else:
        ctx.installData.orderedDiskList = devices
예제 #35
0
 def resizeSilent(self, size_mb, partition):
     # don't do anything, just check
     cmd_path = requires("ntfsresize")
     cmd = "%s -P -n -ff -s %dM %s" % (cmd_path, size_mb,
                                       partition.getPath())
     return sysutils.run(cmd)
예제 #36
0
 def preResize(self, partition):
     """ Routine operations before resizing """
     cmd_path = requires("ntfsresize")
     cmd = "%s -P -c %s" % (cmd_path, partition.getPath())
     return sysutils.run(cmd)
예제 #37
0
파일: lvmutils.py 프로젝트: Tayyib/uludag
def _lvmclear(args):
    try:
        return sysutils.run("lvm",args)
    except Exception:
        #FIXME:log.error
        raise LVMError, args[0]
예제 #38
0
파일: lvmutils.py 프로젝트: Tayyib/uludag
def _lvmcapture(args):
    try:
        return sysutils.run("lvm", args, capture=True)
    except RuntimeError, (errno, msg):
        #FIXME:log.error
        raise LVMError, msg
예제 #39
0
파일: filesystem.py 프로젝트: Tayyib/uludag
 def preResize(self, partition):
     """ Routine operations before resizing """
     cmd_path = requires("ntfsresize")
     cmd = "%s -c %s" % (cmd_path, partition.getPath())
     return sysutils.run(cmd)
예제 #40
0
파일: filesystem.py 프로젝트: Tayyib/uludag
 def resizeSilent(self, size_mb, partition):
     # don't do anything, just check
     cmd_path = requires("ntfsresize")
     cmd = "%s -n -ff -s %dM %s" % (cmd_path, size_mb, partition.getPath())
     return sysutils.run(cmd)