示例#1
0
    def getNext(self):
        if iutil.getArch() == "alpha" or iutil.getArch() == "ia64":
            return None

        if self.skipDisk.get_active():
            self.dispatch.skipStep("makebootdisk")
        else:
            self.dispatch.skipStep("makebootdisk", skip=0)

        return None
示例#2
0
 def openDevices (self, intf = None, initAll = 0,
                  zeroMbr = 0, clearDevs = []):
     """Open the disks on the system and skip unopenable devices."""
     if self.disks:
         return
     for drive in self.driveList ():
         if drive in DiskSet.skippedDisks and not initAll:
             continue
         deviceFile = isys.makeDevInode(drive)
         if isys.driveIsRemovable(drive) and not flags.expert:
             DiskSet.skippedDisks.append(drive)
             continue
         # FIXME: need the right fix for z/VM formatted dasd
         if 0 and iutil.getArch() == "s390":
             rc = intf.messageWindow(_("Warning"),
                     _("The partition table on device %s was unreadable. "
                       "To create new partitions it must be initialized, "
                       "causing the loss of ALL DATA on this drive.\n\n"
                       "This operation will override any previous "
                       "installation choices about which drives to "
                       "ignore.\n\n"
                       "Would you like to initialize this drive, "
                       "erasing ALL DATA?")
                                     % (drive,), type = "yesno")
             if rc == 0:
                 DiskSet.skippedDisks.append(drive)
                 continue
             else:
                 if (self.dasdFmt(intf, drive)):
                     DiskSet.skippedDisks.append(drive)
                     continue
             
         try:
             dev = parted.PedDevice.get (deviceFile)
         except parted.error, msg:
             DiskSet.skippedDisks.append(drive)
             continue
         
         if (initAll and ((clearDevs is None) or (len(clearDevs) == 0)
                          or drive in clearDevs) and not flags.test):
             if iutil.getArch() == "s390":
                 if (self.dasdFmt(intf, drive)):
                     DiskSet.skippedDisks.append(drive)
                     continue                    
             else:
                 try:
                     disk = dev.disk_new_fresh(getDefaultDiskType())
                     disk.commit()
                     self.disks[drive] = disk
                 except parted.error, msg:
                     DiskSet.skippedDisks.append(drive)
                     continue
示例#3
0
    def __call__(self, screen):
        bootstr = ""

        if iutil.getArch() == "s390":
            floppystr = _("Press <Enter> to end the installation process.\n\n")
            bottomstr = _("<Enter> to exit")
        else:
            floppystr = _("Remove any installation media (diskettes or "
                          "CD-ROMs) used during the installation process "
                          "and press <Enter> to reboot your system."
                          "\n\n")
            bottomstr = _("<Enter> to reboot")

        screen.pushHelpLine(string.center(bottomstr, screen.width))

        txt = _("Congratulations, your %s installation is "
                "complete.\n\n"
                "%s%s") % (productName, floppystr, bootstr)
        foo = _("For information on errata (updates and bug fixes), visit "
                "http://www.redhat.com/errata/.\n\n"
                "Information on using your "
                "system is available in the %s manuals at "
                "http://www.redhat.com/docs/.") % (productName, )

        rc = ButtonChoiceWindow(screen,
                                _("Complete"),
                                txt, [_("Reboot")],
                                help="finished",
                                width=60)

        return INSTALL_OK
示例#4
0
    def write(self, fn, mouse, keyboard):
        # always turn dri on FIXME: except on ia64
        if iutil.getArch() == "ia64":
            self.xhwstate.set_dri_enabled(0)
        else:
            self.xhwstate.set_dri_enabled(1)

#
# XXX - cleanup monitor name to not include 'DDC Probed Monitor'
#       in its string if its there.
#
#       This is around for legacy reasons.  The monitor description
#       string passed around inside anaconda includes this prefix
#       so that the UI can properly display the monitor as a DDC
#       probed value versus a user selected value.
#
        monname = self.xhwstate.get_monitor_name()
        if monname is not None:
            ddc_monitor_string = _("DDC Probed Monitor")
            if monname[:len(ddc_monitor_string)] == ddc_monitor_string:
                self.xhwstate.set_monitor_name(
                    monname[len(ddc_monitor_string) + 3:])

        outfile = fn + "/xorg.conf"
        xserver.writeXConfig(outfile,
                             self.xhwstate,
                             mouse,
                             keyboard,
                             standalone=0)

        # restore monitor name
        self.xhwstate.set_monitor_name(monname)
示例#5
0
    def setVideoCard(self, id, server=None, card=None, videoRam=None):
        # oh suck.  if on ppc, bail because nothing other than fbdev is
        # going to work all that well
        if iutil.getArch() == "ppc":
            return

        primary = id.videocard.primaryCard()

        if card:
            db = id.videocard.cardsDB()
            if db.has_key(card):
                vcdata = db[card]
                primary.setCardData(vcdata)
                primary.setDevID(vcdata["NAME"])
                primary.setDescription(vcdata["NAME"])

                id.xsetup.xhwstate.set_videocard_name(vcdata["NAME"])
                id.xsetup.xhwstate.set_videocard_card(vcdata["NAME"])
            else:
                raise RuntimeError, "Unknown videocard specified: %s" % (
                    card, )

        if videoRam:
            # FIXME: this required casting is ugly
            id.videocard.primaryCard().setVideoRam(str(videoRam))
            id.xsetup.xhwstate.set_videocard_ram(int(videoRam))

        if server is not None:
            log("unable to really do anything with server right now")
示例#6
0
    def setSteps(self, dispatch):
        dispatch.setStepList(
            "language", "keyboard", "welcome", "installtype", "findrootparts",
            "findinstall", "partitionobjinit", "upgrademount",
            "upgrademigfind", "upgrademigratefs", "upgradecontinue",
            "readcomps", "findpackages", "upgbootloader", "checkdeps",
            "dependencies", "confirmupgrade", "install", "migratefilesystems",
            "preinstallconfig", "installpackages", "postinstallconfig",
            "instbootloader", "dopostaction", "methodcomplete", "complete")

        if iutil.getArch() != "i386" and iutil.getArch() != "x86_64":
            dispatch.skipStep("bootloader")
            dispatch.skipStep("bootloaderadvanced")

        if iutil.getArch() != "i386" and iutil.getArch() != "x86_64":
            dispatch.skipStep("upgbootloader")
示例#7
0
def checkDasdFmt(disk, intf):
    if iutil.getArch() != "s390":
        return 0

    if disk.type.name != "dasd":
        return 0

    # FIXME: there has to be a better way to check LDL vs CDL
    # how do I test ldl vs cdl?
    if disk.max_primary_partition_count > 1:
        return 0

    if intf:
        try:
            devs = isys.getDasdDevPort()
            dev = "/dev/%s (%s" %(disk.dev.path[5:], devs[device])
        except Exception, e:
            log("exception getting dasd dev ports: %s" %(e,))
            dev = "/dev/%s" %(disk.dev.path[5:],)
        
        rc = intf.messageWindow(_("Warning"),
                       _("The device %s is LDL formatted instead of "
                         "CDL formatted.  LDL formatted DASDs are not "
                         "supported for usage during an install of %s.  "
                         "If you wish to use this disk for installation, "
                         "it must be re-initialized causing the loss of "
                         "ALL DATA on this drive.\n\n"
                         "Would you like to reformat this DASD using CDL "
                         "format?")
                        %(dev, productName), type = "yesno")
        if rc == 0:
            return 1
        else:
            return -1
