diff options
author | David Lehman <dlehman@redhat.com> | 2009-03-05 08:56:02 -0600 |
---|---|---|
committer | David Lehman <dlehman@redhat.com> | 2009-03-05 08:56:42 -0600 |
commit | bb6b3a050d0a007cea27bdd716280c19bb104071 (patch) | |
tree | 966ebfd209456cf1d288ecf14286bb30881d6697 /booty | |
parent | 100611e0201cc19668ca8f642dd5bc437d2749ba (diff) | |
download | anaconda-bb6b3a050d0a007cea27bdd716280c19bb104071.tar.gz anaconda-bb6b3a050d0a007cea27bdd716280c19bb104071.tar.xz anaconda-bb6b3a050d0a007cea27bdd716280c19bb104071.zip |
Stop with the fsset usage.
Diffstat (limited to 'booty')
-rw-r--r-- | booty/alpha.py | 4 | ||||
-rw-r--r-- | booty/bootloaderInfo.py | 2 | ||||
-rw-r--r-- | booty/checkbootloader.py | 2 | ||||
-rw-r--r-- | booty/ppc.py | 2 | ||||
-rw-r--r-- | booty/util.py | 33 | ||||
-rw-r--r-- | booty/x86.py | 14 |
6 files changed, 45 insertions, 12 deletions
diff --git a/booty/alpha.py b/booty/alpha.py index b5ed98a47..abd3a636a 100644 --- a/booty/alpha.py +++ b/booty/alpha.py @@ -3,11 +3,11 @@ import iutil from booty import BootyNoKernelWarning from bootloaderInfo import * -import fsset +from util import getDiskPart class alphaBootloaderInfo(bootloaderInfo): def wholeDevice (self, path): - (device, foo) = fsset.getDiskPart(path) + (device, foo) = getDiskPart(path) return device def partitionNum (self, path): diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py index 4d5c343cf..f9f684b95 100644 --- a/booty/bootloaderInfo.py +++ b/booty/bootloaderInfo.py @@ -29,13 +29,13 @@ import rhpl from rhpl.translate import _, N_ from flags import flags -from fsset import getDiskPart import iutil import isys from product import * import booty import checkbootloader +from util import getDiskPart if rhpl.getArch() not in ("s390", "s390x"): import block diff --git a/booty/checkbootloader.py b/booty/checkbootloader.py index 68cb8e13f..7c6241676 100644 --- a/booty/checkbootloader.py +++ b/booty/checkbootloader.py @@ -19,7 +19,7 @@ import os import string import rhpl -from fsset import getDiskPart +from util import getDiskPart import iutil grubConfigFile = "/etc/grub.conf" diff --git a/booty/ppc.py b/booty/ppc.py index d653052ce..a68c5938d 100644 --- a/booty/ppc.py +++ b/booty/ppc.py @@ -2,8 +2,8 @@ import string import os from booty import BootyNoKernelWarning +from util import getDiskPart from bootloaderInfo import * -import fsset import iutil import rhpl diff --git a/booty/util.py b/booty/util.py new file mode 100644 index 000000000..f9a1b3e84 --- /dev/null +++ b/booty/util.py @@ -0,0 +1,33 @@ +import string + +def getDiskPart(dev): + cut = len(dev) + if (dev.startswith('rd/') or dev.startswith('ida/') or + dev.startswith('cciss/') or dev.startswith('sx8/') or + dev.startswith('mapper/') or dev.startswith('mmcblk')): + if dev[-2] == 'p': + cut = -1 + elif dev[-3] == 'p': + cut = -2 + else: + if dev[-2] in string.digits: + cut = -2 + elif dev[-1] in string.digits: + cut = -1 + + name = dev[:cut] + + # hack off the trailing 'p' from /dev/cciss/*, for example + if name[-1] == 'p': + for letter in name: + if letter not in string.letters and letter != "/": + name = name[:-1] + break + + if cut < 0: + partNum = int(dev[cut:]) - 1 + else: + partNum = None + + return (name, partNum) + diff --git a/booty/x86.py b/booty/x86.py index 2e01935d3..de88458e8 100644 --- a/booty/x86.py +++ b/booty/x86.py @@ -2,9 +2,9 @@ import os import string from booty import BootyNoKernelWarning +from util import getDiskPart from bootloaderInfo import * import checkbootloader -import fsset import iutil import rhpl @@ -107,7 +107,7 @@ class x86BootloaderInfo(efiBootloaderInfo): cmds = [] for bootDev in bootDevs: gtPart = self.getMatchingPart(bootDev, grubTarget) - gtDisk = self.grubbyPartitionName(fsset.getDiskPart(gtPart)[0]) + gtDisk = self.grubbyPartitionName(getDiskPart(gtPart)[0]) bPart = self.grubbyPartitionName(bootDev) cmd = "root %s\n" % (bPart,) @@ -316,7 +316,7 @@ class x86BootloaderInfo(efiBootloaderInfo): devs = usedDevs.keys() usedDevs = {} for dev in devs: - drive = fsset.getDiskPart(dev)[0] + drive = getDiskPart(dev)[0] if usedDevs.has_key(drive): continue usedDevs[drive] = 1 @@ -356,10 +356,10 @@ class x86BootloaderInfo(efiBootloaderInfo): return "" def getMatchingPart(self, bootDev, target): - bootName, bootPartNum = fsset.getDiskPart(bootDev) + bootName, bootPartNum = getDiskPart(bootDev) devices = self.getPhysicalDevices(target) for device in devices: - name, partNum = fsset.getDiskPart(device) + name, partNum = getDiskPart(device) if name == bootName: return device return devices[0] @@ -368,7 +368,7 @@ class x86BootloaderInfo(efiBootloaderInfo): return "hd%d" % self.drivelist.index(name) def grubbyPartitionName(self, dev): - (name, partNum) = fsset.getDiskPart(dev) + (name, partNum) = getDiskPart(dev) if partNum != None: return "(%s,%d)" % (self.grubbyDiskName(name), partNum) else: @@ -478,7 +478,7 @@ class x86BootloaderInfo(efiBootloaderInfo): grubbyRootPart = self.grubbyPartitionName(rootDevs[0]) for rootDev in rootDevs: - testGrubbyRootDev = fsset.getDiskPart(rootDev)[0] + testGrubbyRootDev = getDiskPart(rootDev)[0] testGrubbyRootDev = self.grubbyPartitionName(testGrubbyRootDev) if grubbyStage1Dev == testGrubbyRootDev: |