Ejemplo n.º 1
0
def upgradeSwapSuggestion(anaconda):
    # mem is in kb -- round it up to the nearest 4Mb
    mem = iutil.memInstalled()
    rem = mem % 16384
    if rem:
        mem = mem + (16384 - rem)
    mem = mem / 1024

    anaconda.dispatch.skipStep("addswap", 0)

    # don't do this if we have more then 250 MB
    if mem > 250:
        anaconda.dispatch.skipStep("addswap", 1)
        return

    swap = iutil.swapAmount() / 1024

    # if we have twice as much swap as ram and at least 192 megs
    # total, we're safe
    if (swap >= (mem * 1.5)) and (swap + mem >= 192):
        anaconda.dispatch.skipStep("addswap", 1)
        return

    # if our total is 512 megs or more, we should be safe
    if (swap + mem >= 512):
        anaconda.dispatch.skipStep("addswap", 1)
        return

    fsList = []

    for device in anaconda.id.storage.fsset.devices:
        if not device.format:
            continue
        if device.format.mountable and device.format.linuxNative:
            if not device.format.status:
                continue
            space = isys.pathSpaceAvailable(anaconda.rootPath +
                                            device.format.mountpoint)
            if space > 16:
                info = (device, space)
                fsList.append(info)

    suggestion = mem * 2 - swap
    if (swap + mem + suggestion) < 192:
        suggestion = 192 - (swap + mem)
    if suggestion < 32:
        suggestion = 32
    suggSize = 0
    suggMnt = None
    for (device, size) in fsList:
        if (size > suggSize) and (size > (suggestion + 100)):
            suggDev = device

    anaconda.id.upgradeSwapInfo = (fsList, suggestion, suggDev)
Ejemplo n.º 2
0
def upgradeSwapSuggestion(anaconda):
    # mem is in kb -- round it up to the nearest 4Mb
    mem = iutil.memInstalled()
    rem = mem % 16384
    if rem:
	mem = mem + (16384 - rem)
    mem = mem / 1024

    anaconda.dispatch.skipStep("addswap", 0)
    
    # don't do this if we have more then 250 MB
    if mem > 250:
        anaconda.dispatch.skipStep("addswap", 1)
        return
    
    swap = iutil.swapAmount() / 1024

    # if we have twice as much swap as ram and at least 192 megs
    # total, we're safe 
    if (swap >= (mem * 1.5)) and (swap + mem >= 192):
        anaconda.dispatch.skipStep("addswap", 1)
	return

    # if our total is 512 megs or more, we should be safe
    if (swap + mem >= 512):
        anaconda.dispatch.skipStep("addswap", 1)
	return

    fsList = []

    for device in anaconda.storage.fsset.devices:
        if not device.format:
            continue
        if device.format.mountable and device.format.linuxNative:
            if not device.format.status:
                continue
            space = isys.pathSpaceAvailable(anaconda.rootPath + device.format.mountpoint)
            if space > 16:
                info = (device, space)
                fsList.append(info)

    suggestion = mem * 2 - swap
    if (swap + mem + suggestion) < 192:
        suggestion = 192 - (swap + mem)
    if suggestion < 32:
        suggestion = 32
    suggSize = 0
    suggMnt = None
    for (device, size) in fsList:
	if (size > suggSize) and (size > (suggestion + 100)):
	    suggDev = device

    anaconda.upgradeSwapInfo = (fsList, suggestion, suggDev)