示例#8
0
def checkDiskLabel(disk, intf):
    """Check that the disk label on disk is valid for this machine type."""
    arch = iutil.getArch()
    if arch in archLabels.keys():
        if disk.type.name in archLabels[arch]:
            # this is kind of a hack since we don't want LDL to be used
            return checkDasdFmt(disk, intf)
    else:
        if disk.type.name == "msdos":
            return 0

    if intf:
        rc = intf.messageWindow(_("Warning"),
                       _("The partition table on device /dev/%s is of an "
                         "unexpected type %s for your architecture.  To "
                         "use this disk for installation of %s, "
                         "it must be re-initialized causing the loss of "
                         "ALL DATA on this drive.\n\n"
                         "Would you like to initialize this drive?")
                       % (disk.dev.path[5:], disk.type.name, productName),
                                type = "yesno")
        if rc == 0:
            return 1
        else:
            return -1
    else:
        return 1
示例#9
0
def makeInitrd (kernelTag, instRoot):
    if iutil.getArch() == 'ia64':
	initrd = "/boot/efi/initrd%s.img" % (kernelTag, )
    else:
	initrd = "/boot/initrd%s.img" % (kernelTag, )

    return initrd
示例#10
0
    def getBootableMountpoints(self):
        """Return a list of bootable valid mountpoints for this arch."""
        # FIXME: should be somewhere else, preferably some sort of arch object

        if iutil.getArch() == "ia64":
            return ["/boot/efi"]
        else:
            return ["/boot", "/"]
示例#11
0
def getMaxLVSize():
    """ Return the maximum size (in MB) of a logical volume. """
    if iutil.getArch() in ("x86_64", "ppc64", "alpha", "ia64", "s390",
                           "sparc"):  #64bit architectures
        return (8 * 1024 * 1024 * 1024 * 1024
                )  #Max is 8EiB (very large number..)
    else:
        return (16 * 1024 * 1024)  #Max is 16TiB
示例#12
0
    def __init__(self):
	self.skipSteps = {}
	self.hostname = None
	self.lilo = ("mbr", 1, "")
	self.groups = None
	self.packages = None
	self.makeBootdisk = 0
	self.timezone = None
	self.setAuthentication(1, 1, 0)
	self.rootPassword = None
	self.rootPasswordCrypted = 0
	self.installType = None
	self.bootProto = None
	self.ip = ""
	self.networkDevice = None
	self.netmask = ""
	self.gateway = ""
	self.nameserver = ""
	self.partitions = []
	self.clearParts = 0
        self.clearType = None
	self.clearText = None
	self.clearPartText = None
	self.zeroMbr = 0
	self.language = None
	self.keyboard = None
	self.mouse = None
	self.x = None
	self.defaultRunlevel = None
	self.postScript = None
	self.postInChroot = 0
	self.fstab = []
	self.earlySwapOn = 0
        self.desktop = ""
	self.raidList = []
        self.name = ""
        self.pixmap = ""
        self.showgroups = None

        if iutil.getArch () == "alpha":
            self.addToSkipList("bootdisk")
            self.addToSkipList("lilo")
        elif iutil.getArch () == "ia64":
            self.addToSkipList("bootdisk")
            self.addToSkipList("lilo")
示例#13
0
    def setSteps(self, dispatch):
        dispatch.setStepList(
            "language", "keyboard", "checkmonitorok", "monitor", "setsanex",
            "welcome", "findrootparts", "betanag", "installtype",
            "partitionmethod", "partitionobjinit", "partitionmethodsetup",
            "autopartition", "autopartitionexecute", "fdisk", "partition",
            "partitiondone", "bootloadersetup", "bootloader",
            "networkdevicecheck", "network", "firewall", "languagesupport",
            "timezone", "accounts", "readcomps", "selectlangpackages",
            "package-selection", "handleX11pkgs", "checkdeps", "dependencies",
            "confirminstall", "install", "enablefilesystems",
            "migratefilesystems", "setuptime", "preinstallconfig",
            "installpackages", "postinstallconfig", "writeconfig", "firstboot",
            "instbootloader", "dopostaction", "writexconfig", "writeksconfig",
            "bootdisk", "methodcomplete", "setfilecon", "complete")

        if not BETANAG:
            dispatch.skipStep("betanag")

        if iutil.getArch() != "i386" or 1:
            dispatch.skipStep("bootdisk")

        # see if we need to write out a rescue boot floppy
        if iutil.getArch() == "i386":
            import floppy
            if not floppy.hasFloppyDevice():
                dispatch.skipStep("bootdisk")

        if iutil.getArch() != "i386" and iutil.getArch() != "x86_64":
            dispatch.skipStep("bootloader")

    # 'noupgrade' can be used on the command line to force not looking
    # for partitions to upgrade.  useful in some cases...
        cmdline = open("/proc/cmdline", "r").read()
        if cmdline.find("noupgrade") != -1:
            dispatch.skipStep("findrootparts")

    # if there's only one install class, it doesn't make much sense
    # to show it
        if len(availableClasses()) < 2:
            dispatch.skipStep("installtype", permanent=1)
示例#14
0
    def getBootableRequest(self):
        """Return the name of the current 'boot' mount point."""
        bootreq = None

        if iutil.getArch() == "ia64":
            bootreq = self.getRequestByMountPoint("/boot/efi")
            if bootreq:
                return [bootreq]
            else:
                return None
        elif iutil.getPPCMachine() == "iSeries":
            for req in self.requests:
                if req.fstype == fsset.fileSystemTypeGet("PPC PReP Boot"):
                    return [req]
            return None
        elif iutil.getPPCMachine() == "pSeries":
            # pSeries bootable requests are odd.
            # have to consider both the PReP partition (with potentially > 1
            # existing) as well as /boot,/

            # for the prep partition, we want either the first or the
            # first non-preexisting one
            bestprep = None
            for req in self.requests:
                if req.fstype == fsset.fileSystemTypeGet("PPC PReP Boot"):
                    if ((bestprep is None) or (bestprep.getPreExisting()
                                               and not req.getPreExisting())):
                        bestprep = req

            if bestprep:
                ret = [bestprep]
            else:
                ret = []

            # now add the /boot
            bootreq = self.getRequestByMountPoint("/boot")
            if not bootreq:
                bootreq = self.getRequestByMountPoint("/")
            if bootreq:
                ret.append(bootreq)

            if len(ret) >= 1:
                return ret
            return None

        if not bootreq:
            bootreq = self.getRequestByMountPoint("/boot")
        if not bootreq:
            bootreq = self.getRequestByMountPoint("/")

        if bootreq:
            return [bootreq]
        return None
