[PATCH] Fix writing the default= line in grub.conf (#490756).

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

 



This was caused by trying to compare an instance of an object with a string,
which of course is never going to work.
---
 bootloader.py           |   11 ++++++-----
 booty/bootloaderInfo.py |    2 +-
 booty/s390.py           |    2 +-
 booty/x86.py            |    2 +-
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/bootloader.py b/bootloader.py
index f920952..08e874c 100644
--- a/bootloader.py
+++ b/bootloader.py
@@ -136,17 +136,18 @@ def writeBootloader(anaconda):
 
     kernelList = []
     otherList = []
-    rootDev = getattr(anaconda.id.storage.fsset.rootDevice, "name", None)
-    defaultDev = anaconda.id.bootloader.images.getDefault()
+    # getDefault needs to return a device, but that's too invasive for now.
+    rootDev = anaconda.id.storage.fsset.rootDevice
+    defaultDev = anaconda.id.storage.devicetree.getDeviceByName(anaconda.id.bootloader.images.getDefault())
 
     kernelLabel = None
     kernelLongLabel = None
 
     for (dev, (label, longlabel, type)) in anaconda.id.bootloader.images.getImages().items():
-        if (dev == rootDev) or (rootDev is None and kernelLabel is None):
+        if (rootDev is None and kernelLabel is None) or (dev == rootDev.name):
 	    kernelLabel = label
             kernelLongLabel = longlabel
-	elif dev == defaultDev:
+	elif dev == defaultDev.name:
 	    otherList = [(label, longlabel, dev)] + otherList
 	else:
 	    otherList.append((label, longlabel, dev))
@@ -175,7 +176,7 @@ def writeBootloader(anaconda):
     f.write("# UPDATEDEFAULT specifies if new-kernel-pkg should make\n"
             "# new kernels the default\n")
     # only update the default if we're setting the default to linux (#156678)
-    if rootDev == defaultDev:
+    if rootDev.name == defaultDev.name:
         f.write("UPDATEDEFAULT=yes\n")
     else:
         f.write("UPDATEDEFAULT=no\n")        
diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py
index 90073e2..8419645 100644
--- a/booty/bootloaderInfo.py
+++ b/booty/bootloaderInfo.py
@@ -333,7 +333,7 @@ class bootloaderInfo:
 
         rootDev = self.storage.fsset.rootDevice
 
-        if rootDev == defaultDev:
+        if rootDev.name == defaultDev.name:
             lilo.addEntry("default", kernelList[0][0])
         else:
             lilo.addEntry("default", chainList[0][0])
diff --git a/booty/s390.py b/booty/s390.py
index 655d028..8cddb05 100644
--- a/booty/s390.py
+++ b/booty/s390.py
@@ -27,7 +27,7 @@ class s390BootloaderInfo(bootloaderInfo):
 
         rootDev = self.storage.fsset.rootDevice
 
-        if rootDev == defaultDev:
+        if rootDev.name == defaultDev.name:
             lilo.addEntry("default", kernelList[0][0])
         else:
             lilo.addEntry("default", chainList[0][0])
diff --git a/booty/x86.py b/booty/x86.py
index 05c9feb..221186a 100644
--- a/booty/x86.py
+++ b/booty/x86.py
@@ -184,7 +184,7 @@ class x86BootloaderInfo(efiBootloaderInfo):
 
         # get the default image to boot... we have to walk and find it
         # since grub indexes by where it is in the config file
-        if defaultDev == rootDev:
+        if defaultDev.name == rootDev.name:
             default = 0
         else:
             # if the default isn't linux, it's the first thing in the
-- 
1.6.1.3

_______________________________________________
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