zengxyz / rpms / anaconda

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