示例#15
0
 def open(self, file):
     if type(file) == type("hello"):
         try:
             self.logFile = open(file, "w")
         except:
             self.logFile = sys.stderr
     elif file:
         self.logFile = file
     else:
         if iutil.getArch() != "s390":
             self.logFile = open("/dev/tty3", "w")
         else:
             # we don't really want to have to write this stuff to two
             # files.
             self.logFile = None
         try:
             self.logFile2 = open("/tmp/anaconda.log", "a")
         except:
             self.logFile2 = None
示例#16
0
    def setupChooseBootloaderRadioBox(self):
        radio_vbox = gtk.VBox(gtk.FALSE, 2)
        radio_vbox.set_border_width(5)

        label = gui.WrappingLabel(
            _("Please select the boot loader that "
              "the computer will use.  GRUB is the "
              "default boot loader. However, if you "
              "do not wish to overwrite your current "
              "boot loader, select \"Do not install "
              "a boot loader.\"  "))
        label.set_alignment(0.0, 0.0)

        self.grub_radio = gtk.RadioButton(None, (_("Use _GRUB as the "
                                                   "boot loader")))
        if bootloader.showLilo:
            self.lilo_radio = gtk.RadioButton(self.grub_radio,
                                              (_("Use _LILO as the boot "
                                                 "loader")))
        else:
            self.lilo_radio = None
        self.none_radio = gtk.RadioButton(self.grub_radio, (_("_Do not "
                                                              "install a "
                                                              "boot loader")))

        radio_vbox.pack_start(label, gtk.FALSE)
        radio_vbox.pack_start(self.grub_radio, gtk.FALSE)
        if self.lilo_radio:
            radio_vbox.pack_start(self.lilo_radio, gtk.FALSE)
        radio_vbox.pack_start(self.none_radio, gtk.FALSE)

        if self.blname is None:
            self.none_radio.set_active(gtk.TRUE)
        elif self.lilo_radio is not None and self.blname == "LILO" and iutil.getArch(
        ) == "i386":
            self.lilo_radio.set_active(gtk.TRUE)
        else:
            self.grub_radio.set_active(gtk.TRUE)

        return radio_vbox
示例#17
0
    def getScreen (self):
        self.ics.setHelpEnabled (gtk.FALSE)

        hbox = gtk.HBox (gtk.FALSE, 5)
        
        pix = self.ics.readPixmap ("done.png")
        if pix:
            a = gtk.Alignment ()
            a.add (pix)
            a.set (0.5, 0.5, 1.0, 1.0)
	    a.set_size_request(200, -1)
            hbox.pack_start (a, gtk.FALSE, gtk.FALSE, 36)

        bootstr = ""
        if iutil.getArch() == "s390":
            floppystr = ""
        else:
            floppystr = _("Remove any installation media (diskettes or "
                          "CD-ROMs) used during the installation process "
                          "and press the \"Reboot\" button to reboot your "
                          "system."
                          "\n\n")

        txt = _("Congratulations, the installation is complete.\n\n"
                "%s%s") %(floppystr, bootstr)
        foo = _("For information on Errata (updates and bug fixes), visit:\n"
                "\thttp://www.redhat.com/errata/\n\n"
                "For information on automatic updates through Red Hat "
                "Network, visit:\n"
                "\thttp://rhn.redhat.com/\n\n"
                "For information on using and configuring the system, visit:\n"
                "\thttp://www.redhat.com/docs/\n"
                "\thttp://www.redhat.com/apps/support/\n\n"
                "To register the product for support, visit:\n"
                "\thttp://www.redhat.com/apps/activate/\n\n")

	label = gui.WrappingLabel(txt)

        hbox.pack_start (label, gtk.TRUE, gtk.TRUE)
        return hbox
示例#18
0
def getDefaultDiskType():
    """Get the default partition table type for this architecture."""
    if iutil.getArch() == "i386":
        return parted.disk_type_get("msdos")
    elif iutil.getArch() == "ia64":
        return parted.disk_type_get("gpt")
    elif iutil.getArch() == "s390":
        return parted.disk_type_get("dasd")
    elif iutil.getArch() == "alpha":
        return parted.disk_type_get("bsd")
    elif iutil.getArch() == "sparc":
        return parted.disk_type_get("sun")
    elif iutil.getArch() == "ppc":
        return parted.disk_type_get("msdos")
    else:
        return parted.disk_type_get("msdos")
示例#19
0
    def __init__(self, file, hdlist, arch = None, matchAllLang = 0):
        self.frozen = 0
        self.allLangs = matchAllLang
        self.archList = []
	self.verifiedState = None
	if not arch:
	    import iutil
	    arch = iutil.getArch()
            self.archList.append(arch)
            # always set since with can have i386 arch with i686 arch2,
            # for example:
            #   arch2 = None
            #   if arch == "sparc" and os.uname ()[4] == "sparc64":
            #	    arch2 = "sparc64"
            #
            arch2 = os.uname ()[4]
            if not arch2 in self.archList:
                self.archList.append (arch2)
        else:
            self.archList.append(arch)
        
	self.packages = hdlist
	self.readCompsFile(file, self.packages)
示例#20
0
    def writeKS(self, f, desktop=None):
        # FIXME: we really should have at least teh startxonboot and
        # defaultdesktop bits on s390
        if iutil.getArch() == "s390":
            return

        if self.skipx:
            f.write("skipx\n")
            return

        args = self.getArgList(self.xhwstate.get_resolution(),
                               self.xhwstate.get_colordepth())
        if desktop:
            rl = desktop.getDefaultRunLevel()
            if rl and str(rl) == '5':
                args = args + ['--startxonboot', '']
            gui = desktop.getDefaultDesktop()
            if gui:
                args = args + ['--defaultdesktop', string.lower(gui)]

        f.write("xconfig")
        for arg in args:
            f.write(" " + arg)
        f.write("\n")
示例#21
0
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import isys, iutil
import os, os.path, stat, sys
from constants import *

import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)

import logging
log = logging.getLogger("anaconda")

_arch = iutil.getArch()

def findFirstIsoImage(path, messageWindow):
    """
    Find the first iso image in path
    This also supports specifying a specific .iso image

    Returns the full path to the image
    """
    flush = os.stat(path)
    arch = _arch

    if os.path.isfile(path) and path.endswith(".iso"):
        files = [os.path.basename(path)]
        path = os.path.dirname(path)
    else:
