neil / rpms / anaconda

Forked from rpms/anaconda a year ago
Clone
95c740
diff -uNr anaconda-21.48.22.56__orig/pyanaconda/installclasses/fedora.py anaconda-21.48.22.56/pyanaconda/installclasses/fedora.py
95c740
--- anaconda-21.48.22.56__orig/pyanaconda/installclasses/fedora.py	2015-10-22 17:34:02.000000000 +0100
95c740
+++ anaconda-21.48.22.56/pyanaconda/installclasses/fedora.py	2015-12-07 16:40:33.122000000 +0000
95c740
@@ -25,7 +25,7 @@
95c740
 class FedoraBaseInstallClass(BaseInstallClass):
95c740
     name = "Fedora"
95c740
     sortPriority = 10000
95c740
-    if productName.startswith("Red Hat "):
95c740
+    if productName.startswith("Red Hat ") or productName.startswith("CentOS"):
95c740
         hidden = True
95c740
 
95c740
     _l10n_domain = "anaconda"
95c740
diff -uNr anaconda-21.48.22.56__orig/pyanaconda/installclasses/centos.py anaconda-21.48.22.56/pyanaconda/installclasses/centos.py
95c740
--- anaconda-21.48.22.56__orig/pyanaconda/installclasses/centos.py	1970-01-01 01:00:00.000000000 +0100
95c740
+++ anaconda-21.48.22.56/pyanaconda/installclasses/centos.py	2015-12-07 16:52:11.157000000 +0000
95c740
@@ -0,0 +1,97 @@
33c795
+#
33c795
+# rhel.py
33c795
+#
33c795
+# Copyright (C) 2010  Red Hat, Inc.  All rights reserved.
33c795
+#
33c795
+# This program is free software; you can redistribute it and/or modify
33c795
+# it under the terms of the GNU General Public License as published by
33c795
+# the Free Software Foundation; either version 2 of the License, or
33c795
+# (at your option) any later version.
33c795
+#
33c795
+# This program is distributed in the hope that it will be useful,
33c795
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
33c795
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
33c795
+# GNU General Public License for more details.
33c795
+#
33c795
+# You should have received a copy of the GNU General Public License
33c795
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
33c795
+#
33c795
+
33c795
+from pyanaconda.installclass import BaseInstallClass
95c740
+from pyanaconda.product import productName
33c795
+from pyanaconda import network
33c795
+from pyanaconda import nm
95c740
+from pyanaconda.kickstart import getAvailableDiskSpace
95c740
+from blivet.partspec import PartSpec
95c740
+from blivet.platform import platform
95c740
+from blivet.devicelibs import swap
95c740
+from blivet.size import Size
33c795
+
95c740
+class RHELBaseInstallClass(BaseInstallClass):
95c740
+    name = "CentOS Linux"
95c740
+    sortPriority = 20001
95c740
+    if not productName.startswith("CentOS"):
95c740
+        hidden = True
33c795
+    defaultFS = "xfs"
33c795
+
33c795
+    bootloaderTimeoutDefault = 5
33c795
+
95c740
+    ignoredPackages = ["ntfsprogs", "reiserfs-utils", "hfsplus-tools"]
33c795
+
33c795
+    installUpdates = False
33c795
+
33c795
+    _l10n_domain = "comps"
33c795
+
95c740
+    efi_dir = "centos"
95c740
+
95c740
+    help_placeholder = "CentOSPlaceholder.html"
95c740
+    help_placeholder_with_links = "CentOSPlaceholderWithLinks.html"
33c795
+
33c795
+    def configure(self, anaconda):
33c795
+        BaseInstallClass.configure(self, anaconda)
95c740
+        self.setDefaultPartitioning(anaconda.storage)
33c795
+
33c795
+    def setNetworkOnbootDefault(self, ksdata):
95c740
+        if any(nd.onboot for nd in ksdata.network.network if nd.device):
33c795
+            return
95c740
+        # choose the device used during installation
95c740
+        # (ie for majority of cases the one having the default route)
95c740
+        dev = network.default_route_device() \
95c740
+              or network.default_route_device(family="inet6")
95c740
+        if not dev:
33c795
+            return
95c740
+        # ignore wireless (its ifcfgs would need to be handled differently)
95c740
+        if nm.nm_device_type_is_wifi(dev):
33c795
+            return
95c740
+        network.update_onboot_value(dev, "yes", ksdata)
33c795
+
33c795
+    def __init__(self):
33c795
+        BaseInstallClass.__init__(self)
95c740
+
95c740
+class RHELAtomicInstallClass(RHELBaseInstallClass):
95c740
+    name = "CentOS Atomic Host"
95c740
+    sortPriority=21001
95c740
+    hidden = not productName.startswith(("CentOS Atomic Host", "CentOS Linux Atomic"))
95c740
+
95c740
+    def setDefaultPartitioning(self, storage):
95c740
+        autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType,
95c740
+                                size=Size("1GiB"), maxSize=Size("3GiB"), grow=True, lv=True)]
95c740
+
95c740
+        bootreqs = platform.setDefaultPartitioning()
95c740
+        if bootreqs:
95c740
+            autorequests.extend(bootreqs)
95c740
+
95c740
+        disk_space = getAvailableDiskSpace(storage)
95c740
+        swp = swap.swapSuggestion(disk_space=disk_space)
95c740
+        autorequests.append(PartSpec(fstype="swap", size=swp, grow=False,
95c740
+                                    lv=True, encrypted=True))
95c740
+
95c740
+        for autoreq in autorequests:
95c740
+            if autoreq.fstype is None:
95c740
+                if autoreq.mountpoint == "/boot":
95c740
+                    autoreq.fstype = storage.defaultBootFSType
95c740
+                    autoreq.size = Size("300MiB")
95c740
+                else:
95c740
+                    autoreq.fstype = storage.defaultFSType
95c740
+
95c740
+        storage.autoPartitionRequests = autorequests