avij / rpms / anaconda

Forked from rpms/anaconda 5 years ago
Clone

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

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