neil / rpms / anaconda

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