示例#22
0
    def __call__(self, screen, dispatch, bl, fsset, diskSet):
        # XXX need more text here
        t = TextboxReflowed(53,
                   _("Which boot loader would you like to use?"))

        if dispatch.stepInSkipList("instbootloader"):
            useGrub = 0
            useLilo = 0
            noBl = 1
        elif not bl.useGrub():
            useGrub = 0
            useLilo = 1
            noBl = 0
        else:
            useGrub = 1
            useLilo = 0
            noBl = 0

        blradio = RadioGroup()
        grub = blradio.add(_("Use GRUB Boot Loader"), "grub", useGrub)
        if bootloader.showLilo and iutil.getArch() == "i386":
            lilo = blradio.add(_("Use LILO Boot Loader"), "lilo", useLilo)
        else:
            lilo = None
        skipbl = blradio.add(_("No Boot Loader"), "nobl", noBl)
	buttons = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON ] )

        grid = GridFormHelp(screen, _("Boot Loader Configuration"),
                            "btloadinstall", 1, 5)
        grid.add(t, 0, 0, (0,0,0,1))
        grid.add(grub, 0, 1, (0,0,0,0))
        if lilo is not None:
            grid.add(lilo, 0, 2, (0,0,0,0))
        grid.add(skipbl, 0, 3, (0,0,0,1))
        grid.add(buttons, 0, 4, growx = 1)

        while 1:
            result = grid.run()

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

            if blradio.getSelection() == "nobl":
                rc = ButtonChoiceWindow(screen, _("Skip Boot Loader"),
				_("You have elected to not install "
				  "any boot loader. It is strongly recommended "
				  "that you install a boot loader unless "
				  "you have an advanced need.  A boot loader "
				  "is almost always required in order "
				  "to reboot your system into Linux "
				  "directly from the hard drive.\n\n"
				  "Are you sure you want to skip boot loader "
				  "installation?"),
				[ (_("Yes"), "yes"), (_("No"), "no") ],
				width = 50)
                if rc == "no":
                    continue
                dispatch.skipStep("instbootloader", skip = (rc == "yes"))
                dispatch.skipStep("bootloaderadvanced", skip = (rc == "yes"))

                # kind of a hack...
                bl.defaultDevice = None
            elif blradio.getSelection() == "lilo":
                bl.setUseGrub(0)
                dispatch.skipStep("instbootloader", 0)
                dispatch.skipStep("bootloaderadvanced", 0)
            else:
                bl.setUseGrub(1)
                dispatch.skipStep("instbootloader", 0)
                dispatch.skipStep("bootloaderadvanced", 0)                

            screen.popWindow()
            return INSTALL_OK
示例#23
0
    def __call__(self, screen, xsetup, monitor, videocard, desktop, grpset,
                 instClass, instPath):

        self.instPath = instPath
        self.xsetup = xsetup
        self.origres = self.xsetup.xhwstate.get_resolution()
        self.origdepth = self.xsetup.xhwstate.get_colordepth()

        # dont do anything on ppc - we want to use default fb setting
        if iutil.getArch() != "ppc":
            if not xsetup.imposed_sane_default:
                xsetup.xhwstate.choose_sane_default()
                xsetup.imposed_sane_default = 1

        availableRes = self.xsetup.xhwstate.available_resolutions()
        availableDepths = self.xsetup.xhwstate.available_color_depths()
        self.selectedDepth = self.xsetup.xhwstate.get_colordepth()
        self.selectedRes = self.xsetup.xhwstate.get_resolution()

        depth_list = [(_("256 Colors (8 Bit)")), (_("High Color (16 Bit)")),
                      (_("True Color (24 Bit)"))]
        self.bit_depth = [8, 16, 24]
        self.avail_depths = depth_list[:len(availableDepths)]
        self.res_list = [
            "640x480", "800x600", "1024x768", "1152x864", "1280x960",
            "1280x1024", "1400x1050", "1600x1200", "1920x1440", "2048x1536"
        ]

        #--If both KDE and GNOME are selected
        if grpset:
            gnomeSelected = (grpset.hdrlist.has_key('gnome-session')
                             and grpset.hdrlist['gnome-session'].isSelected())
            kdeSelected = (grpset.hdrlist.has_key('kdebase')
                           and grpset.hdrlist['kdebase'].isSelected())
        else:
            gnomeSelected = 0
            kdeSelected = 0

        self.selectedDesktop = desktop.getDefaultDesktop()
        self.selectedRunLevel = desktop.getDefaultRunLevel()

        while 1:
            bb = ButtonBar(screen, (TEXT_OK_BUTTON, TEXT_BACK_BUTTON))

            toplevel = GridFormHelp(screen, _("X Customization"), "custom", 1,
                                    5)

            text = _("Select the color depth and video mode you want to "
                     "use for your system. ")

            customgrid = Grid(3, 2)
            label = Label(_("Color Depth:"))
            customgrid.setField(label, 0, 0, (0, 0, 0, 1), anchorLeft=1)
            field = Textbox(
                20, 1, depth_list[self.bit_depth.index(self.selectedDepth)])
            customgrid.setField(field, 1, 0, (0, 0, 0, 1), anchorLeft=1)
            depthchangebutton = CompactButton(_("Change"))
            customgrid.setField(depthchangebutton,
                                2,
                                0, (0, 0, 0, 1),
                                anchorLeft=1)
            label = Label(_("Resolution:"))
            customgrid.setField(label, 0, 1, (0, 0, 0, 1), anchorLeft=1)
            field = Textbox(14, 1, self.selectedRes)
            customgrid.setField(field, 1, 1, (0, 0, 0, 1), anchorLeft=1)
            reschangebutton = CompactButton(_("Change"))
            customgrid.setField(reschangebutton,
                                2,
                                1, (0, 0, 0, 1),
                                anchorLeft=1)

            if (ENABLE_DESKTOP_CHOICE) and (gnomeSelected or kdeSelected):
                desktopgrid = Grid(3, 2)
                label = Label(_("Default Desktop:"))
                desktopgrid.setField(label, 0, 1, (0, 0, 0, 1), anchorLeft=1)

                if gnomeSelected and kdeSelected:
                    self.gnomerb = SingleRadioButton(
                        _("GNOME"), None, self.selectedDesktop == "GNOME")
                    self.kderb = SingleRadioButton(
                        _("KDE"), self.gnomerb, self.selectedDesktop == "KDE")
                    self.gnomerb.setCallback(self.desktopCB, self.gnomerb)
                    self.kderb.setCallback(self.desktopCB, self.kderb)
                    desktopgrid.setField(self.gnomerb,
                                         1,
                                         1, (0, 0, 0, 1),
                                         anchorLeft=1)
                    desktopgrid.setField(self.kderb,
                                         2,
                                         1, (0, 0, 0, 1),
                                         anchorLeft=1)
                elif gnomeSelected:
                    desktopgrid.setField(Textbox(10, 1, _("GNOME")),
                                         1,
                                         1, (0, 0, 0, 1),
                                         anchorLeft=1)
                elif kdeSelected:
                    desktopgrid.setField(Textbox(10, 1, _("KDE")),
                                         1,
                                         1, (0, 0, 0, 1),
                                         anchorLeft=1)
            else:
                desktopgrid = None

            if instClass.showLoginChoice:
                runlevelgrid = Grid(3, 2)
                label = Label(_("Default Login:"******"Graphical"), None,
                                                 (self.selectedRunLevel == 5))
                self.textrb = SingleRadioButton(_("Text"), self.graphrb,
                                                (self.selectedRunLevel == 3))
                self.graphrb.setCallback(self.loginCB, self.graphrb)
                self.textrb.setCallback(self.loginCB, self.textrb)
                runlevelgrid.setField(self.graphrb,
                                      1,
                                      1, (0, 0, 0, 1),
                                      anchorLeft=1)
                runlevelgrid.setField(self.textrb,
                                      2,
                                      1, (0, 0, 0, 1),
                                      anchorLeft=1)
            else:
                # if no choice to be given, assume run level of 5
                runlevelgrid = None
                self.selectRunLevel = 5

            toplevel.add(TextboxReflowed(55, text), 0, 0, (0, 0, 0, 1))
            toplevel.add(customgrid, 0, 1, (0, 0, 0, 0), growx=1)
            if desktopgrid:
                toplevel.add(desktopgrid, 0, 2, (0, 0, 0, 0), growx=1)
            if runlevelgrid:
                toplevel.add(runlevelgrid, 0, 3, (0, 0, 0, 0), growx=1)
            toplevel.add(bb, 0, 4, (0, 0, 0, 0), growx=1)

            result = toplevel.run()
            rc = bb.buttonPressed(result)

            if rc == TEXT_BACK_CHECK:
                screen.popWindow()
                return INSTALL_BACK
            elif rc == TEXT_OK_CHECK or result == TEXT_F12_CHECK:
                screen.popWindow()
                break
            elif result == depthchangebutton:
                self.depthchangeCB(screen)
            elif result == reschangebutton:
                self.reschangeCB(screen)

            screen.popWindow()

        # store results
        self.xsetup.xhwstate.set_colordepth(self.selectedDepth)
        self.xsetup.xhwstate.set_resolution(self.selectedRes)

        desktop.setDefaultDesktop(self.selectedDesktop)
        desktop.setDefaultRunLevel(self.selectedRunLevel)

        return INSTALL_OK
