zengxyz / rpms / anaconda

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