zengxyz / rpms / anaconda

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