avij / rpms / anaconda

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