dpolovinkin / rpms / anaconda

Forked from rpms/anaconda 3 years ago
Clone

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

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