diff options
author | David Lehman <dlehman@redhat.com> | 2009-03-23 22:16:35 -0500 |
---|---|---|
committer | David Lehman <dlehman@redhat.com> | 2009-03-23 22:17:17 -0500 |
commit | faee0d96c7a213acfa4edcba198ad4a398110282 (patch) | |
tree | 2ae039ceea6a481ae3ccec84df2fb1dd6b16bd6a | |
parent | 3b1206629309d766fc25d529ae3145c9532c8977 (diff) | |
download | anaconda-faee0d96c7a213acfa4edcba198ad4a398110282.tar.gz anaconda-faee0d96c7a213acfa4edcba198ad4a398110282.tar.xz anaconda-faee0d96c7a213acfa4edcba198ad4a398110282.zip |
Add EFI, Apple Bootstrap, and PPC PReP Boot formats.
-rw-r--r-- | iw/lvm_dialog_gui.py | 2 | ||||
-rw-r--r-- | iw/partition_ui_helpers_gui.py | 2 | ||||
-rw-r--r-- | platform.py | 13 | ||||
-rw-r--r-- | storage/devices.py | 4 | ||||
-rw-r--r-- | storage/devicetree.py | 12 | ||||
-rw-r--r-- | storage/formats/fs.py | 44 | ||||
-rw-r--r-- | storage/formats/prepboot.py | 52 |
7 files changed, 109 insertions, 20 deletions
diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py index 5b07b5807..5bb073213 100644 --- a/iw/lvm_dialog_gui.py +++ b/iw/lvm_dialog_gui.py @@ -417,7 +417,7 @@ class VolumeGroupEditor: newfstypeCombo = createFSTypeMenu(format, fstypechangeCB, mountCombo, - ignorefs = ["software RAID", "physical volume (LVM)", "vfat", "PPC PReP Boot", "hfs"]) + ignorefs = ["software RAID", "physical volume (LVM)", "efi", "PPC PReP Boot", "Apple Bootstrap"]) lbl.set_mnemonic_widget(newfstypeCombo) maintable.attach(newfstypeCombo, 1, 2, row, row + 1) row += 1 diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py index 5cd75c20a..fb311df44 100644 --- a/iw/partition_ui_helpers_gui.py +++ b/iw/partition_ui_helpers_gui.py @@ -229,7 +229,7 @@ def createFSTypeMenu(format, fstypechangeCB, mountCombo, def mountptchangeCB(widget, fstypecombo): if iutil.isEfi() and widget.get_children()[0].get_text() == "/boot/efi": - fstypecombo.set_active_text("efi") + fstypecombo.set_active_text(getFormat("efi").name) if widget.get_children()[0].get_text() == "/boot": fstypecombo.set_active_text(get_default_filesystem_type(boot=True)) diff --git a/platform.py b/platform.py index f1a20a471..59b87273b 100644 --- a/platform.py +++ b/platform.py @@ -170,8 +170,8 @@ class EFI(Platform): if not req.format.type.startswith("ext"): raise FSError("/boot is not ext2") elif req.format.mountpoint == "/boot/efi": - if not req.format.type.endswith("fat"): - raise FSError("/boot/efi is not vfat") + if req.format.type != "efi": + raise FSError("/boot/efi is not efi") def setDefaultPartitioning(self): ret = Platform.setDefaultPartitioning(self) @@ -236,7 +236,7 @@ class IPSeriesPPC(PPC): # We want the first PReP partition. for device in self.anaconda.id.storage.partitions: - if device.partedPartition.getFlag(parted.PARTITION_PREP): + if device.format.type == "prepboot": bootDev = device break @@ -279,9 +279,10 @@ class NewWorldPPC(PPC): bootDev = None for part in self.anaconda.id.storage.partitions: - # XXX do we need to also check the size? - if part.format.type == "hfs" and self.validBootPartSize(part.size): + if part.format.type == "appleboot" and self.validBootPartSize(part.size): bootDev = part + # if we're only picking one, it might as well be the first + break return bootDev @@ -298,7 +299,7 @@ class NewWorldPPC(PPC): else: ret["boot"] = (bootDev.name, N_("Apple Bootstrap")) for (n, device) in enumerate(self.anaconda.id.storage.partitions): - if device.format.type == "hfs" and device.bootable and device.path != bootDev.path: + if device.format.type == "appleboot" and device.path != bootDev.path: ret["boot%d" % n] = (device.path, N_("Apple Bootstrap")) return ret diff --git a/storage/devices.py b/storage/devices.py index 6494601a5..064ebc14c 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -903,6 +903,10 @@ class PartitionDevice(StorageDevice): # collect information about the partition from parted self.probe() + if self.getFlag(parted.PARTITION_PREP): + # the only way to identify a PPC PReP Boot partition is to + # check the partition type/flags, so do it here. + self.format = getFormat("prepboot", device=self.path, exists=True) else: # XXX It might be worthwhile to create a shit-simple # PartitionRequest class and pass one to this constructor diff --git a/storage/devicetree.py b/storage/devicetree.py index ae6bed9b4..63339dd05 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -1140,6 +1140,18 @@ class DeviceTree(object): kwargs["peStart"] = udev_device_get_pv_pe_start(info) except KeyError: log.debug("PV %s has no pe_start" % name) + elif format_type == "vfat": + # efi magic + if isinstance(device, PartitionDevice) and device.bootable: + efi = formats.getFormat("efi") + if efi.minSize <= device.size <= efi.maxSize: + args[0] = "efi" + elif format_type == "hfs": + # apple bootstrap magic + if isinstance(device, PartitionDevice) and device.bootable: + apple = formats.getFormat("appleboot") + if apple.minSize <= device.size <= apple.maxSize: + args[0] = "appleboot" format = formats.getFormat(*args, **kwargs) device.format = format diff --git a/storage/formats/fs.py b/storage/formats/fs.py index 2f95fe2e5..d3b708278 100644 --- a/storage/formats/fs.py +++ b/storage/formats/fs.py @@ -783,11 +783,7 @@ register_device_format(Ext4FS) class FATFS(FS): - """ FAT filesystem. - - XXX Do we want to subclass this for EFI or twiddle bootable based - on the platform? - """ + """ FAT filesystem. """ _type = "vfat" _mkfs = "mkdosfs" _labelfs = "dosfslabel" @@ -797,15 +793,23 @@ class FATFS(FS): _packages = [ "dosfstools" ] _defaultMountOptions = ["umask=0077", "shortname=winnt"] - @property - def bootable(self): - retval = self._bootable - #if self.type in platform.bootableFSTypes: - # retval = True +register_device_format(FATFS) - return retval -register_device_format(FATFS) +class EFIFS(FATFS): + _type = "efi" + _name = "EFI System Partition" + _minSize = 50 + _maxSize = 256 + _bootable = True + + @property + def supported(self): + import platform + return (isinstance(platform.getPlatform(None), platform.EFI) + and self.utilsAvailable) + +register_device_format(EFIFS) class BTRFS(FS): @@ -928,6 +932,22 @@ class HFS(FS): register_device_format(HFS) +class AppleBootstrapFS(HFS): + _type = "appleboot" + _name = "Apple Bootstrap" + _bootable = True + _minSize = 800.00 / 1024.00 + _maxSize = 1 + + @property + def supported(self): + import platform + return (isinstance(platform.getPlatform(None), platform.NewWorldPPC) + and self.utilsAvailable) + +register_device_format(AppleBootstrapFS) + + # this doesn't need to be here class HFSPlus(FS): _type = "hfs+" diff --git a/storage/formats/prepboot.py b/storage/formats/prepboot.py new file mode 100644 index 000000000..6d2174b33 --- /dev/null +++ b/storage/formats/prepboot.py @@ -0,0 +1,52 @@ +# prepboot.py +# Format class for PPC PReP Boot. +# +# Copyright (C) 2009 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# the GNU General Public License v.2, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY expressed or implied, including the implied warranties of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. You should have received a copy of the +# GNU General Public License along with this program; if not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the +# source code or documentation are not subject to the GNU General Public +# License and may only be used or replicated with the express permission of +# Red Hat, Inc. +# +# Red Hat Author(s): Dave Lehman <dlehman@redhat.com> +# + +from ..errors import * +from . import DeviceFormat, register_device_format +from parted import PARTITION_PREP + +class PPCPRePBoot(DeviceFormat): + """ Generic device format. """ + _type = "prepboot" + _name = "PPC PReP Boot" + _udevTypes = [] + partedFlag = PARTITION_PREP + _formattable = True # can be formatted + _linuxNative = True # for clearpart + _bootable = True # can be used as boot + _maxSize = 4 # maximum size in MB + _minSize = 10 # minimum size in MB + + def __init__(self, *args, **kwargs): + """ Create a PRePBoot instance. + + Keyword Arguments: + + device -- path to the underlying device + exists -- indicates whether this is an existing format + + """ + DeviceFormat.__init__(self, *args, **kwargs) + + +register_device_format(PPCPRePBoot) + |