Example #1
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
Example #2
0
    def getBootDevs(self, bl):

        retval = []
        machine = iutil.getPPCMachine()

        if machine == "pSeries":
            prep = self.pickPReP()
            if prep:
                retval.append(prep.path)
        elif machine == "PMac":
            for dev in self.storage.fsset.devices:
                if dev.format.type == "hfs" and dev.format.bootable:
                    retval.append(dev.path)

        if len(retval) == 0:
            # Try to get a boot device; bplan OF understands ext3
            if machine == "Pegasos" or machine == "Efika":
                try:
                    device = self.storage.mountpoints["/boot"]
                except KeyError:
                    # Try / if we don't have this we're not going to work
                    device = self.storage.rootDevice
                retval.append(device.path)
            else:
                if bl.getDevice():
                    d = bl.getDevice()
                    retval.append(self.storage.devicetree.getDeviceByName(d).path)

        return retval
Example #3
0
def bootloaderSetupChoices(dispatch, bl, fsset, diskSet, dir):
    if dir == DISPATCH_BACK:
        return

    choices = fsset.bootloaderChoices(diskSet, bl)
    if not choices and iutil.getPPCMachine() != "iSeries":
	dispatch.skipStep("instbootloader")
    else:
	dispatch.skipStep("instbootloader", skip = 0)

    bl.images.setup(diskSet, fsset)

    if bl.defaultDevice != None and choices:
        keys = choices.keys()
        # there are only two possible things that can be in the keys
        # mbr and boot.  boot is ALWAYS present.  so if the dev isn't
        # listed, it was mbr and we should nicely fall back to boot
        if bl.defaultDevice not in keys:
            log("MBR not suitable as boot device; installing to partition")
            bl.defaultDevice = "boot"
        bl.setDevice(choices[bl.defaultDevice][0])
    elif choices and choices.has_key("mbr"):
        bl.setDevice(choices["mbr"][0])
    elif choices and choices.has_key("boot"):
        bl.setDevice(choices["boot"][0])
    

    bootDev = fsset.getEntryByMountPoint("/")
    if not bootDev:
        bootDev = fsset.getEntryByMountPoint("/boot")
    part = partedUtils.get_partition_by_name(diskSet.disks,
                                              bootDev.device.getDevice())
    if part and partedUtils.end_sector_to_cyl(part.geom.dev,
                                               part.geom.end) >= 1024:
        bl.above1024 = 1
    def getBootDevs(self, bl):
        import parted

        retval = []
        machine = iutil.getPPCMachine()

        if machine == 'pSeries':
            for dev in self.storage.fsset.devices:
                if (dev.format.type == "prepboot" and
                        dev.partedPartition.getFlag(parted.PARTITION_BOOT)):
                    retval.append(dev.path)
        elif machine == 'PMac':
            for dev in self.storage.fsset.devices:
                if dev.format.type == "hfs" and dev.format.bootable:
                    retval.append(dev.path)

        if len(retval) == 0:
            # Try to get a boot device; bplan OF understands ext3
            if machine == 'Pegasos' or machine == 'Efika':
                try:
                    device = self.storage.mountpoints["/boot"]
                except KeyError:
                    # Try / if we don't have this we're not going to work
                    device = self.storage.rootDevice

                retval.append(device.path)
            else:
                if bl.getDevice():
                    d = bl.getDevice()
                    retval.append(self.storage.devicetree.getDeviceByName(d).path)

        return retval
def getPlatform(anaconda):
    """Check the architecture of the system and return an instance of a
       Platform subclass to match.  If the architecture could not be determined,
       raise an exception."""
    if iutil.isAlpha():
        return Alpha(anaconda)
    elif iutil.isIA64():
        return IA64(anaconda)
    elif iutil.isPPC():
        ppcMachine = iutil.getPPCMachine()

        if (ppcMachine == "PMac" and iutil.getPPCMacGen() == "NewWorld"):
            return NewWorldPPC(anaconda)
        elif ppcMachine in ["iSeries", "pSeries"]:
            return IPSeriesPPC(anaconda)
        elif ppcMachine == "PS3":
            return PS3(anaconda)
        else:
            raise SystemError, "Unsupported PPC machine type"
    elif iutil.isS390():
        return S390(anaconda)
    elif iutil.isSparc():
        return Sparc(anaconda)
    elif iutil.isX86():
        return X86(anaconda)
    else:
        raise SystemError, "Could not determine system architecture."