Ejemplo n.º 3
0
def upgradeSwapSuggestion(anaconda):
    # mem is in kb -- round it up to the nearest 4Mb
    mem = iutil.memInstalled()
    rem = mem % 16384
    if rem:
        mem = mem + (16384 - rem)
    mem = mem / 1024

    anaconda.dispatch.skipStep("addswap", 0)

    # don't do this if we have more then 250 MB
    if mem > 250:
        anaconda.dispatch.skipStep("addswap", 1)
        return

    swap = iutil.swapAmount() / 1024

    # if we have twice as much swap as ram and at least 192 megs
    # total, we're safe
    if (swap >= (mem * 1.5)) and (swap + mem >= 192):
        anaconda.dispatch.skipStep("addswap", 1)
        return

    # if our total is 512 megs or more, we should be safe
    if (swap + mem >= 512):
        anaconda.dispatch.skipStep("addswap", 1)
        return

    fsList = []

    for entry in anaconda.id.fsset.entries:
        if entry.fsystem.getName() in getUsableLinuxFs():
            if flags.setupFilesystems and not entry.isMounted():
                continue
            space = isys.pathSpaceAvailable(anaconda.rootPath +
                                            entry.mountpoint)
            if space > 16:
                info = (entry.mountpoint, entry.device.getDevice(), space)
                fsList.append(info)

    suggestion = mem * 2 - swap
    if (swap + mem + suggestion) < 192:
        suggestion = 192 - (swap + mem)
    if suggestion < 32:
        suggestion = 32
    suggSize = 0
    suggMnt = None
    for (mnt, part, size) in fsList:
        if (size > suggSize) and (size > (suggestion + 100)):
            suggMnt = mnt

    anaconda.id.upgradeSwapInfo = (fsList, suggestion, suggMnt)
Ejemplo n.º 4
0
def upgradeSwapSuggestion(anaconda):
    # mem is in kb -- round it up to the nearest 4Mb
    mem = iutil.memInstalled()
    rem = mem % 16384
    if rem:
	mem = mem + (16384 - rem)
    mem = mem / 1024

    anaconda.dispatch.skipStep("addswap", 0)
    
    # don't do this if we have more then 250 MB
    if mem > 250:
        anaconda.dispatch.skipStep("addswap", 1)
        return
    
    swap = iutil.swapAmount() / 1024

    # if we have twice as much swap as ram and at least 192 megs
    # total, we're safe 
    if (swap >= (mem * 1.5)) and (swap + mem >= 192):
        anaconda.dispatch.skipStep("addswap", 1)
	return

    # if our total is 512 megs or more, we should be safe
    if (swap + mem >= 512):
        anaconda.dispatch.skipStep("addswap", 1)
	return

    fsList = []

    for entry in anaconda.id.fsset.entries:
        if entry.fsystem.getName() in getUsableLinuxFs():
            if flags.setupFilesystems and not entry.isMounted():
                continue
            space = isys.pathSpaceAvailable(anaconda.rootPath + entry.mountpoint)
            if space > 16:
                info = (entry.mountpoint, entry.device.getDevice(), space)
                fsList.append(info)

    suggestion = mem * 2 - swap
    if (swap + mem + suggestion) < 192:
        suggestion = 192 - (swap + mem)
    if suggestion < 32:
        suggestion = 32
    suggSize = 0
    suggMnt = None
    for (mnt, part, size) in fsList:
	if (size > suggSize) and (size > (suggestion + 100)):
	    suggMnt = mnt

    anaconda.id.upgradeSwapInfo = (fsList, suggestion, suggMnt)
