[PATCH 3/4] Remove another code duplication in grub upgrade code.

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

 



This is one of follow-up commits for commit
358a9a34f496fdd2b032edf12274a146b606d1a4, dealing with upgrade.
---
 bootloader.py |    3 +--
 booty/x86.py  |   25 ++++---------------------
 2 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/bootloader.py b/bootloader.py
index 3960851..54a37b5 100644
--- a/bootloader.py
+++ b/bootloader.py
@@ -126,8 +126,7 @@ def writeBootloader(anaconda):
     if anaconda.id.bootloader.defaultDevice == -1:
         return
 
-    # now make the upgrade stuff work for kickstart too. ick.
-    if anaconda.isKickstart and anaconda.id.bootloader.doUpgradeOnly:
+    if anaconda.id.bootloader.doUpgradeOnly:
         (bootType, theDev) = checkbootloader.getBootloaderTypeAndBoot(anaconda.rootPath, storage=anaconda.id.storage)
         
         anaconda.id.bootloader.doUpgradeonly = 1
diff --git a/booty/x86.py b/booty/x86.py
index ce446d2..9106bb0 100644
--- a/booty/x86.py
+++ b/booty/x86.py
@@ -495,30 +495,13 @@ class x86BootloaderInfo(efiBootloaderInfo):
         if justConfigFile:
             return ""
 
-        theDev = None
-        for (fn, stanza) in [ ("/etc/sysconfig/grub", "boot="),
-                              ("/boot/grub/grub.conf", "#boot=") ]:
-            try:
-                f = open(instRoot + fn, "r")
-            except:
-                continue
-        
-            # the following bits of code are straight from checkbootloader.py
-            lines = f.readlines()
-            f.close()
-            for line in lines:
-                if line.startswith(stanza):
-                    theDev = checkbootloader.getBootDevString(line)
-                    break
-            if theDev is not None:
-                break
+        grubTarget = bl.getDevice()
             
-        if theDev is None:
-            # we could find the dev before, but can't now...  cry about it
+        if grubTarget is None:
             return ""
 
         # migrate info to /etc/sysconfig/grub
-        self.writeSysconfig(instRoot, theDev)
+        self.writeSysconfig(instRoot, grubTarget)
 
         # update device.map
         self.updateDeviceMap(instRoot)
@@ -535,7 +518,7 @@ class x86BootloaderInfo(efiBootloaderInfo):
             grubPath = "/boot/grub"
             cfPath = "/boot/"
 
-        return self.installGrub(instRoot, bootDev, theDev, grubPath, cfPath)
+        return self.installGrub(instRoot, bootDev, grubTarget, grubPath, cfPath)
 
     def writeSysconfig(self, instRoot, installDev):
         sysconf = '/etc/sysconfig/grub'
-- 
1.6.0.6

_______________________________________________
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