neil / rpms / anaconda

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