dpolovinkin / rpms / anaconda

Forked from rpms/anaconda 3 years ago
Clone

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

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