avij / rpms / anaconda

Forked from rpms/anaconda 5 years ago
Clone

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

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