dpolovinkin / rpms / anaconda

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