avij / rpms / anaconda

Forked from rpms/anaconda 5 years ago
Clone

Blame SOURCES/anaconda-centos-add-centos-install-class.patch

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