neil / rpms / anaconda

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