def getPlatform(anaconda):
    """Check the architecture of the system and return an instance of a
       Platform subclass to match.  If the architecture could not be determined,
       raise an exception."""
    if iutil.isAlpha():
        return Alpha(anaconda)
    elif iutil.isIA64():
        return IA64(anaconda)
    elif iutil.isPPC():
        ppcMachine = iutil.getPPCMachine()

        if (ppcMachine == "PMac" and iutil.getPPCMacGen() == "NewWorld"):
            return NewWorldPPC(anaconda)
        elif ppcMachine in ["iSeries", "pSeries"]:
            return IPSeriesPPC(anaconda)
        elif ppcMachine == "PS3":
            return PS3(anaconda)
        else:
            raise SystemError, "Unsupported PPC machine type"
    elif iutil.isS390():
        return S390(anaconda)
    elif iutil.isSparc():
        return Sparc(anaconda)
    elif iutil.isX86():
        return X86(anaconda)
    else:
        raise SystemError, "Could not determine system architecture."
class PPC(Platform):
    _bootFSTypes = ["ext4", "ext3", "ext2"]
    _packages = ["yaboot"]
    _ppcMachine = iutil.getPPCMachine()
    _supportsMdRaidBoot = True

    @property
    def ppcMachine(self):
        return self._ppcMachine
Example #8
0
    def __init__(self, hdlist, compatPackages = None, noscore = 0,
                 prunePPCKernels = 1):
        self.hdlist = hdlist
	self.packages = {}
	newCompat = []
        self.hasFullHeaders = 0
	for h in hdlist:
	    name = h[rpm.RPMTAG_NAME]

            # we should only keep kernel-pseries and kernel-iseries on
            # the appropriate machine
            if prunePPCKernels and name == "kernel-pseries" and iutil.getPPCMachine() != "pSeries":
                continue
            if prunePPCKernels and name == "kernel-iseries" and iutil.getPPCMachine() != "iSeries":
                continue

            # FIXME: this is a really bad hack so that we can try to avoid
            # weirdness with kernel packages
            if prunePPCKernels and (name == "kernel-iseries" or name == "kernel-pseries"):
                self.packages["kernel"] = Package(h)
            
            if noscore:
                self.packages[name] = Package(h)
                continue
	    score1 = rpm.archscore(h['arch'])
	    if (score1):
		if self.packages.has_key(name):
		    score2 = rpm.archscore(self.packages[name].h['arch'])
		    if (score1 < score2):
			newCompat.append(self.packages[name])
			self.packages[name] = Package(h)
		    else:
			newCompat.append(Package(h))
		else:
		    self.packages[name] = Package(h)
        if hdlist and not self.packages:
            raise RuntimeError, ("the header list was read, but no packages "
                                 "matching architecture '%s' were found."
                                 % os.uname()[4])

	if compatPackages != None:
            compatPackages.extend(newCompat)
class PPC(Platform):
    _bootFSTypes = ["ext4", "ext3", "ext2"]
    _packages = ["yaboot"]
    _ppcMachine = iutil.getPPCMachine()
    _supportsMdRaidBoot = True

    @property
    def ppcMachine(self):
        return self._ppcMachine

    def checkBootRequest(self, req):
        errors = Platform.checkBootRequest(self, req)

        if req != self.bootDevice():
            # yaboot cannot find /boot on a logical partition
            if hasattr(req, "partedPartition") and req.isLogical:
                errors.append(
                    _("The boot partition must be a primary partition."))

        return errors
