Ejemplo n.º 1
0
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.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.isEfi():
        if iutil.isMactel():
            return MacEFI(anaconda)
        else:
            return EFI(anaconda)
    elif iutil.isX86():
        return X86(anaconda)
    elif iutil.isARM():
        return ARM(anaconda)
    else:
        raise SystemError, "Could not determine system architecture."
Ejemplo n.º 2
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])
Ejemplo n.º 3
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
Ejemplo n.º 4
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