Ejemplo n.º 5
0
    def __call__ (self, screen, anaconda):
	(fsList, suggSize, suggDev) = anaconda.id.upgradeSwapInfo

        ramDetected = iutil.memInstalled()/1024

	text = _("Recent kernels (2.4 or newer) need significantly more swap than older "
		 "kernels, up to twice the amount of RAM on the "
		 "system.  You currently have %dMB of swap configured, but "
		 "you may create additional swap space on one of your "
		 "file systems now.") % (iutil.swapAmount() / 1024)

	tb = TextboxReflowed(60, text)
	amount = Entry(10, scroll = 0)
	amount.set(str(suggSize))

	l = len(fsList)
	scroll = 0
	if l > 4:
	    l = 4
	    scroll = 1
	listbox = Listbox(l, scroll = scroll)

	liLabel = Label("%-25s %-15s %8s" % (_("Mount Point"), 
			_("Partition"), _("Free Space")))

	count = 0
	for (device, size) in fsList:
	    listbox.append("%-25s %-15s %6dMB" % (device.format.mountpoint,
                                                  device.path,
                                                  size),
                                                  count)

	    if (device == suggDev):
		listbox.setCurrent(count)

	    count = count + 1

	buttons = ButtonBar(screen, [TEXT_OK_BUTTON, (_("Skip"), "skip"),  
			    TEXT_BACK_BUTTON] )

	amGrid = Grid(2, 3)
	amGrid.setField(Label(_("RAM detected (MB):")), 0, 0, anchorLeft = 1,
			padding = (0, 0, 1, 0))
	amGrid.setField(Label(str(ramDetected)), 1, 0, anchorLeft = 1)
	amGrid.setField(Label(_("Suggested size (MB):")), 0, 1, anchorLeft = 1,
			padding = (0, 0, 1, 0))
	amGrid.setField(Label(str(suggSize)), 1, 1, anchorLeft = 1)
	amGrid.setField(Label(_("Swap file size (MB):")), 0, 2, anchorLeft = 1,
			padding = (0, 0, 1, 0))
	amGrid.setField(amount, 1, 2)
	
	liGrid = Grid(1, 2)
	liGrid.setField(liLabel, 0, 0)
	liGrid.setField(listbox, 0, 1)

	g = GridFormHelp(screen, _("Add Swap"), "upgradeswap", 1, 4)
	g.add(tb, 0, 0, anchorLeft = 1, padding = (0, 0, 0, 1))
	g.add(amGrid, 0, 1, padding = (0, 0, 0, 1))
	g.add(liGrid, 0, 2, padding = (0, 0, 0, 1))
	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
	    elif result == "skip":
		screen.popWindow()
		return INSTALL_OK

	    val = amount.value()
            
	    try:
		val = int(val)
	    except ValueError:
		anaconda.intf.messageWindow(_("Error"),
                                   _("The value you entered is not a "
                                     "valid number."))

	    if type(val) == type(1):
		(dev, size) = fsList[listbox.current()]
		if size < (val + 16):
		    anaconda.intf.messageWindow(_("Error"),
                                       _("There is not enough space on the "
                                         "device you selected for the swap "
                                         "partition."))
                elif val > 2000 or val < 1:
                    anaconda.intf.messageWindow(_("Warning"), 
                                       _("The swap file must be between 1 "
                                         "and 2000 MB in size."))
		else:
		    screen.popWindow()
                    anaconda.id.storage.createSwapFile(dev, val)
                    anaconda.dispatch.skipStep("addswap", 1)
		    return INSTALL_OK

	raise ValueError
Ejemplo n.º 6
0
    def __call__(self, screen, anaconda):
        (fsList, suggSize, suggMntPoint) = anaconda.id.upgradeSwapInfo

        ramDetected = iutil.memInstalled() / 1024

        text = _("The 2.4 kernel needs significantly more swap than older "
                 "kernels, as much as twice as much swap space as RAM on the "
                 "system. You currently have %dMB of swap configured, but "
                 "you may create additional swap space on one of your "
                 "file systems now.") % (iutil.swapAmount() / 1024)

        tb = TextboxReflowed(60, text)
        amount = Entry(10, scroll=0)
        amount.set(str(suggSize))

        l = len(fsList)
        scroll = 0
        if l > 4:
            l = 4
            scroll = 1
        listbox = Listbox(l, scroll=scroll)

        liLabel = Label("%-25s %-15s %8s" %
                        (_("Mount Point"), _("Partition"), _("Free Space")))

        count = 0
        for (mnt, part, size) in fsList:
            listbox.append("%-25s /dev/%-10s %6dMB" % (mnt, part, size), count)

            if (mnt == suggMntPoint):
                listbox.setCurrent(count)

            count = count + 1

        buttons = ButtonBar(
            screen, [TEXT_OK_BUTTON, (_("Skip"), "skip"), TEXT_BACK_BUTTON])

        amGrid = Grid(2, 3)
        amGrid.setField(Label(_("RAM detected (MB):")),
                        0,
                        0,
                        anchorLeft=1,
                        padding=(0, 0, 1, 0))
        amGrid.setField(Label(str(ramDetected)), 1, 0, anchorLeft=1)
        amGrid.setField(Label(_("Suggested size (MB):")),
                        0,
                        1,
                        anchorLeft=1,
                        padding=(0, 0, 1, 0))
        amGrid.setField(Label(str(suggSize)), 1, 1, anchorLeft=1)
        amGrid.setField(Label(_("Swap file size (MB):")),
                        0,
                        2,
                        anchorLeft=1,
                        padding=(0, 0, 1, 0))
        amGrid.setField(amount, 1, 2)

        liGrid = Grid(1, 2)
        liGrid.setField(liLabel, 0, 0)
        liGrid.setField(listbox, 0, 1)

        g = GridFormHelp(screen, _("Add Swap"), "upgradeswap", 1, 4)
        g.add(tb, 0, 0, anchorLeft=1, padding=(0, 0, 0, 1))
        g.add(amGrid, 0, 1, padding=(0, 0, 0, 1))
        g.add(liGrid, 0, 2, padding=(0, 0, 0, 1))
        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
            elif result == "skip":
                screen.popWindow()
                return INSTALL_OK

            val = amount.value()

            try:
                val = int(val)
            except ValueError:
                anaconda.intf.messageWindow(
                    _("Error"),
                    _("The value you entered is not a "
                      "valid number."))

            if type(val) == type(1):
                (mnt, part, size) = fsList[listbox.current()]
                if size < (val + 16):
                    anaconda.intf.messageWindow(
                        _("Error"),
                        _("There is not enough space on the "
                          "device you selected for the swap "
                          "partition."))
                elif val > 2000 or val < 1:
                    anaconda.intf.messageWindow(
                        _("Warning"),
                        _("The swap file must be between 1 "
                          "and 2000 MB in size."))
                else:
                    screen.popWindow()
                    if flags.setupFilesystems:
                        upgrade.createSwapFile(anaconda.rootPath,
                                               anaconda.id.fsset, mnt, val)
                    anaconda.dispatch.skipStep("addswap", 1)
                    return INSTALL_OK

        raise ValueError