Example #10
0
    def writeYaboot(self, instRoot, bl, kernelList, chainList, defaultDev):

        yabootTarget = string.join(self.getBootDevs(bl))

        try:
            bootDev = self.storage.mountpoints["/boot"]

            cf = "/boot/etc/yaboot.conf"
            cfPath = ""
            if not os.path.isdir(instRoot + "/boot/etc"):
                os.mkdir(instRoot + "/boot/etc")
        except KeyError:
            bootDev = self.storage.rootDevice

            cfPath = "/boot"
            cf = "/etc/yaboot.conf"

        if bootDev.type == "mdarray":
            partNumber = bootDev.parents[0].partedPartition.number
        else:
            partNumber = bootDev.partedPartition.number

        f = open(instRoot + cf, "w+")

        f.write("# yaboot.conf generated by anaconda\n\n")
        f.write("boot=%s\n" % (yabootTarget,))
        f.write('init-message="Welcome to %s!\\nHit <TAB> for boot options"\n\n' % productName)

        f.write("partition=%s\n" % partNumber)
        f.write("timeout=%s\n" % ((self.timeout or 8) * 10))
        f.write("install=/usr/lib/yaboot/yaboot\n")
        f.write("delay=5\n")
        f.write("enablecdboot\n")
        f.write("enableofboot\n")
        f.write("enablenetboot\n")

        yabootProg = "/sbin/mkofboot"
        if iutil.getPPCMachine() == "PMac":
            # write out the first hfs/hfs+ partition as being macosx
            for (label, longlabel, device) in chainList:
                if (not label) or (label == ""):
                    continue
                f.write("macosx=/dev/%s\n" % (device,))
                break

            f.write("magicboot=/usr/lib/yaboot/ofboot\n")

        elif iutil.getPPCMachine() == "pSeries":
            f.write("nonvram\n")
            f.write("fstype=raw\n")

        else:  #  Default non-destructive case for anything else.
            f.write("nonvram\n")
            f.write("mntpoint=/boot/yaboot\n")
            f.write("usemount\n")
            if not os.access(instRoot + "/boot/yaboot", os.R_OK):
                os.mkdir(instRoot + "/boot/yaboot")
            yabootProg = "/sbin/ybin"

        if self.password:
            f.write("password=%s\n" % (self.password,))
            f.write("restricted\n")

        f.write("\n")

        rootDev = self.storage.rootDevice

        for (label, longlabel, version) in kernelList:
            kernelTag = "-" + version
            kernelFile = "%s/vmlinuz%s" % (cfPath, kernelTag)

            f.write("image=%s\n" % (kernelFile,))
            f.write("\tlabel=%s\n" % (label,))
            f.write("\tread-only\n")

            initrd = self.makeInitrd(kernelTag, instRoot)
            if initrd:
                f.write("\tinitrd=%s/%s\n" % (cfPath, initrd))

            append = "%s" % (self.args.get(),)

            realroot = rootDev.fstabSpec
            if rootIsDevice(realroot):
                f.write("\troot=%s\n" % (realroot,))
            else:
                if len(append) > 0:
                    append = "%s root=%s" % (append, realroot)
                else:
                    append = "root=%s" % (realroot,)

            if len(append) > 0:
                f.write('\tappend="%s"\n' % (append,))
            f.write("\n")

        f.close()
        os.chmod(instRoot + cf, 0600)

        # FIXME: hack to make sure things are written to disk
        import isys

        isys.sync()
        isys.sync()
        isys.sync()

        ybinargs = [yabootProg, "-f", "-C", cf]

        rc = iutil.execWithRedirect(ybinargs[0], ybinargs[1:], stdout="/dev/tty5", stderr="/dev/tty5", root=instRoot)
        if rc:
            return rc

        if not os.access(instRoot + "/etc/yaboot.conf", os.R_OK) and os.access(
            instRoot + "/boot/etc/yaboot.conf", os.R_OK
        ):
            os.symlink("../boot/etc/yaboot.conf", instRoot + "/etc/yaboot.conf")

        return 0
