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

[PATCH 5/8] booty: move grub specific mangling of partition number to the grub code



---
 booty/alpha.py           |    4 +---
 booty/checkbootloader.py |    2 +-
 booty/ppc.py             |    1 -
 booty/sparc.py           |    3 +--
 booty/util.py            |    2 +-
 booty/x86.py             |    2 +-
 6 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/booty/alpha.py b/booty/alpha.py
index 0ed0b8a..5f742ed 100644
--- a/booty/alpha.py
+++ b/booty/alpha.py
@@ -11,10 +11,8 @@ class alphaBootloaderInfo(bootloaderInfo):
         return device
 
     def partitionNum (self, path):
-        # getDiskPart returns part numbers 0-based; we need it one based
-        # *sigh*
         (foo, partitionNumber) = getDiskPart(path, self.storage)
-        return partitionNumber + 1
+        return partitionNumber
 
     def writeAboot(self, instRoot, bl, kernelList,
                    chainList, defaultDev):
diff --git a/booty/checkbootloader.py b/booty/checkbootloader.py
index 1b1ca1d..b74a59a 100644
--- a/booty/checkbootloader.py
+++ b/booty/checkbootloader.py
@@ -199,7 +199,7 @@ def getBootloaderTypeAndBoot(instRoot, storage):
 
         if bootDev is not None:
             # XXX SILO sucks just like grub.
-            if getDiskPart(bootDev, storage)[1] != 3:
+            if getDiskPart(bootDev, storage)[1] != 4:
                 block = getBootBlock(bootDev, instRoot, storage, 1)
                 if block[24:28] == "SILO":
                     return ("SILO", bootDev)
diff --git a/booty/ppc.py b/booty/ppc.py
index 5796f5b..347add5 100644
--- a/booty/ppc.py
+++ b/booty/ppc.py
@@ -2,7 +2,6 @@ import string
 import os
 
 from booty import BootyNoKernelWarning
-from util import getDiskPart
 from bootloaderInfo import *
 import iutil
 
diff --git a/booty/sparc.py b/booty/sparc.py
index 1cb790d..871506c 100644
--- a/booty/sparc.py
+++ b/booty/sparc.py
@@ -39,8 +39,7 @@ class sparcBootloaderInfo(bootloaderInfo):
         f.write("timeout=%s\n" % (self.timeout or 50))
 
         (name, partNum) = getDiskPart(bootDev.name, self.storage)
-        partno = partNum + 1
-        f.write("partition=%s\n" % (partno,))
+        f.write("partition=%s\n" % (partNum,))
 
         if self.password:
             f.write("password=%s\n" % (self.password,))
diff --git a/booty/util.py b/booty/util.py
index 9b79e73..eab6b99 100644
--- a/booty/util.py
+++ b/booty/util.py
@@ -2,7 +2,7 @@ def getDiskPart(dev, storage):
     dev = storage.devicetree.getDeviceByName(dev)
 
     if dev.type == "partition":
-        partNum = dev.partedPartition.number - 1
+        partNum = dev.partedPartition.number
         disk = dev.disk
     else:
         partNum = None
diff --git a/booty/x86.py b/booty/x86.py
index 4df2a97..038236d 100644
--- a/booty/x86.py
+++ b/booty/x86.py
@@ -463,7 +463,7 @@ class x86BootloaderInfo(efiBootloaderInfo):
         (name, partNum) = getDiskPart(dev.name, self.storage)
         disk = self.storage.devicetree.getDeviceByName(name)
         if partNum != None:
-            return "(%s,%d)" % (self.grubbyDiskName(disk), partNum)
+            return "(%s,%d)" % (self.grubbyDiskName(disk), partNum - 1)
         else:
             return "(%s)" %(self.grubbyDiskName(disk))
 
-- 
1.7.0.1


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