Ejemplo n.º 7
0
            if vncS.vncconnectport == "":
                vncS.vncconnectport = ksdata.vnc.port

        flags.vncquestion = False

    #
    # Determine install method - GUI or TUI
    #
    # if display_mode wasnt set by command line parameters then set default
    #
    if not opts.display_mode:
        opts.display_mode = 'g'

    # disable VNC over text question when not enough memory is available
    if iutil.memInstalled() < isys.MIN_GUI_RAM:
        flags.vncquestion = False

    if os.environ.has_key('DISPLAY'):
        flags.preexisting_x11 = True

    if opts.display_mode == 't' and flags.vncquestion:  #we prefer vnc over text mode, so ask about that
        title = _("Would you like to use VNC?")
        message = _(
            "Text mode provides a limited set of installation options.  "
            "It does not allow you to specify your own partitioning "
            "layout or package selections.  Would you like to use VNC "
            "mode instead?")

        ret = vnc.askVncWindow(title, message)
        if ret != -1:
Ejemplo n.º 8
0
    def sanityCheckAllRequests(self, diskset, baseChecks=0):
        """Do a sanity check of all of the requests.

        This function is called at the end of partitioning so that we
        can make sure you don't have anything silly (like no /, a really
        small /, etc).  Returns (errors, warnings) where each is a list
        of strings or None if there are none.
        If baseChecks is set, the basic sanity tests which the UI runs prior to
        accepting a partition will be run on the requests as well.
        """
        checkSizes = [('/usr', 250), ('/tmp', 50), ('/var', 384),
                      ('/home', 100), ('/boot', 75)]
        warnings = []
        errors = []

        slash = self.getRequestByMountPoint('/')
        if not slash:
            errors.append(
                _("You have not defined a root partition (/), "
                  "which is required for installation of %s "
                  "to continue.") % (productName, ))

        if slash and slash.getActualSize(self, diskset) < 250:
            warnings.append(
                _("Your root partition is less than 250 "
                  "megabytes which is usually too small to "
                  "install %s.") % (productName, ))

        if iutil.getArch() == "ia64":
            bootreq = self.getRequestByMountPoint("/boot/efi")
            if not bootreq or bootreq.getActualSize(self, diskset) < 50:
                errors.append(
                    _("You must create a /boot/efi partition of "
                      "type FAT and a size of 50 megabytes."))

        if (iutil.getPPCMachine() == "pSeries"
                or iutil.getPPCMachine() == "iSeries"):
            reqs = self.getBootableRequest()
            found = 0

            bestreq = None
            if reqs:
                for req in reqs:
                    if req.fstype == fsset.fileSystemTypeGet("PPC PReP Boot"):
                        found = 1
                        # the best one is either the first or the first
                        # newly formatted one
                        if ((bestreq is None) or ((bestreq.format == 0) and
                                                  (req.format == 1))):
                            bestreq = req
                        break
            if iutil.getPPCMachine() == "iSeries" and iutil.hasIbmSis():
                found = 1

            if not found:
                errors.append(_("You must create a PPC PReP Boot partition."))

            if bestreq is not None:
                if (iutil.getPPCMachine() == "pSeries"):
                    minsize = 4
                else:
                    minsize = 16
                if bestreq.getActualSize(self, diskset) < minsize:
                    warnings.append(
                        _("Your %s partition is less than %s "
                          "megabytes which is lower than "
                          "recommended for a normal %s install.") %
                        (_("PPC PReP Boot"), minsize, productName))

        for (mount, size) in checkSizes:
            req = self.getRequestByMountPoint(mount)
            if not req:
                continue
            if req.getActualSize(self, diskset) < size:
                warnings.append(
                    _("Your %s partition is less than %s "
                      "megabytes which is lower than recommended "
                      "for a normal %s install.") % (mount, size, productName))

        foundSwap = 0
        swapSize = 0
        for request in self.requests:
            if request.fstype and request.fstype.getName() == "swap":
                foundSwap = foundSwap + 1
                swapSize = swapSize + request.getActualSize(self, diskset)
            if baseChecks:
                rc = request.doSizeSanityCheck()
                if rc:
                    warnings.append(rc)
                rc = request.doMountPointLinuxFSChecks()
                if rc:
                    errors.append(rc)
                if isinstance(request, partRequests.RaidRequestSpec):
                    rc = request.sanityCheckRaid(self)
                    if rc:
                        errors.append(rc)

        bootreqs = self.getBootableRequest()
        if bootreqs:
            for bootreq in bootreqs:
                if (bootreq
                        and (isinstance(bootreq, partRequests.RaidRequestSpec))
                        and (not raid.isRaid1(bootreq.raidlevel))):
                    errors.append(
                        _("Bootable partitions can only be on RAID1 "
                          "devices."))

                # can't have bootable partition on LV
                if (bootreq and (isinstance(
                        bootreq, partRequests.LogicalVolumeRequestSpec))):
                    errors.append(
                        _("Bootable partitions cannot be on a "
                          "logical volume."))

                # most arches can't have boot on RAID
                if (bootreq
                        and (isinstance(bootreq, partRequests.RaidRequestSpec))
                        and (iutil.getArch() not in raid.raidBootArches)):
                    errors.append("Bootable partitions cannot be on a RAID "
                                  "device.")

        if foundSwap == 0:
            warnings.append(
                _("You have not specified a swap partition.  "
                  "Although not strictly required in all cases, "
                  "it will significantly improve performance for "
                  "most installations."))

        # XXX number of swaps not exported from kernel and could change
        if foundSwap >= 32:
            warnings.append(
                _("You have specified more than 32 swap devices.  "
                  "The kernel for %s only supports 32 "
                  "swap devices.") % (productName, ))

        mem = iutil.memInstalled()
        rem = mem % 16384
        if rem:
            mem = mem + (16384 - rem)
        mem = mem / 1024

        if foundSwap and (swapSize < (mem - 8)) and (mem < 1024):
            warnings.append(
                _("You have allocated less swap space (%dM) than "
                  "available RAM (%dM) on your system.  This "
                  "could negatively impact performance.") % (swapSize, mem))

        if warnings == []:
            warnings = None
        if errors == []:
            errors = None

        return (errors, warnings)
