zengxyz / rpms / anaconda

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