示例#24
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)
示例#25
0
def availableClasses(showHidden=0):
    global allClasses
    global allClasses_hidden

    def _ordering(first, second):
        ((name1, obj, logo), priority1) = first
        ((name2, obj, logo), priority2) = second

        if priority1 < priority2:
            return -1
        elif priority1 > priority2:
            return 1

        if name1 < name2:
            return -1
        elif name1 > name2:
            return 1

        return 0

    if not showHidden:
        if allClasses: return allClasses
    else:
        if allClasses_hidden: return allClasses_hidden

    path = []

    for dir in [
            "installclasses", "/tmp/updates/installclasses",
            "/tmp/product/installclasses", "/usr/lib/anaconda/installclasses"
    ]:
        if os.access(dir, os.R_OK):
            path.append(dir)

    # append the location of installclasses to the python path so we
    # can import them
    sys.path = path + sys.path

    files = []
    for p in reversed(path):
        files += os.listdir(p)

    done = {}
    list = []
    for file in files:
        if file[0] == '.': continue
        if len(file) < 4:
            continue
        if file[-3:] != ".py" and file[-4:-1] != ".py":
            continue
        mainName = string.split(file, ".")[0]
        if done.has_key(mainName): continue
        done[mainName] = 1

        try:
            found = imputil.imp.find_module(mainName)
        except:
            log.warning("module import of %s failed: %s" %
                        (mainName, sys.exc_type))
            continue

        try:
            loaded = imputil.imp.load_module(mainName, found[0], found[1],
                                             found[2])

            obj = loaded.InstallClass

            if obj.__dict__.has_key('sortPriority'):
                sortOrder = obj.sortPriority
            else:
                sortOrder = 0

            if obj.__dict__.has_key('arch'):
                if obj.arch != iutil.getArch():
                    obj.hidden = 1

            if obj.hidden == 0 or showHidden == 1:
                list.append(((obj.name, obj, obj.pixmap), sortOrder))
        except:
            log.warning("module import of %s failed: %s" %
                        (mainName, sys.exc_type))
            if flags.debug: raise
            else: continue

    list.sort(_ordering)
    for (item, priority) in list:
        if showHidden:
            allClasses_hidden.append(item)
        else:
            allClasses.append(item)

    if showHidden:
        return allClasses_hidden
    else:
        return allClasses
示例#26
0
def availableClasses(showHidden=0):
    global allClasses
    global allClasses_hidden

    if not showHidden:
        if allClasses: return allClasses
    else:
        if allClasses_hidden: return allClasses_hidden

    if os.access("installclasses", os.R_OK):
        path = "installclasses"
    elif os.access("/tmp/product/installclasses", os.R_OK):
        path = "/tmp/product/installclasses"
    else:
        path = "/usr/lib/anaconda/installclasses"

    # append the location of installclasses to the python path so we
    # can import them
    sys.path.append(path)

    files = os.listdir(path)
    done = {}
    list = []
    for file in files:
        if file[0] == '.': continue
        if len(file) < 4:
            continue
        if file[-3:] != ".py" and file[-4:-1] != ".py":
            continue
        mainName = string.split(file, ".")[0]
        if done.has_key(mainName): continue
        done[mainName] = 1

        obj = None
        cmd = "import %s\nif %s.__dict__.has_key('InstallClass'): obj = %s.InstallClass\n" % (
            mainName, mainName, mainName)
        exec(cmd)

        if obj:
            if obj.__dict__.has_key('sortPriority'):
                sortOrder = obj.sortPriority
            else:
                sortOrder = 0

            if obj.__dict__.has_key('arch'):
                if obj.arch != iutil.getArch():
                    obj.hidden = 1

            if obj.hidden == 0 or showHidden == 1:
                list.append(((obj.name, obj, obj.pixmap), sortOrder))

    list.sort(ordering)
    for (item, priority) in list:
        if showHidden:
            allClasses_hidden.append(item)
        else:
            allClasses.append(item)

    if showHidden:
        return allClasses_hidden
    else:
        return allClasses
示例#27
0
    def getScreen(self, dispatch, xsetup, videocard, intf):
        self.ics.setHelpEnabled(gtk.TRUE)

        self.dispatch = dispatch
        self.videocard = videocard
        self.xsetup = xsetup
        self.intf = intf

        self.lastvalidselection = None

        box = gtk.VBox(gtk.FALSE, 0)
        box.set_border_width(0)

        self.autoBox = gtk.VBox(gtk.FALSE, 5)

        self.force_ppc_fb = 0
        arch = iutil.getArch()
        # we can only probe video ram on i386
        # and we force frame buffer on ppc currently
        if arch == "ppc":
            label = makeFormattedLabel(
                _("Your system will be setup to "
                  "use the frame buffer driver for "
                  "the X Window System.  If you do "
                  "not want to setup the X Window "
                  "System, choose "
                  "'Skip X Configuration' below."))
            box.pack_start(label, gtk.FALSE, gtk.FALSE)
            self.force_ppc_fb = 1
        elif arch != "i386":
            label = makeFormattedLabel(
                _("Your video ram size can not be "
                  "autodetected.  Choose your video "
                  "ram size from the choices below:"))
            box.pack_start(label, gtk.FALSE)
        else:
            self.autoBox = gtk.VBox(gtk.FALSE, 5)

            label = makeFormattedLabel(
                _("In most cases, the video hardware "
                  "can be automatically detected. "
                  "If the detected settings are not "
                  "correct for the hardware, select "
                  "the right settings."))
            self.autoBox.pack_start(label, gtk.FALSE)

            box.pack_start(self.autoBox, gtk.FALSE)