Ejemplo n.º 9
0
            if vncS.vncconnectport == "":
                vncS.vncconnectport = ksdata.vnc.port

        flags.vncquestion = False

    #
    # Determine install method - GUI or TUI
    #
    # if display_mode wasnt set by command line parameters then set default
    #
    if not opts.display_mode:
        opts.display_mode = 'g'
    
    # disable VNC over text question when not enough memory is available
    if iutil.memInstalled() < isys.MIN_GUI_RAM:
        flags.vncquestion = False

    if os.environ.has_key('DISPLAY'):
        flags.preexisting_x11 = True

    if opts.display_mode == 't' and flags.vncquestion: #we prefer vnc over text mode, so ask about that
        title = _("Would you like to use VNC?")
        message = _("Text mode provides a limited set of installation options.  "
                    "It does not allow you to specify your own partitioning "
                    "layout or package selections.  Would you like to use VNC "
                    "mode instead?")

        ret = vnc.askVncWindow(title, message)
        if ret != -1:
            opts.display_mode = 'g'
Ejemplo n.º 10
0
    def getScreen(self, anaconda):
        self.neededSwap = 0
        self.storage = anaconda.storage
        self.intf = anaconda.intf
        self.dispatch = anaconda.dispatch

        rc = anaconda.upgradeSwapInfo

        self.neededSwap = 1
        self.row = 0
        box = gtk.VBox(False, 5)
        box.set_border_width(5)

        label = gtk.Label(
            _("Recent kernels (2.4 or newer) need significantly more "
              "swap than older kernels, up to twice "
              "the amount of RAM on the system.  "
              "You currently have %dMB of swap configured, but "
              "you may create additional swap space on one of "
              "your file systems now.") % (iutil.swapAmount() / 1024) +
            _("\n\nThe installer has detected %s MB of RAM.\n") %
            (iutil.memInstalled() / 1024))

        label.set_alignment(0.5, 0.0)
        #        label.set_size_request(400, 200)
        label.set_line_wrap(True)
        box.pack_start(label, False)

        hs = gtk.HSeparator()
        box.pack_start(hs, False)

        self.option1 = gtk.RadioButton(None,
                                       (_("I _want to create a swap file")))
        box.pack_start(self.option1, False)

        (fsList, suggSize, suggMntPoint) = rc

        self.swapbox = gtk.VBox(False, 5)
        box.pack_start(self.swapbox, False)

        label = gui.MnemonicLabel(
            _("Select the _partition to put the swap file on:"))
        a = gtk.Alignment(0.2, 0.5)
        a.add(label)
        self.swapbox.pack_start(a, False)

        self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
                                   gobject.TYPE_STRING)

        for (dev, size) in fsList:
            iter = self.store.append()
            self.store.set_value(iter, 0, dev)
            self.store.set_value(iter, 1, str(size))

        self.view = gtk.TreeView(self.store)
        label.set_mnemonic_widget(self.view)

        i = 0
        for title in [(_("Mount Point")), (_("Partition")),
                      (_("Free Space (MB)"))]:
            col = gtk.TreeViewColumn(title, gtk.CellRendererText(), text=i)
            self.view.append_column(col)
            i = i + 1

        sw = gtk.ScrolledWindow()
        sw.add(self.view)
        sw.set_shadow_type(gtk.SHADOW_IN)
        sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        sw.set_size_request(300, 90)
        a = gtk.Alignment(0.5, 0.5)
        a.add(sw)
        self.swapbox.pack_start(a, False, True, 10)

        rootiter = self.store.get_iter_first()
        sel = self.view.get_selection()
        sel.select_iter(rootiter)

        label = gtk.Label(
            _("A minimum swap file size of "
              "%d MB is recommended.  Please enter a size for the swap "
              "file:") % suggSize)
        label.set_size_request(400, 40)
        label.set_line_wrap(True)
        a = gtk.Alignment(0.5, 0.5)
        a.add(label)
        self.swapbox.pack_start(a, False, True, 10)

        hbox = gtk.HBox(False, 5)
        a = gtk.Alignment(0.4, 0.5)
        a.add(hbox)
        self.swapbox.pack_start(a, False)

        label = gui.MnemonicLabel(_("Swap file _size (MB):"))
        hbox.pack_start(label, False)

        self.entry = gtk.Entry(4)
        label.set_mnemonic_widget(self.entry)
        self.entry.set_size_request(40, 25)
        self.entry.set_text(str(suggSize))
        hbox.pack_start(self.entry, False, True, 10)

        self.option2 = gtk.RadioButton(self.option1,
                                       (_("I _don't want to create a swap "
                                          "file")))
        box.pack_start(self.option2, False, True, 20)

        self.option1.connect("toggled", self.toggle)
        return box
