[PATCH 1/2] Allow /boot to be on a variety of filesystems during kickstart (#529846).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fixes an inconsistency where /boot could be on various filesystems
during interactive installs, but not during kickstart.  What filesystems
are valid is controlled by the Platform module.
---
 kickstart.py                |    8 ++++----
 platform.py                 |   28 +++++++++++++++-------------
 storage/formats/__init__.py |    2 +-
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/kickstart.py b/kickstart.py
index 1b44ed4..3471489 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -662,11 +662,11 @@ class Partition(commands.partition.F12_Partition):
             type = "EFI System Partition"
             pd.fsopts = "defaults,uid=0,gid=0,umask=0077,shortname=winnt"
             kwargs["weight"] = self.handler.anaconda.platform.weight(fstype="efi")
-        elif pd.mountpoint == "/boot":
-            type = self.handler.anaconda.platform.bootFSType
         else:
             if pd.fstype != "":
                 type = pd.fstype
+            elif pd.mountpoint == "/boot":
+                type = self.handler.anaconda.platform.defaultBootFSType
             else:
                 type = storage.defaultFSType
 
@@ -800,11 +800,11 @@ class Raid(commands.raid.F12_Raid):
                 raise KickstartValueError, formatErrorMsg(self.lineno, msg="PV partition defined multiple times")
 
             rd.mountpoint = ""
-        elif rd.mountpoint == "/boot" and self.handler.anaconda.platform.supportsMdRaidBoot:
-            type = self.handler.anaconda.platform.bootFSType
         else:
             if rd.fstype != "":
                 type = rd.fstype
+            elif rd.mountpoint == "/boot" and self.handler.anaconda.platform.supportsMdRaidBoot:
+                type = self.handler.anaconda.platform.defaultBootFSType
             else:
                 type = storage.defaultFSType
 
diff --git a/platform.py b/platform.py
index 4140c4f..fdc895a 100644
--- a/platform.py
+++ b/platform.py
@@ -38,7 +38,7 @@ class Platform(object):
        during installation.  The intent is to eventually encapsulate all the
        architecture quirks in one place to avoid lots of platform checks
        throughout anaconda."""
-    _bootFSType = "ext3"
+    _bootFSTypes = ["ext3"]
     _diskType = parted.diskType["msdos"]
     _isEfi = iutil.isEfi()
     _minimumSector = 0
@@ -71,9 +71,14 @@ class Platform(object):
         return mntDict.get("/boot", mntDict.get("/"))
 
     @property
-    def bootFSType(self):
+    def defaultBootFSType(self):
         """Return the default filesystem type for the boot partition."""
-        return self._bootFSType
+        return self._bootFSTypes[0]
+
+    @property
+    def bootFSTypes(self):
+        """Return a list of all valid filesystem types for the boot partition."""
+        return self._bootFSTypes
 
     def bootloaderChoices(self, bl):
         """Return the default list of places to install the bootloader.
@@ -118,12 +123,9 @@ class Platform(object):
         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.rootDevice and req.format.type == "vfat":
+        # Make sure /boot is on a supported FS type.  This prevents crazy
+        # things like boot on vfat.
+        if not req.format.bootable or not req.format.type in self.bootFSTypes:
             errors.append(_("Bootable partitions cannot be on an %s filesystem.") % req.format.type)
 
         if req.type == "luks/dm-crypt":
@@ -162,7 +164,7 @@ class Platform(object):
 
     def setDefaultPartitioning(self):
         """Return the default platform-specific partitioning information."""
-        return [PartSpec(mountpoint="/boot", fstype=self.bootFSType, size=200,
+        return [PartSpec(mountpoint="/boot", fstype=self.defaultBootFSType, size=200,
                          weight=self.weight(mountpoint="/boot"))]
 
     @property
@@ -195,7 +197,7 @@ class Platform(object):
         return 0
 
 class EFI(Platform):
-    _bootFSType = "ext4"
+    _bootFSTypes = ["ext4", "ext3", "ext2"]
     _diskType = parted.diskType["gpt"]
     _minBootPartSize = 50
     _maxBootPartSize = 256
@@ -285,7 +287,7 @@ class IA64(EFI):
         EFI.__init__(self, anaconda)
 
 class PPC(Platform):
-    _bootFSType = "ext4"
+    _bootFSTypes = ["ext4", "ext3", "ext2"]
     _packages = ["yaboot"]
     _ppcMachine = iutil.getPPCMachine()
     _supportsMdRaidBoot = True
@@ -456,7 +458,7 @@ class Sparc(Platform):
         return start+1
 
 class X86(EFI):
-    _bootFSType = "ext4"
+    _bootFSTypes = ["ext4", "ext3", "ext2"]
     _packages = ["grub"]
     _supportsMdRaidBoot = True
 
diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py
index ea60ccb..ab33211 100644
--- a/storage/formats/__init__.py
+++ b/storage/formats/__init__.py
@@ -47,7 +47,7 @@ def get_default_filesystem_type(boot=None):
     import platform
 
     if boot:
-        fstypes = [platform.getPlatform(None).bootFSType]
+        fstypes = [platform.getPlatform(None).defaultBootFSType]
     else:
         fstypes = default_fstypes
 
-- 
1.6.5.rc2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux