Exemple #1
0
def isPaeAvailable():
    global isPAE
    if isPAE is not None:
        return isPAE

    isPAE = False
    if rhpl.getArch() not in ("i386", "x86_64"):
        return isPAE

    try:
        f = open("/proc/iomem", "r")
        lines = f.readlines()
        for line in lines:
            if line[0].isspace():
                continue
            start = line.split(' ')[0].split('-')[0]
            start = long(start, 16)

            if start >= 0x100000000L:
                isPAE = True
                break

        f.close()
    except:
        pass

    return isPAE
Exemple #2
0
def FinishedWindow():
	bootstr = ""
	buttonstr = _("Reboot")
	screen = SnackScreen()

	if rhpl.getArch() in ['s390', 's390x']:
	  floppystr = _("Press <Enter> to end the installation process.\n\n")
	  bottomstr = _("<Enter> to exit")
	  if not anaconda.canReIPL:
		buttonstr = _("Shutdown")
	  if not anaconda.reIPLMessage is None:
		floppystr = anaconda.reIPLMessage + "\n\n" + floppystr
	else:
	  floppystr = ("Remove any media 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") %("aaa", "bbbbbbb", "ccccccccc")
	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/.") %("dddddddddddddd",)

	rc = ButtonChoiceWindow (screen, ("Complete"), txt,
							 [ buttonstr ], help = "finished", width=60)
	screen.finish()
	#return INSTALL_OK
	return 1
def getPPCMacGen():
    # XXX: should NuBus be here?
    pmacGen = ["OldWorld", "NewWorld", "NuBus"]

    if rhpl.getArch() != "ppc":
        return 0
    if getPPCMachine() != "PMac":
        return 0

    f = open("/proc/cpuinfo", "r")
    lines = f.readlines()
    f.close()
    gen = None
    for line in lines:
        if line.find("pmac-generation") != -1:
            gen = line.split(":")[1]
            break

    if gen is None:
        log.warning("Unable to find pmac-generation")

    for type in pmacGen:
        if gen.find(type) != -1:
            return type

    log.warning("Unknown Power Mac generation: %s" % (gen,))
    return 0