# load in card database
        self.cards = self.videocard.cardsDB()
        cards = self.cards.keys()
        cards.sort()

        other_cards = copy.copy(cards)
        self.currentCard = None
        self.probedCard = None
        if self.videocard.primaryCard():
            carddata = self.videocard.primaryCard().getCardData(dontResolve=1)
            if carddata:
                self.currentCard = carddata["NAME"]
            else:
                self.currentCard = None

            carddata = self.videocard.primaryCard(useProbed=1).getCardData()
            if carddata:
                self.probedCard = carddata["NAME"]
            else:
                self.probedCard = None

# load images of videocard
        fn = self.ics.findPixmap("videocard.png")
        p = gtk.gdk.pixbuf_new_from_file(fn)
        if p:
            self.videocard_p, self.videocard_b = p.render_pixmap_and_mask()

        # Videocard selection tree - preset 'Generic' and 'Other' nodes
        self.cardstore = gtk.TreeStore(gobject.TYPE_STRING,
                                       gobject.TYPE_STRING)

        toplevels = {}

        # add "Generic" in before "Other" if supporting XFree86 3.x
        # Note other changes in videocard.py and elsewhere required to support
        # XFree86 3.x again
        manufacturers = ["Other"] + self.videocard.manufacturerDB()
        for man in manufacturers:
            toplevels[man] = self.cardstore.append(None)
            self.cardstore.set_value(toplevels[man], 0, man)

# now go through cards and matchup with manufacturers
        for card in cards:
            temp = string.lower(card)

            for man in manufacturers:
                if string.lower(man) == temp[:len(man)]:
                    parent = toplevels.get(man)
                    iter = self.cardstore.append(parent)
                    self.cardstore.set_value(iter, 0, card)
                    other_cards.remove(card)

        # now add cards not categorized into above manufacturers
        for card in other_cards:
            parent = toplevels.get("Other")
            iter = self.cardstore.append(parent)
            self.cardstore.set_value(iter, 0, card)

        self.cardview = gtk.TreeView(self.cardstore)
        self.cardview.set_property("headers-visible", gtk.FALSE)
        col = gtk.TreeViewColumn(None, gtk.CellRendererText(), text=0)
        self.cardview.append_column(col)
        selection = self.cardview.get_selection()
        selection.connect("changed", self.selectCardType)
        selection.set_select_function(self.cardviewSelectCb)

        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        sw.set_shadow_type(gtk.SHADOW_IN)
        sw.add(self.cardview)

        # only show this option on non-ppc
        if not self.force_ppc_fb:
            box.pack_start(sw, gtk.TRUE)

        #Memory configuration menu
        hbox = gtk.HBox()
        hbox.set_border_width(3)

        label = gui.MnemonicLabel(_("_Video card RAM: "))

        self.ramOption = gtk.OptionMenu()
        label.set_mnemonic_widget(self.ramOption)
        self.ramOption.set_size_request(40, 20)
        self.ramMenu = gtk.Menu()

        for mem in self.videocard.possible_ram_sizes():
            if mem < 1000:
                tag = "%d KB" % (mem)
            else:
                tag = "%d MB" % (mem / 1024)

            memitem = gtk.MenuItem(tag)
            self.ramMenu.add(memitem)

        hbox.pack_start(label, gtk.FALSE)
        hbox.pack_start(self.ramOption, gtk.TRUE, gtk.TRUE, 25)

        self.ramOption.set_menu(self.ramMenu)

        # only show this option on non-ppc
        if not self.force_ppc_fb:
            box.pack_start(hbox, gtk.FALSE)

        restore = gtk.Button(_("Restore _original values"))
        restore.connect("clicked", self.restorePressed)
        hbox.pack_start(restore, gtk.FALSE, 25)

        self.skip = gtk.CheckButton(_("_Skip X configuration"))
        self.skip.connect("toggled", self.skipToggled)

        hbox = gtk.HBox(gtk.TRUE, 5)

        self.topbox = gtk.VBox(gtk.FALSE, 5)
        self.topbox.set_border_width(5)
        if self.force_ppc_fb:
            # tweak packing
            self.topbox.pack_start(box, gtk.FALSE, gtk.FALSE)
            self.topbox.pack_start(self.skip, gtk.FALSE, gtk.FALSE)
        else:
            self.topbox.pack_start(box, gtk.TRUE, gtk.TRUE)
            self.topbox.pack_start(self.skip, gtk.FALSE)

        self.configbox = box

        self.skip.set_active(self.dispatch.stepInSkipList("monitor"))

        # set state
        self.ignoreEvents = 0
        self.currentMem = self.videocard.primaryCard(useProbed=0).getVideoRam()
        self.probedMem = self.videocard.primaryCard(useProbed=1).getVideoRam()
        self.setCurrent(self.currentCard, self.currentMem)

        setupTreeViewFixupIdleHandler(self.cardview, self.cardstore)

        return self.topbox
示例#28
0
    def getNext(self):
        if self.skip.get_active():
            self.dispatch.skipStep("monitor")
            self.dispatch.skipStep("xcustom")
            self.dispatch.skipStep("writexconfig")
            self.xsetup.skipx = 1

            return None
        else:
            self.dispatch.skipStep("monitor", skip=0)
            self.dispatch.skipStep("xcustom", skip=0)
            self.dispatch.skipStep("writexconfig", skip=0)
            self.xsetup.skipx = 0

# if ppc then we bail now, you cant selected videocard for ppc
        if iutil.getArch() == "ppc":
            return None

        # set videocard type (assuming we're working with PRIMARY card)
        if self.currentCard:
            try:
                selected = self.cards[self.currentCard]
            except:
                self.intf.messageWindow(
                    _("Unknown video card"),
                    _("An error has occurred selecting "
                      "the video card %s. Please report "
                      "this error to bugzilla.redhat.com.") % self.currentCard)
                raise gui.StayOnScreen

            primary_card = self.videocard.primaryCard()
            primary_card.setCardData(selected)
            primary_card.setDevID(selected["NAME"])
            primary_card.setDescription(selected["NAME"])

            # pull out resolved version of card data
            card_data = primary_card.getCardData()
            if (card_data.has_key("DRIVER")
                    and not card_data.has_key("UNSUPPORTED")):
                server = "Xorg"
            else:
                server = "XF86_" + card_data["SERVER"]

            primary_card.setXServer(server)
        else:
            selected = None

        # see if they actually picked a card, otherwise keep going
        if selected == None:
            self.intf.messageWindow(
                _("Unspecified video card"),
                _("You need to pick a video card before "
                  "X configuration can continue.  If you "
                  "want to skip X configuration entirely "
                  "choose the 'Skip X Configuration' button."))
            raise gui.StayOnScreen

        # sniff out the selected ram size
        menu = self.ramOption.get_menu().get_active()
        index = 0
        for menu_item in self.ramOption.get_menu().get_children():
            if menu_item == menu:
                break
            index = index + 1

        vidram = self.videocard.possible_ram_sizes()[index]

        # lots of duplication here complicated by factor we have a
        # videocard object as part of instdata and in xhwstate!!
        # need to consolidate
        try:
            self.videocard.primaryCard().setVideoRam(str(vidram))
            self.xsetup.xhwstate.set_videocard_ram(vidram)
            cardname = self.videocard.primaryCard().cardData["NAME"]
            self.xsetup.xhwstate.set_videocard_name(cardname)
            self.xsetup.xhwstate.set_videocard_card(cardname)
        except:
            log(
                "videocard-getNext: could not determine cardname for primary card %s",
                self.videocard.primaryCard())
        return None
