avij / rpms / anaconda

Forked from rpms/anaconda 5 years ago
Clone

Blame SOURCES/anaconda-centos-add-centos-install-class.patch

35d168
diff -uNr anaconda-19.31.79__orig/pyanaconda/installclasses/centos.py anaconda-19.31.79/pyanaconda/installclasses/centos.py
35d168
--- anaconda-19.31.79__orig/pyanaconda/installclasses/centos.py	1970-01-01 01:00:00.000000000 +0100
35d168
+++ anaconda-19.31.79/pyanaconda/installclasses/centos.py	2014-06-16 22:47:16.033891088 +0100
35d168
@@ -0,0 +1,88 @@
35d168
+#
35d168
+# rhel.py
35d168
+#
35d168
+# Copyright (C) 2010  Red Hat, Inc.  All rights reserved.
35d168
+#
35d168
+# This program is free software; you can redistribute it and/or modify
35d168
+# it under the terms of the GNU General Public License as published by
35d168
+# the Free Software Foundation; either version 2 of the License, or
35d168
+# (at your option) any later version.
35d168
+#
35d168
+# This program is distributed in the hope that it will be useful,
35d168
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
35d168
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
35d168
+# GNU General Public License for more details.
35d168
+#
35d168
+# You should have received a copy of the GNU General Public License
35d168
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
35d168
+#
35d168
+
35d168
+from pyanaconda.installclass import BaseInstallClass
35d168
+from pyanaconda.constants import *
35d168
+from pyanaconda.product import *
35d168
+from pyanaconda import network
35d168
+from pyanaconda import nm
35d168
+import types
35d168
+
35d168
+class InstallClass(BaseInstallClass):
35d168
+    # name has underscore used for mnemonics, strip if you dont need it
35d168
+    id = "centos"
35d168
+    name = N_("CentOS Linux")
35d168
+    sortPriority = 25000
35d168
+    if productName.startswith("Red Hat ") or productName.startswith("Fedora "):
35d168
+        hidden = 1
35d168
+
35d168
+    defaultFS = "xfs"
35d168
+
35d168
+    bootloaderTimeoutDefault = 5
35d168
+    bootloaderExtraArgs = []
35d168
+
35d168
+    ignoredPackages = ["ntfsprogs", "reiserfs-utils"]
35d168
+
35d168
+    installUpdates = False
35d168
+
35d168
+    _l10n_domain = "comps"
35d168
+
35d168
+    efi_dir = "redhat"
35d168
+
35d168
+    def configure(self, anaconda):
35d168
+        BaseInstallClass.configure(self, anaconda)
35d168
+        BaseInstallClass.setDefaultPartitioning(self, anaconda.storage)
35d168
+
35d168
+    # Set first boot policy regarding ONBOOT value
35d168
+    # (i.e. which network devices should be activated automatically after reboot)
35d168
+    # After switch root we set ONBOOT=no as default for all devices not activated
35d168
+    # in initramfs. Here, at the end of installation, we check and modify it eventually.
35d168
+    def setNetworkOnbootDefault(self, ksdata):
35d168
+        # if there is no device to be autoactivated after reboot
35d168
+        for devName in nm.nm_devices():
35d168
+            if nm.nm_device_type_is_wifi(devName):
35d168
+                continue
35d168
+            try:
35d168
+                onboot = nm.nm_device_setting_value(devName, "connection", "autoconnect")
35d168
+            except nm.SettingsNotFoundError:
35d168
+                continue
35d168
+            if not onboot == False:
35d168
+                return
35d168
+
35d168
+        # set ONBOOT=yes for the device used during installation
35d168
+        # (ie for majority of cases the one having the default route)
35d168
+        devName = network.default_route_device()
35d168
+        if not devName:
35d168
+            return
35d168
+        if nm.nm_device_type_is_wifi(devName):
35d168
+            return
35d168
+        ifcfg_path = network.find_ifcfg_file_of_device(devName, root_path=ROOT_PATH)
35d168
+        if not ifcfg_path:
35d168
+            return
35d168
+        ifcfg = network.IfcfgFile(ifcfg_path)
35d168
+        ifcfg.read()
35d168
+        ifcfg.set(('ONBOOT', 'yes'))
35d168
+        ifcfg.write()
35d168
+        for nd in ksdata.network.network:
35d168
+            if nd.device == devName:
35d168
+                nd.onboot = True
35d168
+                break
35d168
+
35d168
+    def __init__(self):
35d168
+        BaseInstallClass.__init__(self)
35d168
diff -uNr anaconda-19.31.79__orig/pyanaconda/installclasses/fedora.py anaconda-19.31.79/pyanaconda/installclasses/fedora.py
35d168
--- anaconda-19.31.79__orig/pyanaconda/installclasses/fedora.py	2014-04-29 01:45:59.000000000 +0100
35d168
+++ anaconda-19.31.79/pyanaconda/installclasses/fedora.py	2014-06-16 22:57:40.525890315 +0100
35d168
@@ -31,7 +31,7 @@
35d168
     id = "fedora"
35d168
     name = N_("_Fedora")
35d168
     sortPriority = 10000
35d168
-    if productName.startswith("Red Hat "):
35d168
+    if productName.startswith("Red Hat ") or productName.startswith("CentOS"):
35d168
         hidden = 1
35d168
 
35d168
     _l10n_domain = "anaconda"