Ejemplo n.º 11
0
    def getScreen (self, anaconda):
        self.neededSwap = 0
        self.storage = anaconda.id.storage
        self.intf = anaconda.intf
        self.dispatch = anaconda.dispatch
        
        rc = anaconda.id.upgradeSwapInfo

        self.neededSwap = 1
        self.row = 0
        box = gtk.VBox (False, 5)
        box.set_border_width (5)

	label = gtk.Label (_("Recent kernels (2.4 or newer) need significantly more "
                            "swap than older kernels, up to twice "
                            "the amount of RAM on the system.  "
                            "You currently have %dMB of swap configured, but "
                            "you may create additional swap space on one of "
                            "your file systems now.")
                          % (iutil.swapAmount() / 1024) +
                          _("\n\nThe installer has detected %s MB of RAM.\n") %
                          (iutil.memInstalled()/1024))

        label.set_alignment (0.5, 0.0)
#        label.set_size_request(400, 200)
        label.set_line_wrap (True)
        box.pack_start(label, False)

        hs = gtk.HSeparator()
        box.pack_start(hs, False)

        self.option1 = gtk.RadioButton(None,
                                      (_("I _want to create a swap file")))
        box.pack_start(self.option1, False)

        (fsList, suggSize, suggMntPoint) = rc

        self.swapbox = gtk.VBox(False, 5)
        box.pack_start(self.swapbox, False)
        

        label = gui.MnemonicLabel (_("Select the _partition to put the swap file on:"))
        a = gtk.Alignment(0.2, 0.5)
        a.add(label)
        self.swapbox.pack_start(a, False)

	self.store = gtk.ListStore(gobject.TYPE_STRING,
				   gobject.TYPE_STRING,
				   gobject.TYPE_STRING)

        for (dev, size) in fsList:
	    iter = self.store.append()
	    self.store.set_value(iter, 0, dev)
	    self.store.set_value(iter, 1, str(size))

	self.view=gtk.TreeView(self.store)
        label.set_mnemonic_widget(self.view)

	i = 0
	for title in [(_("Mount Point")), (_("Partition")), (_("Free Space (MB)"))]:
	    col = gtk.TreeViewColumn(title, gtk.CellRendererText(), text=i)
	    self.view.append_column(col)
	    i = i + 1

	sw = gtk.ScrolledWindow()
	sw.add(self.view)
	sw.set_shadow_type(gtk.SHADOW_IN)
	sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
	sw.set_size_request(300, 90)
	a = gtk.Alignment(0.5, 0.5)
        a.add(sw)
        self.swapbox.pack_start(a, False, True, 10)

	rootiter = self.store.get_iter_first()
	sel = self.view.get_selection()
	sel.select_iter(rootiter)

        label = gtk.Label (_("A minimum swap file size of "
                            "%d MB is recommended.  Please enter a size for the swap "
                            "file:") % suggSize)
        label.set_size_request(400, 40)
        label.set_line_wrap (True)
        a = gtk.Alignment(0.5, 0.5)
        a.add(label)
        self.swapbox.pack_start(a, False, True, 10)


        hbox = gtk.HBox(False, 5)
        a = gtk.Alignment(0.4, 0.5)
        a.add(hbox)
        self.swapbox.pack_start(a, False)

        label = gui.MnemonicLabel (_("Swap file _size (MB):"))
        hbox.pack_start(label, False)

        self.entry = gtk.Entry(4)
        label.set_mnemonic_widget(self.entry)
        self.entry.set_size_request(40, 25)
        self.entry.set_text(str(suggSize))
        hbox.pack_start(self.entry, False, True, 10)

        self.option2 = gtk.RadioButton(self.option1,
                                      (_("I _don't want to create a swap "
                                         "file")))
        box.pack_start(self.option2, False, True, 20)

        self.option1.connect("toggled", self.toggle)
        return box