Example #11
0
    def writeYaboot(self, instRoot, bl, kernelList, 
                    chainList, defaultDev):

        yabootTarget = string.join(self.getBootDevs(bl))

        try:
            bootDev = self.storage.mountpoints["/boot"]

            cf = "/boot/etc/yaboot.conf"
            cfPath = ""
            if not os.path.isdir(instRoot + "/boot/etc"):
                os.mkdir(instRoot + "/boot/etc")
        except KeyError:
            bootDev = self.storage.rootDevice

            cfPath = "/boot"
            cf = "/etc/yaboot.conf"

        if bootDev.type == "mdarray":
            partNumber = bootDev.parents[0].partedPartition.number
        else:
            partNumber = bootDev.partedPartition.number

        f = open(instRoot + cf, "w+")

        f.write("# yaboot.conf generated by anaconda\n\n")
        f.write("boot=%s\n" %(yabootTarget,))
        f.write("init-message=\"Welcome to %s!\\nHit <TAB> for boot options\"\n\n"
                % productName)

        f.write("partition=%s\n" % partNumber)
        f.write("timeout=%s\n" % ((self.timeout or 8) * 10))
        f.write("install=/usr/lib/yaboot/yaboot\n")
        f.write("delay=5\n")
        f.write("enablecdboot\n")
        f.write("enableofboot\n")
        f.write("enablenetboot\n")        

        yabootProg = "/sbin/mkofboot"
        if iutil.getPPCMachine() == "PMac":
            # write out the first hfs/hfs+ partition as being macosx
            for (label, longlabel, device) in chainList:
                if ((not label) or (label == "")):
                    continue
                f.write("macosx=/dev/%s\n" %(device,))
                break
            
            f.write("magicboot=/usr/lib/yaboot/ofboot\n")

        elif iutil.getPPCMachine() == "pSeries":
            f.write("nonvram\n")
            f.write("fstype=raw\n")

        else: #  Default non-destructive case for anything else.
            f.write("nonvram\n")
            f.write("mntpoint=/boot/yaboot\n")
            f.write("usemount\n")
            if not os.access(instRoot + "/boot/yaboot", os.R_OK):
                os.mkdir(instRoot + "/boot/yaboot")
            yabootProg = "/sbin/ybin"

        if self.password:
            f.write("password=%s\n" %(self.password,))
            f.write("restricted\n")

        f.write("\n")

        rootDev = self.storage.rootDevice

        for (label, longlabel, version) in kernelList:
            kernelTag = "-" + version
            kernelFile = "%s/vmlinuz%s" %(cfPath, kernelTag)

            f.write("image=%s\n" %(kernelFile,))
            f.write("\tlabel=%s\n" %(label,))
            f.write("\tread-only\n")

            initrd = self.makeInitrd(kernelTag, instRoot)
            if initrd:
                f.write("\tinitrd=%s/%s\n" %(cfPath, initrd))

            append = "%s" %(self.args.get(),)

            realroot = rootDev.fstabSpec
            if rootIsDevice(realroot):
                f.write("\troot=%s\n" %(realroot,))
            else:
                if len(append) > 0:
                    append = "%s root=%s" %(append,realroot)
                else:
                    append = "root=%s" %(realroot,)

            if len(append) > 0:
                f.write("\tappend=\"%s\"\n" %(append,))
            f.write("\n")

        f.close()
        os.chmod(instRoot + cf, 0600)

        # FIXME: hack to make sure things are written to disk
        import isys
        isys.sync()
        isys.sync()
        isys.sync()

        ybinargs = [ yabootProg, "-f", "-C", cf ]

        rc = iutil.execWithRedirect(ybinargs[0],
                                    ybinargs[1:],
                                    stdout = "/dev/tty5",
                                    stderr = "/dev/tty5",
                                    root = instRoot)
        if rc:
            return rc

        if (not os.access(instRoot + "/etc/yaboot.conf", os.R_OK) and
            os.access(instRoot + "/boot/etc/yaboot.conf", os.R_OK)):
            os.symlink("../boot/etc/yaboot.conf",
                       instRoot + "/etc/yaboot.conf")

        return 0
Example #12
0
def bootloaderSetupChoices(anaconda):
    if anaconda.dir == DISPATCH_BACK:
        rc = anaconda.intf.messageWindow(_("Warning"),
                _("Filesystems have already been activated.  You "
                  "cannot go back past this point.\n\nWould you like to "
                  "continue with the installation?"),
                type="custom", custom_icon=["error","error"],
                custom_buttons=[_("_Exit installer"), _("_Continue")])

        if rc == 0:
            sys.exit(0)
        return DISPATCH_FORWARD

    if anaconda.ksdata and anaconda.ksdata.bootloader.driveorder:
        anaconda.bootloader.updateDriveList(anaconda.ksdata.bootloader.driveorder)
    else:
        #We want the selected bootloader drive to be preferred
        pref = anaconda.bootloader.drivelist[:1]
        anaconda.bootloader.updateDriveList(pref)

    if iutil.isEfi() and not anaconda.bootloader.device:
        bootPart = None
        partitions = anaconda.storage.partitions
        for part in partitions:
            if part.partedPartition.active and isEfiSystemPartition(part.partedPartition):
                bootPart = part.name
                break
        if bootPart:
            anaconda.bootloader.setDevice(bootPart)

