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 doEditPartitionByRequest(intf, requestlist, part): """Edit a partition from the request list. intf is the interface requestlist is the list of requests partition is either the part object or the uniqueID if not a part """ if part == None: intf.messageWindow(_("Unable To Edit"), _("You must select a partition to edit"), custom_icon="error") return (None, None) if type(part) == type("RAID"): # see if device is in our partition requests, remove request = requestlist.getRequestByID(int(part)) if request: state = isNotChangable(request, requestlist) if state is not None: intf.messageWindow(_("Unable To Edit"), _("You cannot edit this partition:\n\n") + state, custom_icon="error") return (None, None) if request.type == REQUEST_RAID: return ("RAID", request) elif request.type == REQUEST_VG: return ("LVMVG", request) elif request.type == REQUEST_LV: return ("LVMLV", request) else: return (None, None) elif part.type & parted.PARTITION_FREESPACE: request = partRequests.PartitionSpec( fsset.fileSystemTypeGetDefault(), start=partedUtils.start_sector_to_cyl(part.geom.dev, part.geom.start), end=partedUtils.end_sector_to_cyl(part.geom.dev, part.geom.end), drive=[partedUtils.get_partition_drive(part)]) return ("NEW", request) elif part.type & parted.PARTITION_EXTENDED: return (None, None) ret = requestlist.containsImmutablePart(part) if ret: intf.messageWindow(_("Unable To Edit"), _("You cannot edit this " "partition, as it is an extended partition " "which contains %s") % (ret), custom_icon="error") return 0 name = partedUtils.get_partition_name(part) request = requestlist.getRequestByDeviceName(name) if request: state = isNotChangable(request, requestlist) if state is not None: intf.messageWindow(_("Unable To Edit"), _("You cannot edit this partition:\n\n") + state, custom_icon="error") return (None, None) return ("PARTITION", request) else: # shouldn't ever happen raise ValueError, ("Trying to edit non-existent partition %s" % (partedUtils.get_partition_name(part)))
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
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
def doEditPartitionByRequest(intf, requestlist, part): """Edit a partition from the request list. intf is the interface requestlist is the list of requests partition is either the part object or the uniqueID if not a part """ if part == None: intf.messageWindow(_("Unable To Edit"), _("You must select a partition to edit"), custom_icon="error") return (None, None) if type(part) == type("RAID"): # see if device is in our partition requests, remove request = requestlist.getRequestByID(int(part)) if request: state = isNotChangable(request, requestlist) if state is not None: intf.messageWindow(_("Unable To Edit"), _("You cannot edit this partition:\n\n") + state, custom_icon="error") return (None, None) if request.type == REQUEST_RAID: return ("RAID", request) elif request.type == REQUEST_VG: return ("LVMVG", request) elif request.type == REQUEST_LV: return ("LVMLV", request) else: return (None, None) elif part.type & parted.PARTITION_FREESPACE: request = partRequests.PartitionSpec(fsset.fileSystemTypeGetDefault(), start = partedUtils.start_sector_to_cyl(part.geom.dev, part.geom.start), end = partedUtils.end_sector_to_cyl(part.geom.dev, part.geom.end), drive = [ partedUtils.get_partition_drive(part) ]) return ("NEW", request) elif part.type & parted.PARTITION_EXTENDED: return (None, None) ret = requestlist.containsImmutablePart(part) if ret: intf.messageWindow(_("Unable To Edit"), _("You cannot edit this " "partition, as it is an extended partition " "which contains %s") %(ret), custom_icon="error") return 0 name = partedUtils.get_partition_name(part) request = requestlist.getRequestByDeviceName(name) if request: state = isNotChangable(request, requestlist) if state is not None: intf.messageWindow(_("Unable To Edit"), _("You cannot edit this partition:\n\n") + state, custom_icon="error") return (None, None) return ("PARTITION", request) else: # shouldn't ever happen raise ValueError, ("Trying to edit non-existent partition %s" % (partedUtils.get_partition_name(part)))