Ejemplo n.º 12
0
    def getScreen(self, intf, fsset, instPath, swapInfo, dispatch):

        #
        # use to test function
        #
        #	fslist = [('/', 'hda1', 1000)]
        #	fslist.append(('/var', 'hda2', 100))
        #	fslist.append(('/opt', 'hda3', 500))
        #	swapInfo = (fslist, 1000, '/var')

        self.neededSwap = 0
        self.fsset = fsset
        self.instPath = instPath
        self.intf = intf
        self.dispatch = dispatch

        rc = swapInfo

        self.neededSwap = 1
        self.row = 0
        box = gtk.VBox(gtk.FALSE, 5)
        box.set_border_width(5)

        label = gtk.Label(
            _("The 2.4 kernel needs significantly more "
              "swap than older kernels, as much as twice "
              "as much swap space as RAM on the system.  "
              "You currently have %dMB of swap configured, but "
              "you may create additional swap space on one of "
              "your file systems now.") % (iutil.swapAmount() / 1024) +
            _("\n\nThe installer has detected %s MB of RAM.\n") %
            (iutil.memInstalled() / 1024))

        label.set_alignment(0.5, 0.0)
        #        label.set_size_request(400, 200)
        label.set_line_wrap(gtk.TRUE)
        box.pack_start(label, gtk.FALSE)

        hs = gtk.HSeparator()
        box.pack_start(hs, gtk.FALSE)

        self.option1 = gtk.RadioButton(None,
                                       (_("I _want to create a swap file")))
        box.pack_start(self.option1, gtk.FALSE)

        (fsList, suggSize, suggMntPoint) = rc

        self.swapbox = gtk.VBox(gtk.FALSE, 5)
        box.pack_start(self.swapbox, gtk.FALSE)

        label = gui.MnemonicLabel(
            _("Select the _partition to put the swap file on:"))
        a = gtk.Alignment(0.2, 0.5)
        a.add(label)
        self.swapbox.pack_start(a, gtk.FALSE)

        self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
                                   gobject.TYPE_STRING)

        for (mnt, part, size) in fsList:
            iter = self.store.append()
            self.store.set_value(iter, 0, mnt)
            self.store.set_value(iter, 1, part)
            self.store.set_value(iter, 2, str(size))

        self.view = gtk.TreeView(self.store)
        label.set_mnemonic_widget(self.view)

        i = 0
        for title in [(_("Mount Point")), (_("Partition")),
                      (_("Free Space (MB)"))]:
            col = gtk.TreeViewColumn(title, gtk.CellRendererText(), text=i)
            self.view.append_column(col)
            i = i + 1

        sw = gtk.ScrolledWindow()
        sw.add(self.view)
        sw.set_shadow_type(gtk.SHADOW_IN)
        sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        sw.set_size_request(300, 90)
        a = gtk.Alignment(0.5, 0.5)
        a.add(sw)
        self.swapbox.pack_start(a, gtk.FALSE, gtk.TRUE, 10)

        rootiter = self.store.get_iter_first()
        sel = self.view.get_selection()
        sel.select_iter(rootiter)

        label = gtk.Label(
            _("It is recommended that your swap file be at "
              "least %d MB.  Please enter a size for the swap "
              "file:") % suggSize)
        label.set_size_request(400, 40)
        label.set_line_wrap(gtk.TRUE)
        a = gtk.Alignment(0.5, 0.5)
        a.add(label)
        self.swapbox.pack_start(a, gtk.FALSE, gtk.TRUE, 10)

        hbox = gtk.HBox(gtk.FALSE, 5)
        a = gtk.Alignment(0.4, 0.5)
        a.add(hbox)
        self.swapbox.pack_start(a, gtk.FALSE)

        label = gui.MnemonicLabel(_("Swap file _size (MB):"))
        hbox.pack_start(label, gtk.FALSE)

        self.entry = gtk.Entry(4)
        label.set_mnemonic_widget(self.entry)
        self.entry.set_size_request(40, 25)
        self.entry.set_text(str(suggSize))
        hbox.pack_start(self.entry, gtk.FALSE, gtk.TRUE, 10)

        self.option2 = gtk.RadioButton(self.option1,
                                       (_("I _don't want to create a swap "
                                          "file")))
        box.pack_start(self.option2, gtk.FALSE, gtk.TRUE, 20)

        self.option1.connect("toggled", self.toggle)
        return box