# iSeries bootloader on upgrades
    if iutil.getPPCMachine() == "iSeries" and not anaconda.bootloader.device:
        bootPart = None
        partitions = anaconda.storage.partitions
        for part in partitions:
            if part.partedPartition.active and \
               part.partedPartition.getFlag(parted.PARTITION_PREP):
                bootPart = part.name
                break
        if bootPart:
            anaconda.bootloader.setDevice(bootPart)

    choices = anaconda.platform.bootloaderChoices(anaconda.bootloader)
    if not choices and iutil.getPPCMachine() != "iSeries":
	anaconda.dispatch.skipStep("instbootloader")
    else:
	anaconda.dispatch.skipStep("instbootloader", skip = 0)

    # FIXME: ...
    anaconda.bootloader.images.setup(anaconda.storage)

    if anaconda.bootloader.defaultDevice != None and choices:
        keys = choices.keys()
        # there are only two possible things that can be in the keys
        # mbr and boot.  boot is ALWAYS present.  so if the dev isn't
        # listed, it was mbr and we should nicely fall back to boot
        if anaconda.bootloader.defaultDevice not in keys:
            log.warning("MBR not suitable as boot device; installing to partition")
            anaconda.bootloader.defaultDevice = "boot"
        anaconda.bootloader.setDevice(choices[anaconda.bootloader.defaultDevice][0])
    elif choices and iutil.isMactel() and choices.has_key("boot"): # haccckkkk
        anaconda.bootloader.setDevice(choices["boot"][0])        
    elif choices and choices.has_key("mbr"):
        anaconda.bootloader.setDevice(choices["mbr"][0])
    elif choices and choices.has_key("boot"):
        anaconda.bootloader.setDevice(choices["boot"][0])
Example #13
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)
Example #14
0
def bootloaderSetupChoices(anaconda):
    if anaconda.dir == DISPATCH_BACK:
        return

    # FIXME: this is a hack...
    if flags.livecd:
        return 

    if anaconda.id.ksdata:
        anaconda.id.bootloader.updateDriveList(anaconda.id.ksdata.bootloader["driveorder"])
    else:
        anaconda.id.bootloader.updateDriveList()

# iSeries bootloader on upgrades
    if iutil.getPPCMachine() == "iSeries" and not anaconda.id.bootloader.device:        
        drives = anaconda.id.diskset.disks.keys()
        drives.sort()
        bootPart = None
        for drive in drives:
            disk = anaconda.id.diskset.disks[drive]
            part = disk.next_partition()
            while part:
                if part.is_active() and part.native_type == 0x41:
                    bootPart = partedUtils.get_partition_name(part)
                    break
                part = disk.next_partition(part)
            if bootPart:
                break
        if bootPart:
            anaconda.id.bootloader.setDevice(bootPart)
            dev = Device()
            dev.device = bootPart
            anaconda.id.fsset.add(FileSystemSetEntry(dev, None, fileSystemTypeGet("PPC PReP Boot")))

    choices = anaconda.id.fsset.bootloaderChoices(anaconda.id.diskset, anaconda.id.bootloader)
    if not choices and iutil.getPPCMachine() != "iSeries":
	anaconda.dispatch.skipStep("instbootloader")
    else:
	anaconda.dispatch.skipStep("instbootloader", skip = 0)

    anaconda.id.bootloader.images.setup(anaconda.id.diskset, anaconda.id.fsset)

    if anaconda.id.bootloader.defaultDevice != None and choices:
        keys = choices.keys()
        # there are only two possible things that can be in the keys
        # mbr and boot.  boot is ALWAYS present.  so if the dev isn't
        # listed, it was mbr and we should nicely fall back to boot
        if anaconda.id.bootloader.defaultDevice not in keys:
            log.warning("MBR not suitable as boot device; installing to partition")
            anaconda.id.bootloader.defaultDevice = "boot"
        anaconda.id.bootloader.setDevice(choices[anaconda.id.bootloader.defaultDevice][0])
    elif choices and iutil.isMactel() and choices.has_key("boot"): # haccckkkk
        anaconda.id.bootloader.setDevice(choices["boot"][0])        
    elif choices and choices.has_key("mbr") and not \
         (choices.has_key("boot") and choices["boot"][1] == N_("RAID Device")):
        anaconda.id.bootloader.setDevice(choices["mbr"][0])
    elif choices and choices.has_key("boot"):
        anaconda.id.bootloader.setDevice(choices["boot"][0])
    

    bootDev = anaconda.id.fsset.getEntryByMountPoint("/")
    if not bootDev:
        bootDev = anaconda.id.fsset.getEntryByMountPoint("/boot")
    part = partedUtils.get_partition_by_name(anaconda.id.diskset.disks,
                                              bootDev.device.getDevice())
    if part and partedUtils.end_sector_to_cyl(part.geom.dev,
                                               part.geom.end) >= 1024:
        anaconda.id.bootloader.above1024 = 1