Exemple #4
0
def getPPCMacGen():
    # XXX: should NuBus be here?
    pmacGen = ['OldWorld', 'NewWorld', 'NuBus']

    if rhpl.getArch() != "ppc":
        return 0
    if getPPCMachine() != "PMac":
        return 0

    f = open('/proc/cpuinfo', 'r')
    lines = f.readlines()
    f.close()
    gen = None
    for line in lines:
        if line.find('pmac-generation') != -1:
            gen = line.split(':')[1]
            break

    if gen is None:
        log.warning("Unable to find pmac-generation")

    for type in pmacGen:
        if gen.find(type) != -1:
            return type

    log.warning("Unknown Power Mac generation: %s" % (gen, ))
    return 0
    def __call__(self, screen, anaconda):
        bootstr = ""
        buttonstr = _("Reboot")

        if rhpl.getArch() in ["s390", "s390x"]:
            floppystr = _("Press <Enter> to end the installation process.\n\n")
            bottomstr = _("<Enter> to exit")
            if not anaconda.canReIPL:
                buttonstr = _("Shutdown")
            if not anaconda.reIPLMessage is None:
                floppystr = anaconda.reIPLMessage + "\n\n" + floppystr
        else:
            floppystr = _(
                "Remove any media 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, [buttonstr], help="finished", width=60)

        return INSTALL_OK
Exemple #6
0
def isPaeAvailable():
    global isPAE
    if isPAE is not None:
        return isPAE

    isPAE = False
    if rhpl.getArch() not in ("i386", "x86_64"):
        return isPAE

    try:
        f = open("/proc/iomem", "r")
        lines = f.readlines()
        for line in lines:
            if line[0].isspace():
                continue
            start = line.split(' ')[0].split('-')[0]
            start = long(start, 16)

            if start >= 0x100000000L:
                isPAE = True
                break

        f.close()
    except:
        pass

    return isPAE
Exemple #7
0
    def available(self):
        ksdevice = None
        if flags.cmdline.has_key("ksdevice"):
            ksdevice = flags.cmdline["ksdevice"]

        f = open("/proc/net/dev")
        lines = f.readlines()
        f.close()
        # skip first two lines, they are header
        lines = lines[2:]
        for line in lines:
            dev = string.strip(line[0:6])
            if dev != "lo" and dev[
                    0:3] != "sit" and not self.netdevices.has_key(dev):
                if self.firstnetdevice is None:
                    self.firstnetdevice = dev

                self.netdevices[dev] = NetworkDevice(dev)

                try:
                    hwaddr = isys.getMacAddress(dev)
                    if rhpl.getArch(
                    ) != "s390" and hwaddr and hwaddr != "00:00:00:00:00:00" and hwaddr != "ff:ff:ff:ff:ff:ff":
                        self.netdevices[dev].set(("hwaddr", hwaddr))
                except Exception, e:
                    log.error("exception getting mac addr: %s" % (e, ))
    def getScreen (self, anaconda):
        hbox = gtk.HBox (False, 5)
        
        pix = gui.readImageFromFile ("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, False, False, 36)

        bootstr = ""
        if rhpl.getArch() in ['s390', 's390x']:
            floppystr = ""
            if not anaconda.canReIPL:
                self.rebootButton.set_label(_("Shutdown"))
            if not anaconda.reIPLMessage is None:
                floppystr = anaconda.reIPLMessage

        else:
            floppystr = _("Remove any media 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)
	label = gui.WrappingLabel(txt)

        hbox.pack_start (label, True, True)

        gtk.gdk.beep()
        return hbox
Exemple #9
0
def makeInitrd(kernelTag, instRoot):
    if rhpl.getArch() == 'ia64':
        initrd = "/boot/efi/EFI/redhat/initrd%s.img" % (kernelTag, )
    else:
        initrd = "/boot/initrd%s.img" % (kernelTag, )

    return initrd
    def toEntry(self, partitions):
        """Turn a request into a fsset entry and return the entry."""
        device = self.getDevice(partitions)

        # pin down our partitions so that we can reread the table
        device.solidify()

        if self.fstype.getName() == "swap":
            mountpoint = "swap"
        else:
            mountpoint = self.mountpoint

        entry = fsset.FileSystemSetEntry(device, mountpoint, self.fstype,
                                         origfsystem=self.origfstype,
                                         bytesPerInode=self.bytesPerInode,
                                         options=self.fsopts)
        if self.format:
            entry.setFormat(self.format)

        if self.migrate:
            entry.setMigrate(self.migrate)
        elif rhpl.getArch() == "ia64" \
                and entry.getMountPoint() == "/boot/efi" \
                and isinstance(self.origfstype, fsset.FATFileSystem) \
                and not entry.getFormat():
            entry.setMigrate(1)

        if self.badblocks:
            entry.setBadblocks(self.badblocks)

        if self.fslabel:
            entry.setLabel(self.fslabel)

        return entry
Exemple #11
0
def upgradeMigrateFind(anaconda):
    migents = anaconda.id.fsset.getMigratableEntries()
    if not migents or len(migents) < 1 or \
            (rhpl.getArch() == "ia64" and len(migents) == 1 and \
             migents[0].getMountPoint() == "/boot/efi"):
        anaconda.dispatch.skipStep("upgrademigratefs")
    else:
        anaconda.dispatch.skipStep("upgrademigratefs", skip=0)
Exemple #12
0
def upgradeMigrateFind(anaconda):
    migents = anaconda.id.fsset.getMigratableEntries()
    if not migents or len(migents) < 1 or \
            (rhpl.getArch() == "ia64" and len(migents) == 1 and \
             migents[0].getMountPoint() == "/boot/efi"):
        anaconda.dispatch.skipStep("upgrademigratefs")
    else:
        anaconda.dispatch.skipStep("upgrademigratefs", skip = 0)
Exemple #13
0
    def setSteps(self, dispatch):
        dispatch.setStepList(
            "language", "keyboard", "welcome", "installtype", "regkey",
            "findrootparts", "findinstall", "partitionobjinit", "upgrademount",
            "upgrademigfind", "upgrademigratefs", "upgradecontinue",
            "reposetup", "upgbootloader", "reipl", "checkdeps", "dependencies",
            "confirmupgrade", "postselection", "install", "migratefilesystems",
            "preinstallconfig", "installpackages", "postinstallconfig",
            "instbootloader", "dopostaction", "writeregkey", "methodcomplete",
            "copylogs", "complete")

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

        if rhpl.getArch() != "i386" and rhpl.getArch() != "x86_64":
            dispatch.skipStep("upgbootloader")
    def getScreen(self, anaconda):

        self.fsset = anaconda.id.fsset
        self.migent = self.fsset.getMigratableEntries()

        box = gtk.VBox(False, 5)
        box.set_border_width(5)

        text = N_("This release of %s supports "
                  "the ext3 journalling file system.  It has several "
                  "benefits over the ext2 file system traditionally shipped "
                  "in %s.  It is possible to migrate the ext2 "
                  "formatted partitions to ext3 without data loss.\n\n"
                  "Which of these partitions would you like to migrate?" %
                  (productName, productName))

        label = gtk.Label(_(text))
        label.set_alignment(0.5, 0.0)
        label.set_size_request(400, -1)
        label.set_line_wrap(True)
        box.pack_start(label, False)

        cbox = gtk.VBox(False, 5)
        self.cbs = []
        for entry in self.migent:
            if rhpl.getArch() == "ia64" \
                    and entry.getMountPoint() == "/boot/efi":
                continue
            if entry.fsystem.getName() != entry.origfsystem.getName():
                migrating = 1
            else:
                migrating = 0

            cb = gtk.CheckButton(
                "/dev/%s - %s - %s" %
                (entry.device.getDevice(), entry.origfsystem.getName(),
                 entry.mountpoint))
            cb.set_active(migrating)
            cbox.pack_start(cb, False)

            self.cbs.append((cb, entry))

        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        sw.add_with_viewport(cbox)
        sw.set_size_request(-1, 175)

        viewport = sw.get_children()[0]
        viewport.set_shadow_type(gtk.SHADOW_IN)

        a = gtk.Alignment(0.25, 0.5)
        a.add(sw)

        box.pack_start(a, True)

        a = gtk.Alignment(0.5, 0.5)
        a.add(box)
        return a
    def getScreen (self, anaconda):
      
        self.fsset = anaconda.id.fsset
        self.migent = self.fsset.getMigratableEntries()
        
        box = gtk.VBox (False, 5)
        box.set_border_width (5)

	text = N_("This release of %s supports "
                 "the ext3 journalling file system.  It has several "
                 "benefits over the ext2 file system traditionally shipped "
                 "in %s.  It is possible to migrate the ext2 "
                 "formatted partitions to ext3 without data loss.\n\n"
                 "Which of these partitions would you like to migrate?" %
                  (productName, productName))
        
	label = gtk.Label (_(text))
        label.set_alignment (0.5, 0.0)
        label.set_size_request(400, -1)
        label.set_line_wrap (True)
        box.pack_start(label, False)

        cbox = gtk.VBox(False, 5)
        self.cbs = []
        for entry in self.migent:
            if rhpl.getArch() == "ia64" \
                    and entry.getMountPoint() == "/boot/efi":
                continue
            if entry.fsystem.getName() != entry.origfsystem.getName():
                migrating = 1
            else:
                migrating = 0
            
            cb = gtk.CheckButton("/dev/%s - %s - %s" % (entry.device.getDevice(),
                                              entry.origfsystem.getName(),
                                              entry.mountpoint))
            cb.set_active(migrating)
            cbox.pack_start(cb, False)

            self.cbs.append((cb, entry))

        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        sw.add_with_viewport(cbox)
        sw.set_size_request(-1, 175)
        
        viewport = sw.get_children()[0]
        viewport.set_shadow_type(gtk.SHADOW_IN)
        
        a = gtk.Alignment(0.25, 0.5)
        a.add(sw)

        box.pack_start(a, True)
        
        a = gtk.Alignment(0.5, 0.5)
        a.add(box)
        return a
def copyExceptionToFloppy(anaconda):
    # in test mode have save to floppy option just copy to new name
    if not flags.setupFilesystems:
        try:
            shutil.copyfile("/tmp/anacdump.txt", "/tmp/test-anacdump.txt")
        except:
            log.error("Failed to copy anacdump.txt to /tmp/test-anacdump.txt")
            pass

        anaconda.intf.__del__()
        return 2

    while 1:
        # Bail if they hit the cancel button.
        rc = anaconda.intf.dumpWindow()
        if rc:
            return 1

        device = anaconda.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 rhpl.getArch() != "ia64":
            cmd = "/usr/sbin/mkdosfs"

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

            iutil.execWithRedirect(cmd, ["/tmp/floppy"],
                                   stdout='/dev/tty5',
                                   stderr='/dev/tty5')

        try:
            isys.mount(device, "/tmp/crash", fstype="vfat")
        except SystemError:
            continue

        # copy trace dump we wrote to local storage to floppy
        try:
            shutil.copyfile("/tmp/anacdump.txt", "/tmp/crash/anacdump.txt")
        except:
            log.error("Failed to copy anacdump.txt to floppy")
            return 2

        isys.umount("/tmp/crash")
        return 0
Exemple #17
0
def readFATLabel(device, makeDevNode = 1):
    if not rhpl.getArch() == "ia64":
        return None
    if makeDevNode:
        makeDevInode(device, "/tmp/disk")
        label = _readFATLabel("/tmp/disk")
        os.unlink("/tmp/disk")
    else:
        label = _readFATLabel(device)
    return label
Exemple #18
0
def readFATLabel(device, makeDevNode = 1):
    if not rhpl.getArch() == "ia64":
        return None
    if makeDevNode:
        makeDevInode(device, "/tmp/disk")
        label = _readFATLabel("/tmp/disk")
        os.unlink("/tmp/disk")
    else:
        label = _readFATLabel(device)
    return label
Exemple #19
0
def copyExceptionToFloppy (anaconda):
    # in test mode have save to floppy option just copy to new name
    if not flags.setupFilesystems:
        try:
            shutil.copyfile("/tmp/anacdump.txt", "/tmp/test-anacdump.txt")
        except:
            log.error("Failed to copy anacdump.txt to /tmp/test-anacdump.txt")
            pass

        anaconda.intf.__del__ ()
        return 2

    while 1:
        # Bail if they hit the cancel button.
        rc = anaconda.intf.dumpWindow()
        if rc:
            return 1

        device = anaconda.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 rhpl.getArch() != "ia64":
            cmd = "/usr/sbin/mkdosfs"

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

            iutil.execWithRedirect (cmd, ["/tmp/floppy"], stdout = '/dev/tty5',
                                    stderr = '/dev/tty5')

        try:
            isys.mount(device, "/tmp/crash", fstype = "vfat")
        except SystemError:
            continue

        # copy trace dump we wrote to local storage to floppy
        try:
            shutil.copyfile("/tmp/anacdump.txt", "/tmp/crash/anacdump.txt")
        except:
            log.error("Failed to copy anacdump.txt to floppy")
            return 2

        isys.umount("/tmp/crash")
        return 0
Exemple #20
0
def has_iscsi():
    find_iscsi_files()
    if ISCSID == "" or not has_libiscsi or rhpl.getArch() in ("s390", "s390x"):
        return False

    log.info("ISCSID is %s" % (ISCSID,))

    # make sure the module is loaded
    if not os.access("/sys/module/iscsi_tcp", os.X_OK):
        return False
    return True
Exemple #21
0
def has_iscsi():
    find_iscsi_files()
    if ISCSID == "" or not has_libiscsi or rhpl.getArch() in ("s390", "s390x"):
        return False

    log.info("ISCSID is %s" % (ISCSID, ))

    # make sure the module is loaded
    if not os.access("/sys/module/iscsi_tcp", os.X_OK):
        return False
    return True
Exemple #22
0
def installNewKernelImages(kernelList,
                           backupSuffix="rpmsave",
                           test=0,
                           filename=None):
    """Add the kernels in kernelList to the current boot loader config file"""

    if rhpl.getArch() == 'i386':
        return __installNewKernelImagesX86(kernelList, backupSuffix, test,
                                           filename)
    elif rhpl.getArch() == 'ia64':
        return __installNewKernelImagesIA64(kernelList, backupSuffix, test,
                                            filename)
    elif rhpl.getArch() == 'ppc':
        return __installNewKernelImagesPPC(kernelList, backupSuffix, test,
                                           filename)
    elif rhpl.getArch() == 'sparc':
        return __installNewKernelImagesSparc(kernelList, backupSuffix, test,
                                             filename)
    else:
        raise RuntimeError, "Don't know how to add new kernels for %s" % \
              (rhpl.getArch(),)
def getPPCMachine():

    if rhpl.getArch() != "ppc":
        return 0

    machine = rhpl.getPPCMachine()
    if machine is None:
        log.warning("Unable to find PowerPC machine type")
    elif machine == 0:
        log.warning("Unknown PowerPC machine type: %s" % (machine,))

    return machine
Exemple #24
0
def getPPCMachine():

    if rhpl.getArch() != "ppc":
        return 0

    machine = rhpl.getPPCMachine()
    if machine is None:
        log.warning("Unable to find PowerPC machine type")
    elif machine == 0:
        log.warning("Unknown PowerPC machine type: %s" % (machine, ))

    return machine
Exemple #25
0
    def setSteps(self, dispatch):
	dispatch.setStepList(
		    "language",
		    "keyboard",
		    "welcome",
		    "installtype",
                    "findrootparts",
		    "findinstall",
                    "partitionobjinit",
                    "upgrademount",
                    "upgrademigfind",
                    "upgrademigratefs",
                    "upgradecontinue",
                    "reposetup",
                    "upgbootloader",
		    "reipl",
                    "checkdeps",
		    "dependencies",
		    "confirmupgrade",
                    "postselection",
		    "install",
                    "migratefilesystems",
                    "preinstallconfig",
                    "installpackages",
                    "postinstallconfig",
                    "instbootloader",
                    "dopostaction",
                    "writeregkey",
                    "methodcomplete",
                    "copylogs",
		    "complete"
		)

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

        if rhpl.getArch() != "i386" and rhpl.getArch() != "x86_64":
            dispatch.skipStep("upgbootloader")            
def getPPCMacBook():
    if rhpl.getArch() != "ppc":
        return 0
    if getPPCMachine() != "PMac":
        return 0

    f = open("/proc/cpuinfo", "r")
    lines = f.readlines()
    f.close()

    for line in lines:
        if not string.find(string.lower(line), "book") == -1:
            return 1
    return 0
Exemple #27
0
def getPPCMacBook():
    if rhpl.getArch() != "ppc":
        return 0
    if getPPCMachine() != "PMac":
        return 0

    f = open('/proc/cpuinfo', 'r')
    lines = f.readlines()
    f.close()

    for line in lines:
        if not string.find(string.lower(line), 'book') == -1:
            return 1
    return 0
def hasiSeriesNativeStorage():
    if rhpl.getArch() != "ppc":
        return

    f = open("/proc/modules", "r")
    lines = f.readlines()
    f.close()

    for line in lines:
        if line.startswith("ibmsis"):
            return 1
        if line.startswith("ipr"):
            return 1

    return 0
Exemple #29
0
def hasiSeriesNativeStorage():
    if rhpl.getArch() != "ppc":
        return

    f = open("/proc/modules", "r")
    lines = f.readlines()
    f.close()

    for line in lines:
        if line.startswith("ibmsis"):
            return 1
        if line.startswith("ipr"):
            return 1

    return 0
def isMactel():
    global mactel
    if mactel is not None:
        return mactel

    if rhpl.getArch() not in ("x86_64", "i386"):
        mactel = False
    elif not os.path.exists("/usr/sbin/dmidecode"):
        mactel = False
    else:
        buf = execWithCapture("/usr/sbin/dmidecode", ["dmidecode", "-s", "system-manufacturer"])
        if buf.lower().find("apple") != -1:
            mactel = True
        else:
            mactel = False
    return mactel
    def getNext (self):
        for entry in self.migent:
            if rhpl.getArch() == "ia64" \
                    and entry.getMountPoint() == "/boot/efi":
                continue
            entry.setFormat(0)
            entry.setMigrate(0)
            entry.fsystem = entry.origfsystem

        for (cb, entry) in self.cbs:
            if cb.get_active():
                entry.setFileSystemType(fileSystemTypeGet("ext3"))
                entry.setFormat(0)
                entry.setMigrate(1)
                
        return None
    def getNext(self):
        for entry in self.migent:
            if rhpl.getArch() == "ia64" \
                    and entry.getMountPoint() == "/boot/efi":
                continue
            entry.setFormat(0)
            entry.setMigrate(0)
            entry.fsystem = entry.origfsystem

        for (cb, entry) in self.cbs:
            if cb.get_active():
                entry.setFileSystemType(fileSystemTypeGet("ext3"))
                entry.setFormat(0)
                entry.setMigrate(1)

        return None
Exemple #33
0
    def reset(self):
        # Reset everything except: 
        #
        #	- The mouse
        #	- The install language
        #	- The keyboard

        self.instClass = None
        self.network = network.Network()
        self.iscsi = iscsi.iscsi()
        self.zfcp = zfcp.ZFCP()
        self.firewall = firewall.Firewall()
        self.security = security.Security()
        self.timezone = timezone.Timezone()
        self.abiquo = abiquo.Abiquo()
        self.abiquo_rs = abiquo_rs.AbiquoRS()
        self.abiquo_v2v = abiquo_v2v.AbiquoV2V()
        self.users = None
        self.rootPassword = { "isCrypted": False, "password": "" }
        self.abiquoPassword = "******"
        self.abiquoPasswordHex = "c69a39bd64ffb77ea7ee3369dce742f3"
        self.auth = "--enableshadow --enablemd5"
        self.desktop = desktop.Desktop()
        self.upgrade = None
        # XXX move fsset and/or diskset into Partitions object?
        self.fsset.reset()
        self.diskset = partedUtils.DiskSet(self.anaconda)
        self.partitions = partitions.Partitions()
        self.bootloader = bootloader.getBootloader()
        self.dependencies = []
        self.dbpath = None
        self.upgradeRoot = None
        self.rootParts = None
        self.upgradeSwapInfo = None
        self.upgradeDeps = ""
        self.upgradeRemove = []
        self.upgradeInfoFound = None

        if rhpl.getArch() == "s390":
            self.firstboot = FIRSTBOOT_SKIP
        else:
            self.firstboot = FIRSTBOOT_DEFAULT

        # XXX I expect this to die in the future when we have a single data
        # class and translate ksdata into that instead.
        self.ksdata = None
Exemple #34
0
def isMactel():
    global mactel
    if mactel is not None:
        return mactel

    if rhpl.getArch() not in ("x86_64", "i386"):
        mactel = False
    elif not os.path.exists("/usr/sbin/dmidecode"):
        mactel = False
    else:
        buf = execWithCapture("/usr/sbin/dmidecode",
                              ["dmidecode", "-s", "system-manufacturer"])
        if buf.lower().find("apple") != -1:
            mactel = True
        else:
            mactel = False
    return mactel
def isCell():
    global cell
    if cell is not None:
        return cell

    cell = False
    if rhpl.getArch() != "ppc":
        return cell

    f = open("/proc/cpuinfo", "r")
    lines = f.readlines()
    f.close()

    for line in lines:
        if not string.find(line, "Cell") == -1:
            cell = True

    return cell
Exemple #36
0
def isCell():
    global cell
    if cell is not None:
        return cell

    cell = False
    if rhpl.getArch() != "ppc":
        return cell

    f = open('/proc/cpuinfo', 'r')
    lines = f.readlines()
    f.close()

    for line in lines:
        if not string.find(line, 'Cell') == -1:
            cell = True

    return cell
Exemple #37
0
def getBootloader():
    """Get the bootloader info object for your architecture"""
    if rhpl.getArch() == 'i386':
        return x86BootloaderInfo()
    elif rhpl.getArch() == 'ia64':
        return ia64BootloaderInfo()
    elif rhpl.getArch() == 's390' or rhpl.getArch() == "s390x":
        return s390BootloaderInfo()
    elif rhpl.getArch() == "alpha":
        return alphaBootloaderInfo()
    elif rhpl.getArch() == "x86_64":
        return x86BootloaderInfo()
    elif rhpl.getPPCMachine() == "iSeries":
        return iseriesBootloaderInfo()
    elif rhpl.getArch() == "ppc":
        return ppcBootloaderInfo()
    elif rhpl.getArch() == "sparc":
        return sparcBootloaderInfo()
    else:
        return bootloaderInfo()
Exemple #38
0
    def writeKS(self, f, desktop, ksconfig):
        if self.skipx:
            f.write("skipx\n")
            return

        # We don't want to write out the X config arguments unless they
        # were previously specified in kickstart.
        args = []
        if desktop:
	    rl = desktop.getDefaultRunLevel() 
	    if rl and str(rl) == '5': 
		args += ['--startxonboot'] 
	    gui = desktop.getDefaultDesktop() 
	    if gui: 
		args += ['--defaultdesktop', string.lower(gui)] 

        # We don't want anything else on s390.
        if rhpl.getArch() == "s390" and args != []:
            f.write("xconfig %s\n" % string.join(args, " "))

        if ksconfig:
            if ksconfig.xconfig["driver"] != "":
                args += [ "--driver", ksconfig.xconfig["driver"] ]
            if ksconfig.xconfig["videoRam"] != "":
                args += [ "--videoram", ksconfig.xconfig["videoRam"] ]
            if ksconfig.xconfig["resolution"] != "":
                args += [ "--resolution", ksconfig.xconfig["resolution"] ]
            if ksconfig.xconfig["depth"] != 0:
                args += [ "--depth", str(ksconfig.xconfig["depth"]) ]

        if args != []:
            f.write("xconfig %s\n" % string.join(args, " "))

        args = []
        if ksconfig:
            if ksconfig.monitor["monitor"] != "":
                args += [ "--monitor", ksconfig.monitor["monitor"] ]
            if ksconfig.monitor["hsync"] != "":
                args += [ "--hsync", ksconfig.monitor["hsync"] ]
            if ksconfig.monitor["vsync"] != "":
                args += [ "--vsync", ksconfig.monitor["vsync"] ]

        if args != []:
            f.write("monitor %s\n" % string.join(args, " "))
Exemple #39
0
    def writeKS(self, f, desktop, ksconfig):
        if self.skipx:
            f.write("skipx\n")
            return

        # We don't want to write out the X config arguments unless they
        # were previously specified in kickstart.
        args = []
        if desktop:
            rl = desktop.getDefaultRunLevel()
            if rl and str(rl) == '5':
                args += ['--startxonboot']
            gui = desktop.getDefaultDesktop()
            if gui:
                args += ['--defaultdesktop', string.lower(gui)]

        # We don't want anything else on s390.
        if rhpl.getArch() == "s390" and args != []:
            f.write("xconfig %s\n" % string.join(args, " "))

        if ksconfig:
            if ksconfig.xconfig["driver"] != "":
                args += ["--driver", ksconfig.xconfig["driver"]]
            if ksconfig.xconfig["videoRam"] != "":
                args += ["--videoram", ksconfig.xconfig["videoRam"]]
            if ksconfig.xconfig["resolution"] != "":
                args += ["--resolution", ksconfig.xconfig["resolution"]]
            if ksconfig.xconfig["depth"] != 0:
                args += ["--depth", str(ksconfig.xconfig["depth"])]

        if args != []:
            f.write("xconfig %s\n" % string.join(args, " "))

        args = []
        if ksconfig:
            if ksconfig.monitor["monitor"] != "":
                args += ["--monitor", ksconfig.monitor["monitor"]]
            if ksconfig.monitor["hsync"] != "":
                args += ["--hsync", ksconfig.monitor["hsync"]]
            if ksconfig.monitor["vsync"] != "":
                args += ["--vsync", ksconfig.monitor["vsync"]]

        if args != []:
            f.write("monitor %s\n" % string.join(args, " "))
def getPPCMacID():
    machine = None

    if rhpl.getArch() != "ppc":
        return 0
    if getPPCMachine() != "PMac":
        return 0

    f = open("/proc/cpuinfo", "r")
    lines = f.readlines()
    f.close()
    for line in lines:
        if line.find("machine") != -1:
            machine = line.split(":")[1]
            machine = machine.strip()
            return machine

    log.warning("No Power Mac machine id")
    return 0
Exemple #41
0
def getPPCMacID():
    machine = None

    if rhpl.getArch() != "ppc":
        return 0
    if getPPCMachine() != "PMac":
        return 0

    f = open('/proc/cpuinfo', 'r')
    lines = f.readlines()
    f.close()
    for line in lines:
        if line.find('machine') != -1:
            machine = line.split(':')[1]
            machine = machine.strip()
            return machine

    log.warning("No Power Mac machine id")
    return 0
def cpuFeatureFlags():
    """Convenience function to get CPU feature flags from /proc/cpuinfo."""

    if rhpl.getArch() not in ("i386", "x86_64"):
        return False
    f = open("/proc/cpuinfo", "r")
    lines = f.readlines()
    f.close()

    for line in lines:
        if not line.startswith("flags"):
            continue
        # get the actual flags
        flags = line[:-1].split(":", 1)[1]
        # and split them
        flst = flags.split(" ")
        return flst

    return []
Exemple #43
0
def cpuFeatureFlags():
    """Convenience function to get CPU feature flags from /proc/cpuinfo."""

    if rhpl.getArch() not in ("i386", "x86_64"):
        return False
    f = open("/proc/cpuinfo", "r")
    lines = f.readlines()
    f.close()

    for line in lines:
        if not line.startswith("flags"):
            continue
        # get the actual flags
        flags = line[:-1].split(":", 1)[1]
        # and split them
        flst = flags.split(" ")
        return flst

    return []
Exemple #44
0
    def reset(self):
        # Reset everything except:
        #
        #	- The mouse
        #	- The install language
        #	- The keyboard

        self.instClass = None
        self.network = network.Network()
        self.iscsi = iscsi.iscsi()
        self.zfcp = zfcp.ZFCP()
        self.firewall = firewall.Firewall()
        self.security = security.Security()
        self.timezone = timezone.Timezone()
        self.users = None
        self.rootPassword = {"isCrypted": False, "password": ""}
        self.auth = "--enableshadow --enablemd5"
        self.desktop = desktop.Desktop()
        self.upgrade = None
        # XXX move fsset and/or diskset into Partitions object?
        self.fsset.reset()
        self.diskset = partedUtils.DiskSet(self.anaconda)
        self.partitions = partitions.Partitions()
        self.bootloader = bootloader.getBootloader()
        self.dependencies = []
        self.dbpath = None
        self.upgradeRoot = None
        self.rootParts = None
        self.upgradeSwapInfo = None
        self.upgradeDeps = ""
        self.upgradeRemove = []
        self.upgradeInfoFound = None

        if rhpl.getArch() == "s390":
            self.firstboot = FIRSTBOOT_SKIP
        else:
            self.firstboot = FIRSTBOOT_DEFAULT

    # XXX I expect this to die in the future when we have a single data
    # class and translate ksdata into that instead.
        self.ksdata = None
def doReIPL(anaconda):
    if not rhpl.getArch() in ['s390', 's390x']:
        return DISPATCH_NOOP

    messageInfo = iutil.reIPL(anaconda, os.getppid())

    # @TBD seeing a bug here where anaconda.canReIPL and anaconda.reIPLMessage are
    # not initialized even though they were in Anaconda.__init__()
    if messageInfo is None:
        anaconda.canReIPL = True

        anaconda.reIPLMessage = None
    else:
        anaconda.canReIPL = False

        (errorMessage, rebootInstr) = messageInfo

        # errorMessage intentionally not shown in UI
        anaconda.reIPLMessage = rebootInstr

    return DISPATCH_FORWARD
    def addDrive(self, button):
        (dxml, dialog) = gui.getGladeWidget("adddrive.glade", "addDriveDialog")
        gui.addFrame(dialog)
        dialog.show_all()
        if rhpl.getArch() not in ("s390", "s390x"):
            dxml.get_widget("zfcpRadio").hide()
            dxml.get_widget("zfcpRadio").set_group(None)

        import iscsi
        if not iscsi.has_iscsi():
            dxml.get_widget("iscsiRadio").set_sensitive(False)
            dxml.get_widget("iscsiRadio").set_active(False)

        #figure out what advanced devices we have available and set sensible default
        group = dxml.get_widget("iscsiRadio").get_group()
        for button in group:
            if button is not None and button.get_property("sensitive"):
                button.set_active(True)
                break
        
        rc = dialog.run()
        dialog.hide()
        if rc == gtk.RESPONSE_CANCEL:
            return
        if dxml.get_widget("iscsiRadio").get_active():
            rc = self.addIscsiDrive()
        elif dxml.get_widget("zfcpRadio") is not None and dxml.get_widget("zfcpRadio").get_active():
            rc = self.addZfcpDrive()
        dialog.destroy()

        if rc != gtk.RESPONSE_CANCEL:
            w = self.intf.waitWindow(_("Rescanning disks"),
                                     _("Rescanning disks"))
            partitioning.partitionObjectsInitialize(self.anaconda)
            createAllowedDrivesStore(self.diskset.disks,
                                     self.partitions.autoClearPartDrives,
                                     self.drivelist,
                                     self.anaconda.updateSrc)
            w.pop()
Exemple #47
0
def doReIPL(anaconda):
    if (not rhpl.getArch() in ['s390', 's390x']
            or anaconda.dir == DISPATCH_BACK):
        return DISPATCH_NOOP

    messageInfo = iutil.reIPL(anaconda, os.getppid())

    # @TBD seeing a bug here where anaconda.canReIPL and anaconda.reIPLMessage are
    # not initialized even though they were in Anaconda.__init__()
    if messageInfo is None:
        anaconda.canReIPL = True

        anaconda.reIPLMessage = None
    else:
        anaconda.canReIPL = False

        (errorMessage, rebootInstr) = messageInfo

        # errorMessage intentionally not shown in UI
        anaconda.reIPLMessage = rebootInstr

    return DISPATCH_FORWARD
    def addDrive(self, button):
        (dxml, dialog) = gui.getGladeWidget("adddrive.glade", "addDriveDialog")
        gui.addFrame(dialog)
        dialog.show_all()
        if rhpl.getArch() not in ("s390", "s390x"):
            dxml.get_widget("zfcpRadio").hide()
            dxml.get_widget("zfcpRadio").set_group(None)

        import iscsi
        if not iscsi.has_iscsi():
            dxml.get_widget("iscsiRadio").set_sensitive(False)
            dxml.get_widget("iscsiRadio").set_active(False)

        #figure out what advanced devices we have available and set sensible default
        group = dxml.get_widget("iscsiRadio").get_group()
        for button in group:
            if button is not None and button.get_property("sensitive"):
                button.set_active(True)
                break

        rc = dialog.run()
        dialog.hide()
        if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
            return
        if dxml.get_widget("iscsiRadio").get_active():
            rc = self.addIscsiDrive()
        elif dxml.get_widget("zfcpRadio") is not None and dxml.get_widget(
                "zfcpRadio").get_active():
            rc = self.addZfcpDrive()
        dialog.destroy()

        if rc not in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
            w = self.intf.waitWindow(_("Rescanning disks"),
                                     _("Rescanning disks"))
            partitioning.partitionObjectsInitialize(self.anaconda)
            createAllowedDrivesStore(self.diskset.disks,
                                     self.partitions.autoClearPartDrives,
                                     self.drivelist, self.anaconda.updateSrc)
            w.pop()
Exemple #49
0
    def available(self):
        ksdevice = None
        if flags.cmdline.has_key("ksdevice"):
            ksdevice = flags.cmdline["ksdevice"]

        f = open("/proc/net/dev")
        lines = f.readlines()
        f.close()
        # skip first two lines, they are header
        lines = lines[2:]
        for line in lines:
            dev = string.strip(line[0:6])
            if dev != "lo" and dev[0:3] != "sit" and not self.netdevices.has_key(dev):
		if self.firstnetdevice is None:
		    self.firstnetdevice = dev

                self.netdevices[dev] = NetworkDevice(dev)

                try:
                    hwaddr = isys.getMacAddress(dev)
                    if rhpl.getArch() != "s390" and hwaddr and hwaddr != "00:00:00:00:00:00" and hwaddr != "ff:ff:ff:ff:ff:ff":
                        self.netdevices[dev].set(("hwaddr", hwaddr))
                except Exception, e:
                    log.error("exception getting mac addr: %s" %(e,))
Exemple #50
0
    def toEntry(self, partitions):
        """Turn a request into a fsset entry and return the entry."""
        device = self.getDevice(partitions)

        # pin down our partitions so that we can reread the table
        device.solidify()

        if self.fstype.getName() == "swap":
            mountpoint = "swap"
        else:
            mountpoint = self.mountpoint

        entry = fsset.FileSystemSetEntry(device,
                                         mountpoint,
                                         self.fstype,
                                         origfsystem=self.origfstype,
                                         bytesPerInode=self.bytesPerInode,
                                         options=self.fsopts)
        if self.format:
            entry.setFormat(self.format)

        if self.migrate:
            entry.setMigrate(self.migrate)
        elif rhpl.getArch() == "ia64" \
                and entry.getMountPoint() == "/boot/efi" \
                and isinstance(self.origfstype, fsset.FATFileSystem) \
                and not entry.getFormat():
            entry.setMigrate(1)

        if self.badblocks:
            entry.setBadblocks(self.badblocks)

        if self.fslabel:
            entry.setLabel(self.fslabel)

        return entry
    def setSteps(self, dispatch):
	dispatch.setStepList(
		 "language",
		 "keyboard",
		 "welcome",
                 "findrootparts",
		 "betanag",
		 "installtype",
                 "partitionobjinit",
                 "parttype",
                 "autopartitionexecute",
                 "partition",
		 "partitiondone",
		 "bootloadersetup",                 
		 "bootloader",
                 "reipl",
                 "networkdevicecheck",
		 "network",
		 "timezone",
		 "accounts",
                 "reposetup",
                 "basepkgsel",
		 "tasksel",                                  
		 "postselection",
		 "confirminstall",
		 "install",
		 "enablefilesystems",
                 "migratefilesystems",
                 "setuptime",
                 "preinstallconfig",
		 "installpackages",
                 "postinstallconfig",
		 "writeconfig",
                 "firstboot",
		 "instbootloader",
                 "dopostaction",
		 "writexconfig",
		 "writeksconfig",
                 "writeregkey",
                 "methodcomplete",
                 "copylogs",
                 "setfilecon",
		 "complete"
		)

	if not BETANAG:
	    dispatch.skipStep("betanag", permanent=1)

        if rhpl.getArch() != "i386" and rhpl.getArch() != "x86_64":
            dispatch.skipStep("bootloader", permanent=1)

        # allow install classes to turn off the upgrade 
        if self.showUpgrade == 0:
            dispatch.skipStep("findrootparts", skip = 1)

        # 'noupgrade' can be used on the command line to force not looking
        # for partitions to upgrade.  useful in some cases...
        if flags.cmdline.has_key("noupgrade"):
            dispatch.skipStep("findrootparts", skip = 1)

        # upgrade will also always force looking for an upgrade. 
        if flags.cmdline.has_key("upgrade"):
            dispatch.skipStep("findrootparts", skip = 0)

        # 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)
def mountptchangeCB(widget, fstypecombo):
    if rhpl.getArch() == "ia64" and widget.get_children()[0].get_text() == "/boot/efi":
        fstypecombo.set_active_text("vfat")
    # dont do this in test mode!
    if flags.test or flags.rootpath:
	return
    
    os.environ["TZ"] = anaconda.id.timezone.tz
    tzfile = "/usr/share/zoneinfo/" + anaconda.id.timezone.tz
    if not os.access(tzfile, os.R_OK):
        log.error("unable to set timezone")
    else:
        try:
            shutil.copyfile(tzfile, "/etc/localtime")
        except OSError, (errno, msg):
            log.error("Error copying timezone (from %s): %s" %(tzfile, msg))

    if rhpl.getArch() == "s390":
        return
    args = [ "--hctosys" ]
    if anaconda.id.timezone.utc:
        args.append("-u")
    elif anaconda.id.timezone.arc:
        args.append("-a")

    try:
        iutil.execWithRedirect("/usr/sbin/hwclock", args, stdin = None,
                               stdout = "/dev/tty5", stderr = "/dev/tty5")
    except RuntimeError:
        log.error("Failed to set clock")


# FIXME: this is a huge gross hack.  hard coded list of files
Exemple #54
0
def vtActivate(num):
    if rhpl.getArch() == "s390":
        return
    _isys.vtActivate(num)
Exemple #55
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("/mnt/source/RHupdates/installclasses", os.R_OK):
        path = "/mnt/source/RHupdates/installclasses"
    elif os.access("/tmp/updates/installclasses", os.R_OK):
        path = "/tmp/updates/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 != rhpl.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
Exemple #56
0
    def setSteps(self, dispatch):
	dispatch.setStepList(
		 "language",
		 "keyboard",
		 "welcome",
                 "findrootparts",
		 "betanag",
		 "installtype",
                 "partitionobjinit",
                 "parttype",
                 "autopartitionexecute",
                 "partition",
		 "partitiondone",
		 "bootloadersetup",                 
		 "bootloader",
		 "reipl",
                 "networkdevicecheck",
		 "network",
		 "timezone",
		 "accounts",
                 "reposetup",
                 "basepkgsel",
		 "tasksel",                                  
		 "abiquo_distributed",
		 "postselection",
		 "abiquo_password",
		 "abiquo_nfs_config",
		 "abiquo_rs",
		 "abiquo_dhcp_relay",
		 "confirminstall",
		 "install",
		 "enablefilesystems",
                 "migratefilesystems",
                 "setuptime",
                 "preinstallconfig",
		 "installpackages",
                 "postinstallconfig",
		 "writeconfig",
                 "firstboot",
		 "instbootloader",
                 "dopostaction",
		 "writexconfig",
		 "writeksconfig",
                 "writeregkey",
                 "methodcomplete",
                 "copylogs",
                 "setfilecon",
		 "complete"
		)

	if not BETANAG:
	    dispatch.skipStep("betanag", permanent=1)

        if rhpl.getArch() != "i386" and rhpl.getArch() != "x86_64":
            dispatch.skipStep("bootloader", permanent=1)

        # allow install classes to turn off the upgrade 
        if self.showUpgrade == 0:
            dispatch.skipStep("findrootparts", skip = 1)

        # 'noupgrade' can be used on the command line to force not looking
        # for partitions to upgrade.  useful in some cases...
        if flags.cmdline.has_key("noupgrade"):
            dispatch.skipStep("findrootparts", skip = 1)

        # upgrade will also always force looking for an upgrade. 
        if flags.cmdline.has_key("upgrade"):
            dispatch.skipStep("findrootparts", skip = 0)

        # 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)
    def __call__ (self, screen, anaconda):
      
        migent = anaconda.id.fsset.getMigratableEntries()

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

	text = _("This release of %s supports "
                 "the ext3 journalling file system.  It has several "
                 "benefits over the ext2 file system traditionally shipped "
                 "in %s.  It is possible to migrate the ext2 "
                 "formatted partitions to ext3 without data loss.\n\n"
                 "Which of these partitions would you like to migrate?"
                 % (productName, productName))

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

        partlist = CheckboxTree(height=4, scroll=1)
        for entry in migent:
            if rhpl.getArch() == "ia64" \
                    and entry.getMountPoint() == "/boot/efi":
                continue
            if entry.fsystem.getName() != entry.origfsystem.getName():
                migrating = 1
            else:
                migrating = 0

            partlist.append("/dev/%s - %s - %s" % (entry.device.getDevice(),
                                              entry.origfsystem.getName(),
                                              entry.mountpoint), entry, migrating)
            
	g.add(partlist, 0, 1, padding = (0, 0, 0, 1))
        
	buttons = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON] )
	g.add(buttons, 0, 3, anchorLeft = 1, growx = 1)

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

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

            # reset
            for entry in migent:
                if rhpl.getArch() == "ia64" \
                        and entry.getMountPoint() == "/boot/efi":
                    continue
                entry.setFormat(0)
                entry.setMigrate(0)
                entry.fsystem = entry.origfsystem

            for entry in partlist.getSelection():
                entry.setMigrate(1)
                entry.fsystem = fileSystemTypeGet("ext3")

            screen.popWindow()
            return INSTALL_OK
Exemple #58
0
    def __call__(self, screen, anaconda):

        migent = anaconda.id.fsset.getMigratableEntries()

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

        text = _("This release of %s supports "
                 "the ext3 journalling file system.  It has several "
                 "benefits over the ext2 file system traditionally shipped "
                 "in %s.  It is possible to migrate the ext2 "
                 "formatted partitions to ext3 without data loss.\n\n"
                 "Which of these partitions would you like to migrate?" %
                 (productName, productName))

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

        partlist = CheckboxTree(height=4, scroll=1)
        for entry in migent:
            if rhpl.getArch() == "ia64" \
                    and entry.getMountPoint() == "/boot/efi":
                continue
            if entry.fsystem.getName() != entry.origfsystem.getName():
                migrating = 1
            else:
                migrating = 0

            partlist.append(
                "/dev/%s - %s - %s" %
                (entry.device.getDevice(), entry.origfsystem.getName(),
                 entry.mountpoint), entry, migrating)

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

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

        while 1:
            result = g.run()

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

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

        # reset
            for entry in migent:
                if rhpl.getArch() == "ia64" \
                        and entry.getMountPoint() == "/boot/efi":
                    continue
                entry.setFormat(0)
                entry.setMigrate(0)
                entry.fsystem = entry.origfsystem

            for entry in partlist.getSelection():
                entry.setMigrate(1)
                entry.fsystem = fileSystemTypeGet("ext3")

            screen.popWindow()
            return INSTALL_OK
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("/mnt/source/RHupdates/installclasses", os.R_OK):
        path = "/mnt/source/RHupdates/installclasses"
    elif os.access("/tmp/updates/installclasses", os.R_OK):
        path = "/tmp/updates/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 != rhpl.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