コード例 #1
0
def checkForSwapNoMatch(anaconda):
    """Check for any partitions of type 0x82 which don't have a swap fs."""
    for device in anaconda.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 = anaconda.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",
                custom_icon="question",
            )
            if rc == 1:
                format = getFormat("swap", device=device.path)
                anaconda.storage.formatDevice(device, format)

    return
コード例 #2
0
    def getNext(self):
        # I don't like this but I also don't see a better way right now
        for (cb, entry) in self.cbs:
            action = self.devicetree.findActions(device=entry, type="migrate")
            if cb.get_active():
                if action:
                    # the migrate action has already been scheduled
                    continue

                newfs = getFormat(entry.format.migrationTarget)
                if not newfs:
                    log.warning("failed to get new filesystem type (%s)" %
                                entry.format.migrationTarget)
                    continue
                action = ActionMigrateFormat(entry)
                self.devicetree.registerAction(action)
            elif action:
                self.devicetree.cancelAction(action)

        return None
コード例 #3
0
    def getNext (self):
        # I don't like this but I also don't see a better way right now
        for (cb, entry) in self.cbs:
            action = self.devicetree.findActions(device=entry,
                                                 type="migrate")
            if cb.get_active():
                if action:
                    # the migrate action has already been scheduled
                    continue

                newfs = getFormat(entry.format.migrationTarget)
                if not newfs:
                    log.warning("failed to get new filesystem type (%s)"
                                % entry.format.migrationTarget)
                    continue
                action = ActionMigrateFormat(entry)
                self.devicetree.registerAction(action)
            elif action:
                self.devicetree.cancelAction(action)

        return None
コード例 #4
0
def checkForSwapNoMatch(anaconda):
    """Check for any partitions of type 0x82 which don't have a swap fs."""
    for device in anaconda.id.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 = anaconda.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",
                                    custom_icon="question")
            if rc == 1:
                format = getFormat("swap", device=device.path)
                anaconda.id.storage.formatDevice(device, format)

    return
コード例 #5
0
ファイル: upgrade_text.py プロジェクト: 274914765/python
    def __call__ (self, screen, anaconda):
        migent = anaconda.id.storage.migratableDevices

	g = GridFormHelp(screen, _("Migrate File Systems"), "upmigfs", 1, 4)

	text = (_("This release of %(productName)s supports "
                 "the an updated file system, which has several "
                 "benefits over the file system traditionally shipped "
                 "in %(productName)s.  This installation program can migrate "
                 "formatted partitions without data loss.\n\n"
                 "Which of these partitions would you like to migrate?") %
                  {'productName': productName})

	tb = TextboxReflowed(60, text)
	g.add(tb, 0, 0, anchorLeft = 1, padding = (0, 0, 0, 1))

        partlist = CheckboxTree(height=4, scroll=1)
        for device in migent:
            if not device.format.exists:
                migrating = True
            else:
                migrating = False

            # FIXME: the fstype at least will be wrong here
            partlist.append("%s - %s - %s" % (device.path,
                                              device.format.type,
                                              device.format.mountpoint),
                                              device, migrating)

	g.add(partlist, 0, 1, padding = (0, 0, 0, 1))

	buttons = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON] )
	g.add(buttons, 0, 3, anchorLeft = 1, growx = 1)

	while True:
	    result = g.run()

	    if (buttons.buttonPressed(result)):
		result = buttons.buttonPressed(result)

	    if result == TEXT_BACK_CHECK:
		screen.popWindow()
		return INSTALL_BACK

            # Cancel any previously scheduled migrate actions first.
            for entry in partlist:
                actions = anaconda.id.storage.devicetree.findActions(device=entry[1],
                                                                     type="migrate")
                if not actions:
                    continue

                for action in actions:
                    anaconda.id.storage.devicetree.cancelAction(action)

            # Then schedule an action for whatever rows were selected.
            for entry in partlist.getSelection():
                newfs = getFormat(entry[1].format.migrationTarget)
                if not newfs:
                    log.warning("failed to get new filesystem type (%s)"
                                % entry[1].format.migrationTarget)
                    continue

                action = ActionMigrateFormat(entry[1])
                anaconda.id.storage.devicetree.registerAction(action)

            screen.popWindow()
            return INSTALL_OK
コード例 #6
0
def bindMountDevDirectory(instPath):
    getFormat("bind", device="/dev", mountpoint="/dev",
              exists=True).mount(chroot=instPath)
コード例 #7
0
    def __call__(self, screen, anaconda):
        migent = anaconda.id.storage.migratableDevices

        g = GridFormHelp(screen, _("Migrate File Systems"), "upmigfs", 1, 4)

        text = (_("This release of %(productName)s supports "
                  "the an updated file system, which has several "
                  "benefits over the file system traditionally shipped "
                  "in %(productName)s.  This installation program can migrate "
                  "formatted partitions without data loss.\n\n"
                  "Which of these partitions would you like to migrate?") % {
                      'productName': productName
                  })

        tb = TextboxReflowed(60, text)
        g.add(tb, 0, 0, anchorLeft=1, padding=(0, 0, 0, 1))

        partlist = CheckboxTree(height=4, scroll=1)
        for device in migent:
            if not device.format.exists:
                migrating = True
            else:
                migrating = False

            # FIXME: the fstype at least will be wrong here
            partlist.append(
                "%s - %s - %s" %
                (device.path, device.format.type, device.format.mountpoint),
                device, migrating)

        g.add(partlist, 0, 1, padding=(0, 0, 0, 1))

        buttons = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON])
        g.add(buttons, 0, 3, anchorLeft=1, growx=1)

        while True:
            result = g.run()

            if (buttons.buttonPressed(result)):
                result = buttons.buttonPressed(result)

            if result == TEXT_BACK_CHECK:
                screen.popWindow()
                return INSTALL_BACK

        # Cancel any previously scheduled migrate actions first.
            for entry in partlist:
                actions = anaconda.id.storage.devicetree.findActions(
                    device=entry[1], type="migrate")
                if not actions:
                    continue

                for action in actions:
                    anaconda.id.storage.devicetree.cancelAction(action)

        # Then schedule an action for whatever rows were selected.
            for entry in partlist.getSelection():
                newfs = getFormat(entry[1].format.migrationTarget)
                if not newfs:
                    log.warning("failed to get new filesystem type (%s)" %
                                entry[1].format.migrationTarget)
                    continue

                action = ActionMigrateFormat(entry[1])
                anaconda.id.storage.devicetree.registerAction(action)

            screen.popWindow()
            return INSTALL_OK
