dpolovinkin / rpms / anaconda

Forked from rpms/anaconda 3 years ago
Clone

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

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