Example #15
0
def bootloaderSetupChoices(anaconda):
    if anaconda.dir == DISPATCH_BACK:
        return

    # FIXME: this is a hack...
    if flags.livecd:
        return

    if anaconda.id.ksdata:
        anaconda.id.bootloader.updateDriveList(
            anaconda.id.ksdata.bootloader["driveorder"])
    else:
        anaconda.id.bootloader.updateDriveList()


# iSeries bootloader on upgrades
    if iutil.getPPCMachine(
    ) == "iSeries" and not anaconda.id.bootloader.device:
        drives = anaconda.id.diskset.disks.keys()
        drives.sort()
        bootPart = None
        for drive in drives:
            disk = anaconda.id.diskset.disks[drive]
            part = disk.next_partition()
            while part:
                if part.is_active() and part.native_type == 0x41:
                    bootPart = partedUtils.get_partition_name(part)
                    break
                part = disk.next_partition(part)
            if bootPart:
                break
        if bootPart:
            anaconda.id.bootloader.setDevice(bootPart)
            dev = Device()
            dev.device = bootPart
            anaconda.id.fsset.add(
                FileSystemSetEntry(dev, None,
                                   fileSystemTypeGet("PPC PReP Boot")))

    choices = anaconda.id.fsset.bootloaderChoices(anaconda.id.diskset,
                                                  anaconda.id.bootloader)
    if not choices and iutil.getPPCMachine() != "iSeries":
        anaconda.dispatch.skipStep("instbootloader")
    else:
        anaconda.dispatch.skipStep("instbootloader", skip=0)

    anaconda.id.bootloader.images.setup(anaconda.id.diskset, anaconda.id.fsset)

    if anaconda.id.bootloader.defaultDevice != None and choices:
        keys = choices.keys()
        # there are only two possible things that can be in the keys
        # mbr and boot.  boot is ALWAYS present.  so if the dev isn't
        # listed, it was mbr and we should nicely fall back to boot
        if anaconda.id.bootloader.defaultDevice not in keys:
            log.warning(
                "MBR not suitable as boot device; installing to partition")
            anaconda.id.bootloader.defaultDevice = "boot"
        anaconda.id.bootloader.setDevice(
            choices[anaconda.id.bootloader.defaultDevice][0])
    elif choices and iutil.isMactel() and choices.has_key("boot"):  # haccckkkk
        anaconda.id.bootloader.setDevice(choices["boot"][0])
    elif choices and choices.has_key("mbr") and not \
         (choices.has_key("boot") and choices["boot"][1] == N_("RAID Device")):
        anaconda.id.bootloader.setDevice(choices["mbr"][0])
    elif choices and choices.has_key("boot"):
        anaconda.id.bootloader.setDevice(choices["boot"][0])

    bootDev = anaconda.id.fsset.getEntryByMountPoint("/")
    if not bootDev:
        bootDev = anaconda.id.fsset.getEntryByMountPoint("/boot")
    part = partedUtils.get_partition_by_name(anaconda.id.diskset.disks,
                                             bootDev.device.getDevice())
    if part and partedUtils.end_sector_to_cyl(part.geom.dev,
                                              part.geom.end) >= 1024:
        anaconda.id.bootloader.above1024 = 1