Re: [PATCH f16 beta NTH?] Default to an active network device after reboot on Fedora (ONBOOT) (#498207)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/18/2011 07:33 PM, Brian C. Lane wrote:
Sorry, I was actually wondering about the inst_class_id check. It just
seems out of place to be checking that.

Hmm, it does, did you mean using InstallClass instead? That would seem
more consistent with how we handle fedora/rhel differences.
See new patch attached please.

I made the original patch only simple and somewhat dumb bearing
in mind that this is temporary anyway (from what I've followed
in discussions, the big UX thing will change it anyway, i.e.
autoactivating device having link at the beginning of the install,
maybe keeping configuration in ksdata...).

Radek

>From d39e50dd1ca528e702938bf78ae0b162ada0df5b Mon Sep 17 00:00:00 2001
From: Radek Vykydal <rvykydal@xxxxxxxxxx>
Date: Fri, 5 Aug 2011 13:55:28 +0200
Subject: [PATCH f16-beta NTH?] Default to an active network device after reboot on Fedora (ONBOOT) (#498207)

If no device was activated during install (e.g. DVD install),
set ONBOOT=yes for first wired device having link found.
(Which means the device will be brought up after system boot).
---
 pyanaconda/__init__.py              |    2 ++
 pyanaconda/installclass.py          |    3 +++
 pyanaconda/installclasses/fedora.py |   12 ++++++++++++
 pyanaconda/yuminstall.py            |    2 ++
 4 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/__init__.py b/pyanaconda/__init__.py
index 5ba37a3..757cf98 100644
--- a/pyanaconda/__init__.py
+++ b/pyanaconda/__init__.py
@@ -290,6 +290,8 @@ class Anaconda(object):
         self.instLanguage.write(self.rootPath)
 
         self.timezone.write(self.rootPath)
+        if not self.ksdata:
+            self.instClass.setNetworkOnbootDefault(self.network)
         self.network.write()
         self.network.copyConfigToPath(instPath=self.rootPath)
         self.network.disableNMForStorageDevices(self,
diff --git a/pyanaconda/installclass.py b/pyanaconda/installclass.py
index 4c599d1..576481f 100644
--- a/pyanaconda/installclass.py
+++ b/pyanaconda/installclass.py
@@ -211,6 +211,9 @@ class BaseInstallClass(object):
 
         return self.productMatches(oldprod) and self.versionMatches(oldver) and archesEq(arch, productArch)
 
+    def setNetworkOnbootDefault(self, network):
+        """Default for autoactivation of network devices after reboot"""
+
     def __init__(self):
 	pass
 
diff --git a/pyanaconda/installclasses/fedora.py b/pyanaconda/installclasses/fedora.py
index a328038..c40a899 100644
--- a/pyanaconda/installclasses/fedora.py
+++ b/pyanaconda/installclasses/fedora.py
@@ -22,6 +22,8 @@ from pyanaconda.constants import *
 from pyanaconda.product import *
 from pyanaconda.flags import flags
 from pyanaconda import iutil
+from pyanaconda.network import hasActiveNetDev
+from pyanaconda import isys
 
 import os, types
 import gettext
@@ -122,5 +124,15 @@ class InstallClass(BaseInstallClass):
         # than two versions ago!
         return newVer >= oldVer and newVer - oldVer <= 2
 
+    def setNetworkOnbootDefault(self, network):
+        if hasActiveNetDev():
+            return
+
+        for devName, dev in network.netdevices.items():
+            if (not isys.isWirelessDevice(devName) and
+                isys.getLinkStatus(devName)):
+                dev.set(('ONBOOT', 'yes'))
+                break
+
     def __init__(self):
 	BaseInstallClass.__init__(self)
diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
index 064cf47..032e48a 100644
--- a/pyanaconda/yuminstall.py
+++ b/pyanaconda/yuminstall.py
@@ -1604,6 +1604,8 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
             if os.access("/etc/modprobe.d/anaconda.conf", os.R_OK):
                 shutil.copyfile("/etc/modprobe.d/anaconda.conf", 
                                 anaconda.rootPath + "/etc/modprobe.d/anaconda.conf")
+            if not anaconda.ksdata:
+                anaconda.instClass.setNetworkOnbootDefault(anaconda.network)
             anaconda.network.write()
             anaconda.network.copyConfigToPath(instPath=anaconda.rootPath)
             anaconda.storage.write(anaconda.rootPath)
-- 
1.7.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux