--- platform.py | 39 ++++++++++++++++++++++++++++++++++++--- storage/__init__.py | 44 +------------------------------------------- 2 files changed, 37 insertions(+), 46 deletions(-) diff --git a/platform.py b/platform.py index 729240e..3b6021f 100644 --- a/platform.py +++ b/platform.py @@ -104,9 +104,42 @@ class Platform(object): def checkBootRequest(self, req): """Perform an architecture-specific check on the boot device. Not all - platforms may need to do any checks. Raises an exception if there - is a problem, or returns True otherwise.""" - return + platforms may need to do any checks. Returns a list of errors if + there is a problem, or [] otherwise.""" + errors = [] + + if not req: + return [_("You have not created a boot partition.")] + + if req.type == "mdarray" and req.level != 1: + errors.append(_("Bootable partitions can only be on RAID1 devices.")) + + # can't have bootable partition on LV + if req.type == "lvmlv": + errors.append(_("Bootable partitions cannot be on a logical volume.")) + + # most arches can't have boot on RAID + if req.type == "mdarray" and not self.supportsMdRaidBoot: + errors.append(_("Bootable partitions cannot be on a RAID device.")) + + # Lots of filesystems types don't support /boot. + if not req.format.bootable: + errors.append(_("Bootable partitions cannot be on an %s filesystem.") % req.format.name) + + # vfat /boot is insane. + if req == self.anaconda.id.storage.fsset.rootDevice and req.format.type == "vfat": + errors.append(_("Bootable partitions cannot be on an %s filesystem.") % req.format.type) + + if req.type == "luks/dm-crypt": + # Handle encrypted boot on a partition. + errors.append(_("Bootable partitions cannot be on an encrypted block device")) + else: + # Handle encrypted boot on more complicated devices. + for dev in map(lambda d: d.type == "luks/dm-crypt", self.anaconda.id.storage.devices): + if req in self.anaconda.id.storage.deviceDeps(dev): + errors.append(_("Bootable partitions cannot be on an encrypted block device")) + + return errors @property def diskType(self): diff --git a/storage/__init__.py b/storage/__init__.py index 3363530..f2afb07 100644 --- a/storage/__init__.py +++ b/storage/__init__.py @@ -873,49 +873,7 @@ class Storage(object): warnings.append(_("Installing on a FireWire device. This may " "or may not produce a working system.")) - if not boot: - errors.append(_("You have not created a boot partition.")) - - if (boot and boot.type == "mdarray" and - boot.level != 1): - errors.append(_("Bootable partitions can only be on RAID1 " - "devices.")) - - # can't have bootable partition on LV - if boot and boot.type == "lvmlv": - errors.append(_("Bootable partitions cannot be on a " - "logical volume.")) - - # most arches can't have boot on RAID - if boot and boot.type == "mdarray" and not self.anaconda.platform.supportsMdRaidBoot: - errors.append(_("Bootable partitions cannot be on a RAID " - "device.")) - - # Lots of filesystems types don't support /boot. - if boot and not boot.format.bootable: - errors.append(_("Bootable partitions cannot be on an %s " - "filesystem.") % boot.format.name) - - # vfat /boot is insane. - if (boot and boot == root and boot.format.type == "vfat"): - errors.append(_("Bootable partitions cannot be on an %s " - "filesystem.") % boot.format.type) - - if boot and boot.type == "luks/dm-crypt": - # Handle encrypted boot on a partition. - errors.append(_("Bootable partitions cannot be on an " - "encrypted block device")) - elif boot: - # Handle encrypted boot on more complicated devices. - for dev in map(lambda d: d.type == "luks/dm-crypt", self.devices): - if boot in self.deviceDeps(dev): - errors.append(_("Bootable partitions cannot be on an " - "encrypted block device")) - - try: - self.anaconda.platform.checkBootRequest(boot) - except DeviceError as e: - errors.append(str(e)) + errors.extend(self.anaconda.platform.checkBootRequest(boot)) if not swaps: warnings.append(_("You have not specified a swap partition. " -- 1.6.1.3 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list