コード例 #8
0
ファイル: upgrade.py プロジェクト: BGS/rogentos-anaconda
def bindMountDevDirectory(instPath):
    getFormat("bind",
              device="/dev",
              mountpoint="/dev",
              exists=True).mount(chroot=instPath)
コード例 #9
0
    def __call__(self, screen, anaconda):

        migent = anaconda.id.storage.migratableDevices

        g = GridFormHelp(screen, _("Migrate File Systems"), "upmigfs", 1, 4)

        text = (_("This release of %(productName)s supports "
                  "the an updated file system, which has several "
                  "benefits over the file system traditionally shipped "
                  "in %(productName)s.  This installation program can migrate "
                  "formatted partitions without data loss.\n\n"
                  "Which of these partitions would you like to migrate?") % {
                      'productName': productName
                  })

        tb = TextboxReflowed(60, text)
        g.add(tb, 0, 0, anchorLeft=1, padding=(0, 0, 0, 1))

        partlist = CheckboxTree(height=4, scroll=1)
        for device in migent:
            if not device.format.exists:
                migrating = True
            else:
                migrating = False

            # FIXME: the fstype at least will be wrong here
            partlist.append(
                "%s - %s - %s" %
                (device.path, device.format.type, device.format.mountpoint),
                device, migrating)

        g.add(partlist, 0, 1, padding=(0, 0, 0, 1))

        buttons = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON])
        g.add(buttons, 0, 3, anchorLeft=1, growx=1)

        while 1:
            result = g.run()

            if (buttons.buttonPressed(result)):
                result = buttons.buttonPressed(result)

            if result == TEXT_BACK_CHECK:
                screen.popWindow()
                return INSTALL_BACK

        # reset
        # XXX the way to do this is by scheduling and cancelling actions
        #for entry in migent:
        #    entry.setFormat(0)
        #    entry.setMigrate(0)
        #    entry.fsystem = entry.origfsystem

            for entry in partlist.getSelection():
                try:
                    newfs = getFormat(entry.format.migratetofs[0])
                except Exception, e:
                    log.info(
                        "failed to get new filesystem type, defaulting to ext3: %s"
                        % (e, ))
                    newfs = getFormat("ext3")
                    anaconda.id.storage.migrateFormat(entry, newfs)

            screen.popWindow()
            return INSTALL_OK
コード例 #10
0
ファイル: upgrade_text.py プロジェクト: BGS/rogentos-anaconda
    def __call__ (self, screen, anaconda):
      
        migent = anaconda.storage.migratableDevices

	g = GridFormHelp(screen, _("Migrate File Systems"), "upmigfs", 1, 4)

	text = (_("This release of %(productName)s supports "
                 "an updated file system, which has several "
                 "benefits over the file system traditionally shipped "
                 "in %(productName)s.  This installation program can migrate "
                 "formatted partitions without data loss.\n\n"
                 "Which of these partitions would you like to migrate?") %
                  {'productName': productName})

	tb = TextboxReflowed(60, text)
	g.add(tb, 0, 0, anchorLeft = 1, padding = (0, 0, 0, 1))

        partlist = CheckboxTree(height=4, scroll=1)
        for device in migent:
            if not device.format.exists:
                migrating = True
            else:
                migrating = False

            # FIXME: the fstype at least will be wrong here
            partlist.append("%s - %s - %s" % (device.path,
                                              device.format.type,
                                              device.format.mountpoint),
                                              device, migrating)
            
	g.add(partlist, 0, 1, padding = (0, 0, 0, 1))
        
	buttons = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON] )
	g.add(buttons, 0, 3, anchorLeft = 1, growx = 1)

	while 1:
	    result = g.run()
        
	    if (buttons.buttonPressed(result)):
		result = buttons.buttonPressed(result)

	    if result == TEXT_BACK_CHECK:
		screen.popWindow()
		return INSTALL_BACK

            # reset
            # XXX the way to do this is by scheduling and cancelling actions
            #for entry in migent:
            #    entry.setFormat(0)
            #    entry.setMigrate(0)
            #    entry.fsystem = entry.origfsystem

            for entry in partlist.getSelection():
                try:
                    newfs = getFormat(entry.format.migratetofs[0])
                except Exception, e:
                    log.info("failed to get new filesystem type, defaulting to ext3: %s" %(e,))
                    newfs = getFormat("ext3")
                    anaconda.storage.migrateFormat(entry, newfs)

            screen.popWindow()
            return INSTALL_OK