示例#29
0
    def getScreen(self, xsetup, monitor, videocard, desktop, grpset, instClass,
                  instPath):

        self.xsetup = xsetup
        self.monitor = monitor
        self.videocard = videocard
        self.desktop = desktop
        self.instClass = instClass

        # dont do anything on ppc - we want to use default fb setting
        if iutil.getArch() != "ppc":
            if not xsetup.imposed_sane_default:
                xsetup.xhwstate.choose_sane_default()
                xsetup.imposed_sane_default = 1

# save so we can restore if necessary going back
        self.origres = self.xsetup.xhwstate.get_resolution()
        self.origdepth = self.xsetup.xhwstate.get_colordepth()

        self.instPath = instPath

        # create toplevel packing structure
        self.box = gtk.VBox(gtk.FALSE)
        self.box.set_border_width(5)

        # hbox and alignment used for monitor preview area
        # list of pixmaps for monitor preview
        self.monitor_pixmaps = None
        self.hbox = gtk.HBox(gtk.FALSE, 5)
        self.monitor_align = None
        self.desktop_align = None
        self.load_monitor_preview_pixmap("monitor.png")
        self.box.pack_start(self.hbox)

        hbox1 = gtk.HBox(gtk.FALSE, 5)
        hbox3 = gtk.HBox(gtk.FALSE, 5)
        hbox4 = gtk.HBox(gtk.FALSE, 5)

        frame1 = gtk.Frame(_("_Color Depth:"))
        frame1.get_label_widget().set_property("use-underline", gtk.TRUE)
        frame1.set_shadow_type(gtk.SHADOW_NONE)
        frame1.set_border_width(10)
        hbox1.pack_start(frame1, gtk.TRUE, gtk.FALSE, 0)

        # determine video modes available for this card/monitor combo
        self.avail_depth = self.xsetup.xhwstate.available_color_depths()

        self.depth_list = [(_("256 Colors (8 Bit)")),
                           (_("High Color (16 Bit)")),
                           (_("True Color (24 Bit)"))]
        self.bit_depth = [8, 16, 24]

        # create option menu for bit depth
        self.depth_optionmenu = gtk.OptionMenu()
        self.depth_menu = gtk.Menu()

        for i in range(0, len(self.depth_list)):
            if self.bit_depth[i] in self.avail_depth:
                d = self.depth_list[i]
                item = gtk.MenuItem(d)
                item.show()
                self.depth_menu.add(item)

        self.depth_optionmenu.set_menu(self.depth_menu)

        frame1.add(self.depth_optionmenu)
        frame1.get_label_widget().set_mnemonic_widget(self.depth_optionmenu)

        # now we do screen resolution
        frame2 = gtk.Frame(_("_Screen Resolution:"))
        frame2.get_label_widget().set_property("use-underline", gtk.TRUE)
        frame2.set_shadow_type(gtk.SHADOW_NONE)
        frame2.set_border_width(10)
        hbox1.pack_start(frame2, gtk.TRUE, gtk.FALSE, 2)

        self.avail_res = self.xsetup.xhwstate.available_resolutions()

        self.res_optionmenu = None
        self.res_menu = None
        self.create_res_optionmenu()

        frame2.add(self.res_optionmenu)
        frame2.get_label_widget().set_mnemonic_widget(self.res_optionmenu)

        # apply current configuration to UI
        self.selectedDepth = self.xsetup.xhwstate.get_colordepth()
        self.selectedRes = self.xsetup.xhwstate.get_resolution()

        if self.selectedDepth not in self.avail_depth:
            self.selectedDepth = self.avail_depth[-1]

        idx = self.avail_depth.index(self.selectedDepth)
        self.depth_optionmenu.set_history(idx)

        if self.selectedRes not in self.avail_res:
            self.selectedRes = self.avail_res[-1]

        self.currentRes = self.avail_res.index(self.selectedRes)
        self.res_optionmenu.set_history(self.currentRes)
        self.swap_monitor(self.currentRes)

        self.depth_optionmenu.connect("changed", self.depth_cb)
        self.ignore_res_cb = 0
        self.res_optionmenu.connect("changed", self.res_cb)

        self.box.pack_start(hbox1, gtk.FALSE)

        #--If both KDE and GNOME are selected
        if grpset:
            gnomeSelected = (grpset.hdrlist.has_key('gnome-session')
                             and grpset.hdrlist['gnome-session'].isSelected())
            kdeSelected = (grpset.hdrlist.has_key('kdebase')
                           and grpset.hdrlist['kdebase'].isSelected())
        else:
            gnomeSelected = 0
            kdeSelected = 0

        self.newDesktop = ""
        self.origDesktop = self.desktop.getDefaultDesktop()

        if (ENABLE_DESKTOP_CHOICE) and (gnomeSelected or kdeSelected):
            hsep = gtk.HSeparator()
            self.box.pack_start(hsep)

            if gnomeSelected and kdeSelected:
                frame3 = gtk.Frame(
                    _("Please choose your default desktop environment:"))
            else:
                frame3 = gtk.Frame(_("Your desktop environment is:"))

            frame3.set_shadow_type(gtk.SHADOW_NONE)
            hbox3.pack_start(frame3, gtk.TRUE, gtk.FALSE, 2)

            self.hbox4 = gtk.HBox()
            frame3.add(self.hbox4)

            # need to have this around so self.display_desktop_pixmap()
            # will work later. (messy)
            self.vbox4 = gtk.VBox()

            if gnomeSelected and kdeSelected:
                vbox3 = gtk.VBox()

                gnome_radio = gtk.RadioButton(None, (_("GNO_ME")))
                vbox3.pack_start(gnome_radio, gtk.TRUE, gtk.FALSE, 2)
                kde_radio = gtk.RadioButton(gnome_radio, (_("_KDE")))
                vbox3.pack_start(kde_radio, gtk.TRUE, gtk.FALSE, 2)

                self.hbox4.pack_start(vbox3)

                self.hbox4.pack_start(self.vbox4)

                #--Set the desktop GUI widget to what the user has selected
                if self.origDesktop == "GNOME":
                    gnome_radio.set_active(gtk.TRUE)
                    self.display_desktop_pixmap("GNOME")
                elif self.origDesktop == "KDE":
                    kde_radio.set_active(gtk.TRUE)
                    self.display_desktop_pixmap("KDE")

                gnome_radio.connect("clicked", self.desktop_cb, "GNOME")
                kde_radio.connect("clicked", self.desktop_cb, "KDE")
            else:
                self.hbox4.pack_start(gtk.Label(self.origDesktop))
                self.display_desktop_pixmap(self.origDesktop)

            self.box.pack_start(hbox3, gtk.FALSE, gtk.TRUE, 2)
        else:
            gnome_radio = None
            kde_radio = None

        hsep = gtk.HSeparator()
        self.box.pack_start(hsep)

        # see if we should allow them to choose graphical or text login
        if self.instClass.showLoginChoice:
            frame4 = gtk.Frame(_("Please choose your login type:"))
            frame4.set_shadow_type(gtk.SHADOW_NONE)
            hbox4.pack_start(frame4, gtk.TRUE, gtk.FALSE, 2)

            self.hbox5 = gtk.HBox(gtk.TRUE, 2)
            frame4.add(self.hbox5)

            self.text = gtk.RadioButton(None, (_("_Text")))
            self.graphical = gtk.RadioButton(self.text, (_("_Graphical")))

            self.runLevel = self.desktop.getDefaultRunLevel()

            if self.runLevel == 3:
                self.text.set_active(gtk.TRUE)
            elif self.runLevel == 5:
                self.graphical.set_active(gtk.TRUE)

            self.hbox5.pack_start(self.graphical, gtk.FALSE, 2)
            self.hbox5.pack_start(self.text, gtk.FALSE, 2)

            self.box.pack_start(hbox4, gtk.FALSE, gtk.TRUE, 2)

        return self.box
