dpolovinkin / rpms / anaconda

Forked from rpms/anaconda 3 years ago
Clone

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

9d7c21
diff -uNr anaconda-19.31.79__orig/pyanaconda/installclasses/centos.py anaconda-19.31.79/pyanaconda/installclasses/centos.py
9d7c21
--- anaconda-19.31.79__orig/pyanaconda/installclasses/centos.py	1970-01-01 01:00:00.000000000 +0100
9d7c21
+++ anaconda-19.31.79/pyanaconda/installclasses/centos.py	2014-06-16 22:47:16.033891088 +0100
9d7c21
@@ -0,0 +1,88 @@
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
9d7c21
+from pyanaconda.constants import *
9d7c21
+from pyanaconda.product import *
9d7c21
+from pyanaconda import network
9d7c21
+from pyanaconda import nm
9d7c21
+import types
9d7c21
+
9d7c21
+class InstallClass(BaseInstallClass):
9d7c21
+    # name has underscore used for mnemonics, strip if you dont need it
9d7c21
+    id = "centos"
9d7c21
+    name = N_("CentOS Linux")
9d7c21
+    sortPriority = 25000
9d7c21
+    if productName.startswith("Red Hat ") or productName.startswith("Fedora "):
9d7c21
+        hidden = 1
9d7c21
+
9d7c21
+    defaultFS = "xfs"
9d7c21
+
9d7c21
+    bootloaderTimeoutDefault = 5
9d7c21
+    bootloaderExtraArgs = []
9d7c21
+
9d7c21
+    ignoredPackages = ["ntfsprogs", "reiserfs-utils"]
9d7c21
+
9d7c21
+    installUpdates = False
9d7c21
+
9d7c21
+    _l10n_domain = "comps"
9d7c21
+
9d7c21
+    efi_dir = "redhat"
9d7c21
+
9d7c21
+    def configure(self, anaconda):
9d7c21
+        BaseInstallClass.configure(self, anaconda)
9d7c21
+        BaseInstallClass.setDefaultPartitioning(self, anaconda.storage)
9d7c21
+
9d7c21
+    # Set first boot policy regarding ONBOOT value
9d7c21
+    # (i.e. which network devices should be activated automatically after reboot)
9d7c21
+    # After switch root we set ONBOOT=no as default for all devices not activated
9d7c21
+    # in initramfs. Here, at the end of installation, we check and modify it eventually.
9d7c21
+    def setNetworkOnbootDefault(self, ksdata):
9d7c21
+        # if there is no device to be autoactivated after reboot
9d7c21
+        for devName in nm.nm_devices():
9d7c21
+            if nm.nm_device_type_is_wifi(devName):
9d7c21
+                continue
9d7c21
+            try:
9d7c21
+                onboot = nm.nm_device_setting_value(devName, "connection", "autoconnect")
9d7c21
+            except nm.SettingsNotFoundError:
9d7c21
+                continue
9d7c21
+            if not onboot == False:
9d7c21
+                return
9d7c21
+
9d7c21
+        # set ONBOOT=yes for the device used during installation
9d7c21
+        # (ie for majority of cases the one having the default route)
9d7c21
+        devName = network.default_route_device()
9d7c21
+        if not devName:
9d7c21
+            return
9d7c21
+        if nm.nm_device_type_is_wifi(devName):
9d7c21
+            return
9d7c21
+        ifcfg_path = network.find_ifcfg_file_of_device(devName, root_path=ROOT_PATH)
9d7c21
+        if not ifcfg_path:
9d7c21
+            return
9d7c21
+        ifcfg = network.IfcfgFile(ifcfg_path)
9d7c21
+        ifcfg.read()
9d7c21
+        ifcfg.set(('ONBOOT', 'yes'))
9d7c21
+        ifcfg.write()
9d7c21
+        for nd in ksdata.network.network:
9d7c21
+            if nd.device == devName:
9d7c21
+                nd.onboot = True
9d7c21
+                break
9d7c21
+
9d7c21
+    def __init__(self):
9d7c21
+        BaseInstallClass.__init__(self)
9d7c21
diff -uNr anaconda-19.31.79__orig/pyanaconda/installclasses/fedora.py anaconda-19.31.79/pyanaconda/installclasses/fedora.py
9d7c21
--- anaconda-19.31.79__orig/pyanaconda/installclasses/fedora.py	2014-04-29 01:45:59.000000000 +0100
9d7c21
+++ anaconda-19.31.79/pyanaconda/installclasses/fedora.py	2014-06-16 22:57:40.525890315 +0100
9d7c21
@@ -31,7 +31,7 @@
9d7c21
     id = "fedora"
9d7c21
     name = N_("_Fedora")
9d7c21
     sortPriority = 10000
9d7c21
-    if productName.startswith("Red Hat "):
9d7c21
+    if productName.startswith("Red Hat ") or productName.startswith("CentOS"):
9d7c21
         hidden = 1
9d7c21
 
9d7c21
     _l10n_domain = "anaconda"