neil / rpms / anaconda

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