示例#30
0
            os.kill(os.getpid(), signal.SIGKILL)

        device = dispatch.id.floppyDevice
        file = "/tmp/floppy"
        try:
            isys.makeDevInode(device, file)
        except SystemError:
            pass
        try:
            fd = os.open(file, os.O_RDONLY)
        except:
            continue

        os.close(fd)

        if iutil.getArch() != "ia64":
            args = ['mkdosfs', '/tmp/floppy']

            cmd = "/usr/sbin/mkdosfs"

            if os.access("/sbin/mkdosfs", os.X_OK):
                cmd = "/sbin/mkdosfs"

            iutil.execWithRedirect(cmd,
                                   args,
                                   stdout='/dev/tty5',
                                   stderr='/dev/tty5')

        try:
            isys.mount(device, "/tmp/crash", fstype="vfat")
        except SystemError:
示例#31
0
def availableClasses(showHidden=0):
    global allClasses
    global allClasses_hidden

    def _ordering(first, second):
        ((name1, obj, logo), priority1) = first
        ((name2, obj, logo), priority2) = second

        if priority1 < priority2:
            return -1
        elif priority1 > priority2:
            return 1

        if name1 < name2:
            return -1
        elif name1 > name2:
            return 1

        return 0

    if not showHidden:
        if allClasses: return allClasses
    else:
        if allClasses_hidden: return allClasses_hidden

    if os.access("installclasses", os.R_OK):
	path = "installclasses"
    elif os.access("/tmp/updates/pyanaconda/installclasses", os.R_OK):
        path = "/tmp/updates/pyanaconda/installclasses"
    elif os.access("/tmp/product/pyanaconda/installclasses", os.R_OK):
        path = "/tmp/product/pyanaconda/installclasses"
    else:
        from distutils.sysconfig import get_python_lib
        path = get_python_lib(plat_specific=1) + "/pyanaconda/installclasses"

    # append the location of installclasses to the python path so we
    # can import them
    sys.path.insert(0, path)

    files = os.listdir(path)
    done = {}
    list = []
    for file in files:
	if file[0] == '.': continue
        if len (file) < 4:
	    continue
	if file[-3:] != ".py" and file[-4:-1] != ".py":
	    continue
	mainName = string.split(file, ".")[0]
	if done.has_key(mainName): continue
	done[mainName] = 1

        try:
            found = imputil.imp.find_module(mainName)
        except:
            log.warning ("module import of %s failed: %s" % (mainName, sys.exc_type))
            continue

        try:
            loaded = imputil.imp.load_module(mainName, found[0], found[1], found[2])

            obj = loaded.InstallClass

	    if obj.__dict__.has_key('sortPriority'):
		sortOrder = obj.sortPriority
	    else:
		sortOrder = 0

	    if obj.__dict__.has_key('arch'):
                if obj.arch != iutil.getArch():
                    obj.hidden = 1
                
            if obj.hidden == 0 or showHidden == 1:
                list.append(((obj.name, obj, obj.pixmap), sortOrder))
        except:
            log.warning ("module import of %s failed: %s" % (mainName, sys.exc_type))
            if flags.debug: raise
            else: continue

    list.sort(_ordering)
    for (item, priority) in list:
        if showHidden:
            allClasses_hidden.append(item)
        else:
            allClasses.append(item)

    if showHidden:
        return allClasses_hidden
    else:
        return allClasses
示例#32
0
                               "To create new partitions it must be initialized, "
                               "causing the loss of ALL DATA on this drive.\n\n"
			       "This operation will override any previous "
			       "installation choices about which drives to "
			       "ignore.\n\n"
                               "Would you like to initialize this drive, "
			       "erasing ALL DATA?")
                                           % (drive,), type = "yesno")
                    if rc == 0:
                        DiskSet.skippedDisks.append(drive)
                        continue
                    else:
                        recreate = 1

                if recreate == 1 and not flags.test:
                    if iutil.getArch() == "s390":
                        if (self.dasdFmt(intf, drive)):
                            DiskSet.skippedDisks.append(drive)
                            continue
                    else:                    
                        try:
                            disk = dev.disk_new_fresh(getDefaultDiskType())
                            disk.commit()
                        except parted.error, msg:
                            DiskSet.skippedDisks.append(drive)
                            continue
                    try:
                        disk = parted.PedDisk.new(dev)
                        self.disks[drive] = disk
                    except parted.error, msg:
                        DiskSet.skippedDisks.append(drive)
示例#33
0
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import isys, iutil
import os, os.path, stat, string, sys
from constants import *

import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)

import logging
log = logging.getLogger("anaconda")

_arch = iutil.getArch()

def findIsoImages(path, messageWindow):
    flush = os.stat(path)
    files = os.listdir(path)
    arch = _arch
    discImages = {}

    for file in files:
        what = path + '/' + file
        if not isys.isIsoImage(what):
            continue

        try:
            isys.losetup("/dev/loop2", what, readOnly = 1)
        except SystemError:
示例#34
0
def getMaxLVSize():
    """ Return the maximum size (in MB) of a logical volume. """
    if iutil.getArch() in ("x86_64", "ppc64", "alpha", "ia64", "s390", "sparc"): #64bit architectures
        return (8*1024*1024*1024*1024) #Max is 8EiB (very large number..)
    else:
        return (16*1024*1024) #Max is 16TiB