[PATCH rhel6] Use getDiskPart for efibootmgr (#704378)

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

 



Use the standard function for splitting the device name into
name and partition number

Tested on x86_64 EFI system

Resolves: rhbz#704378

NOTE: Try #2, get the path from the device object
---
 booty/bootloaderInfo.py |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py
index d9ab62e..7b62d6d 100644
--- a/booty/bootloaderInfo.py
+++ b/booty/bootloaderInfo.py
@@ -637,22 +637,22 @@ class efiBootloaderInfo(bootloaderInfo):
         if not os.access(link, os.R_OK):
             os.symlink("../%s" % (self.configfile), link)
 
-        ind = len(bootdev)
-        try:
-            while (bootdev[ind-1] in string.digits):
-                ind = ind - 1
-        except IndexError:
-            ind = len(bootdev) - 1
-
-        bootdisk = bootdev[:ind]
-        bootpart = bootdev[ind:]
-        if (bootdisk.startswith('ida/') or bootdisk.startswith('cciss/') or
-            bootdisk.startswith('rd/') or bootdisk.startswith('sx8/')):
-            bootdisk = bootdisk[:-1]
+        (bootdisk, bootpart) = getDiskPart(bootdev, self.storage)
+        if bootpart == None:
+            log.error("No partition for bootdev '%s'" % (bootdev,))
+            return 1
+        # getDiskPart returns a 0 indexed partition number
+        bootpart += 1
+
+        bootdev = self.storage.devicetree.getDeviceByName(bootdisk)
+        if not bootdev:
+            log.error("bootdev not found for '%s'" % (bootdisk,))
+            return 1
 
         argv = [ "efibootmgr", "-c" , "-w", "-L",
-                 productName, "-d", "/dev/%s" % bootdisk,
-                 "-p", bootpart, "-l", "\\EFI\\redhat\\" + self.bootloader ]
+                 productName, "-d", "%s" % (bootdev.path,),
+                 "-p", "%s" % (bootpart,),
+                 "-l", "\\EFI\\redhat\\" + self.bootloader ]
         rc = iutil.execWithRedirect(argv[0], argv[1:], root = instRoot,
                                     stdout = "/dev/tty5",
                                     stderr = "/dev/tty5")
-- 
1.7.4.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