diff options
author | Chris Lumens <clumens@redhat.com> | 2009-03-04 14:32:07 -0500 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2009-03-04 15:37:05 -0500 |
commit | 596ffcad57ec5f51238a6c295cc3eece95388ae4 (patch) | |
tree | 69815b759ecba2741f4b488f8f54e93bdb15d52d /booty | |
parent | 1983df2711bef5e8c0f9b5730a15ac665a9f0164 (diff) | |
download | anaconda-596ffcad57ec5f51238a6c295cc3eece95388ae4.tar.gz anaconda-596ffcad57ec5f51238a6c295cc3eece95388ae4.tar.xz anaconda-596ffcad57ec5f51238a6c295cc3eece95388ae4.zip |
Add a storage instance to all bootloaderInfo subclasses.
We could pass storage around to all the various functions that will need it,
but that's a big mess. It's far easier to just set this when we create the
bootloaderInfo class and never worry about it again.
Diffstat (limited to 'booty')
-rw-r--r-- | booty/__init__.py | 18 | ||||
-rw-r--r-- | booty/alpha.py | 8 | ||||
-rw-r--r-- | booty/bootloaderInfo.py | 12 | ||||
-rw-r--r-- | booty/ia64.py | 4 | ||||
-rw-r--r-- | booty/ppc.py | 44 | ||||
-rw-r--r-- | booty/s390.py | 8 | ||||
-rw-r--r-- | booty/sparc.py | 10 | ||||
-rw-r--r-- | booty/x86.py | 18 |
8 files changed, 62 insertions, 60 deletions
diff --git a/booty/__init__.py b/booty/__init__.py index a5bc97a6a..0b1372ac3 100644 --- a/booty/__init__.py +++ b/booty/__init__.py @@ -21,28 +21,28 @@ from bootloaderInfo import * from bootloader import * # return instance of the appropriate bootloader for our arch -def getBootloader(): +def getBootloader(storage): """Get the bootloader info object for your architecture""" if rhpl.getArch() == 'i386': import x86 - return x86.x86BootloaderInfo() + return x86.x86BootloaderInfo(storage) elif rhpl.getArch() == 'ia64': import ia64 - return ia64.ia64BootloaderInfo() + return ia64.ia64BootloaderInfo(storage) elif rhpl.getArch() == 's390' or rhpl.getArch() == "s390x": import s390 - return s390.s390BootloaderInfo() + return s390.s390BootloaderInfo(storage) elif rhpl.getArch() == "alpha": import alpha - return alpha.alphaBootloaderInfo() + return alpha.alphaBootloaderInfo(storage) elif rhpl.getArch() == "x86_64": import x86 - return x86.x86BootloaderInfo() + return x86.x86BootloaderInfo(storage) elif rhpl.getArch() == "ppc": import pcc - return ppc.ppcBootloaderInfo() + return ppc.ppcBootloaderInfo(storage) elif rhpl.getArch() == "sparc": import sparc - return sparc.sparcBootloaderInfo() + return sparc.sparcBootloaderInfo(storage) else: - return bootloaderInfo() + return bootloaderInfo(storage) diff --git a/booty/alpha.py b/booty/alpha.py index 977e17ea6..e137cdd13 100644 --- a/booty/alpha.py +++ b/booty/alpha.py @@ -17,9 +17,9 @@ class alphaBootloaderInfo(bootloaderInfo): def writeAboot(self, instRoot, bl, kernelList, chainList, defaultDev, justConfig): - rootDevice = storage.fsset.mountpoints["/"] + rootDevice = self.storage.fsset.mountpoints["/"] try: - bootDevice = storage.fsset.mountpoints["/boot"] + bootDevice = self.storage.fsset.mountpoints["/boot"] except KeyError: bootDevice = rootDevice @@ -135,8 +135,8 @@ class alphaBootloaderInfo(bootloaderInfo): self.writeAboot(instRoot, bl, kernelList, chainList, defaultDev, justConfig) - def __init__(self): - bootloaderInfo.__init__(self) + def __init__(self, storage): + bootloaderInfo.__init__(self, storage) self.useGrubVal = 0 self.configfile = "/etc/aboot.conf" # self.kernelLocation is already set to what we need. diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py index 811e8fe69..e6227b683 100644 --- a/booty/bootloaderInfo.py +++ b/booty/bootloaderInfo.py @@ -344,7 +344,7 @@ class bootloaderInfo: lilo.addEntry("timeout", self.timeout or "20", replace = 0) try: - rootDev = storage.fsset.mountpoints["/"] + rootDev = self.storage.fsset.mountpoints["/"] except KeyError: raise RuntimeError, "Installing lilo, but there is no root device" @@ -499,7 +499,7 @@ class bootloaderInfo: self._drivelist = val drivelist = property(_getDriveList, _setDriveList) - def __init__(self): + def __init__(self, storage): self.args = KernelArguments() self.images = BootImages() self.device = None @@ -513,6 +513,7 @@ class bootloaderInfo: self.pure = None self.above1024 = 0 self.timeout = None + self.storage = storage # this has somewhat strange semantics. if 0, act like a normal # "install" case. if 1, update lilo.conf (since grubby won't do that) @@ -628,9 +629,12 @@ class efiBootloaderInfo(bootloaderInfo): self.removeOldEfiEntries(instRoot) self.addNewEfiEntry(instRoot) - def __init__(self, initialize = True): + def __init__(self, storage, initialize = True): if initialize: - bootloaderInfo.__init__(self) + bootloaderInfo.__init__(self, storage) + else: + self.storage = storage + if iutil.isEfi(): self._configdir = "/boot/efi/EFI/redhat" self._configname = "grub.conf" diff --git a/booty/ia64.py b/booty/ia64.py index 174c696d5..2dcee97c0 100644 --- a/booty/ia64.py +++ b/booty/ia64.py @@ -33,7 +33,7 @@ class ia64BootloaderInfo(efiBootloaderInfo): def makeInitrd(self, kernelTag): return "/boot/efi/EFI/redhat/initrd%s.img" % kernelTag - def __init__(self): - efiBootloaderInfo.__init__(self) + def __init__(self, storage): + efiBootloaderInfo.__init__(self, storage) self._configname = "elilo.conf" self._bootloader = "elilo.efi" diff --git a/booty/ppc.py b/booty/ppc.py index bf92e71e3..438813360 100644 --- a/booty/ppc.py +++ b/booty/ppc.py @@ -7,41 +7,39 @@ import iutil import rhpl class ppcBootloaderInfo(bootloaderInfo): - def getBootDevs(self, fs, bl): - import fsset + def getBootDevs(self, bl): + import parted - devs = [] + retval = [] machine = rhpl.getPPCMachine() if machine == 'pSeries': - for entry in fs.entries: - if isinstance(entry.fsystem, fsset.prepbootFileSystem) \ - and entry.format: - devs.append('/dev/%s' % (entry.device.getDevice(),)) + for dev in self.storage.fsset.devices: + if dev.partedFlags[parted.PARTITION_PREP] and not dev.format.exists: + retval.append(dev.path) elif machine == 'PMac': - for entry in fs.entries: - if isinstance(entry.fsystem, fsset.applebootstrapFileSystem) \ - and entry.format: - devs.append('/dev/%s' % (entry.device.getDevice(),)) + for dev in self.storage.fsset.devices: + if dev.format.type == "hfs" and dev.format.bootable and not dev.format.exists: + retval.append(dev.path) - if len(devs) == 0: + if len(retval) == 0: # Try to get a boot device; bplan OF understands ext3 if machine == 'Pegasos' or machine == 'Efika': try: - device = storage.fsset.mountpoints["/boot"] + device = self.storage.fsset.mountpoints["/boot"] except KeyError: try: # Try / if we don't have this we're not going to work - device = storage.fsset.mountpoints["/"] + device = self.storage.fsset.mountpoints["/"] except KeyError: - return devs + return retval - devs.append(device.path) + retval.append(device.path) else: if bl.getDevice(): - devs.append("/dev/%s" % bl.getDevice()) - return devs + retval.append(bl.getDevice().path) + return retval def writeYaboot(self, instRoot, bl, kernelList, chainList, defaultDev, justConfigFile): @@ -49,14 +47,14 @@ class ppcBootloaderInfo(bootloaderInfo): yabootTarget = string.join(self.getBootDevs(bl)) try: - bootDev = storage.fsset.mountpoints["/boot"] + bootDev = self.storage.fsset.mountpoints["/boot"] cf = "/boot/etc/yaboot.conf" cfPath = "" if not os.path.isdir(instRoot + "/boot/etc"): os.mkdir(instRoot + "/boot/etc") except KeyError: - bootDev = storage.fsset.mountpoints["/"] + bootDev = self.storage.fsset.mountpoints["/"] cfPath = "/boot" cf = "/etc/yaboot.conf" @@ -109,7 +107,7 @@ class ppcBootloaderInfo(bootloaderInfo): f.write("\n") - rootDev = storage.fsset.mountpoints["/"] + rootDev = self.storage.fsset.mountpoints["/"] for (label, longlabel, version) in kernelList: kernelTag = "-" + version @@ -176,8 +174,8 @@ class ppcBootloaderInfo(bootloaderInfo): else: self.noKernelsWarn(intf) - def __init__(self): - bootloaderInfo.__init__(self) + def __init__(self, storage): + bootloaderInfo.__init__(self, storage) self.useYabootVal = 1 self.kernelLocation = "/boot" self.configfile = "/etc/yaboot.conf" diff --git a/booty/s390.py b/booty/s390.py index a96ac0033..32d28b463 100644 --- a/booty/s390.py +++ b/booty/s390.py @@ -28,7 +28,7 @@ class s390BootloaderInfo(bootloaderInfo): lilo.delImage(label) try: - rootDev = storage.fsset.mountpoints["/"] + rootDev = self.storage.fsset.mountpoints["/"] except KeyError: raise RuntimeError, "Installing zipl, but there is no root device" @@ -124,7 +124,7 @@ class s390BootloaderInfo(bootloaderInfo): def writeZipl(self, instRoot, bl, kernelList, chainList, defaultDev, justConfigFile): images = bl.images.getImages() - rootDev = storage.fsset.mountpoints["/"] + rootDev = self.storage.fsset.mountpoints["/"] cf = '/etc/zipl.conf' self.perms = 0600 @@ -173,8 +173,8 @@ class s390BootloaderInfo(bootloaderInfo): justConfig | (not self.useZiplVal)) out = self.writeChandevConf(bl, instRoot) - def __init__(self): - bootloaderInfo.__init__(self) + def __init__(self, storage): + bootloaderInfo.__init__(self, storage) self.useZiplVal = 1 # only used on s390 self.kernelLocation = "/boot/" self.configfile = "/etc/zipl.conf" diff --git a/booty/sparc.py b/booty/sparc.py index 1de44927d..086f9786a 100644 --- a/booty/sparc.py +++ b/booty/sparc.py @@ -7,7 +7,7 @@ class sparcBootloaderInfo(bootloaderInfo): chainList, defaultDev, justConfigFile): try: - bootDev = storage.fsset.mountpoints["/boot"] + bootDev = self.storage.fsset.mountpoints["/boot"] mf = '/silo.message' cf = "/boot/silo.conf" @@ -16,7 +16,7 @@ class sparcBootloaderInfo(bootloaderInfo): if not os.path.isdir(instRoot + "/boot"): os.mkdir(instRoot + "/boot") except KeyError: - bootDev = storage.fsset.mountpoints["/"] + bootDev = self.storage.fsset.mountpoints["/"] cf = "/etc/silo.conf" mfdir = '/etc' @@ -45,7 +45,7 @@ class sparcBootloaderInfo(bootloaderInfo): f.write("default=%s\n" % (kernelList[0][0],)) f.write("\n") - rootDev = storage.fsset.mountpoints["/"] + rootDev = self.storage.fsset.mountpoints["/"] for (label, longlabel, version) in kernelList: kernelTag = "-" + version @@ -118,8 +118,8 @@ class sparcBootloaderInfo(bootloaderInfo): else: self.noKernelsWarn(intf) - def __init__(self): - bootloaderInfo.__init__(self) + def __init__(self, storage): + bootloaderInfo.__init__(self, storage) self.useSiloVal = 1 self.kernelLocation = "/boot" self._configdir = "/etc" diff --git a/booty/x86.py b/booty/x86.py index 3046cf7e5..d14cbc223 100644 --- a/booty/x86.py +++ b/booty/x86.py @@ -130,7 +130,7 @@ class x86BootloaderInfo(efiBootloaderInfo): defaultDev, justConfigFile): images = bl.images.getImages() - rootDev = storage.fsset.mountpoints["/"] + rootDev = self.storage.fsset.mountpoints["/"] # XXX old config file should be read here for upgrade @@ -161,7 +161,7 @@ class x86BootloaderInfo(efiBootloaderInfo): "after making changes to this file\n") try: - bootDev = storage.fsset.mountpoints["/boot"] + bootDev = self.storage.fsset.mountpoints["/boot"] grubPath = "/grub" cfPath = "/" f.write("# NOTICE: You have a /boot partition. This means " @@ -169,7 +169,7 @@ class x86BootloaderInfo(efiBootloaderInfo): f.write("# all kernel and initrd paths are relative " "to /boot/, eg.\n") except KeyError: - bootDev = storage.fsset.mountpoints["/"] + bootDev = self.storage.fsset.mountpoints["/"] grubPath = "/boot/grub" cfPath = "/boot/" f.write("# NOTICE: You do not have a /boot partition. " @@ -454,11 +454,11 @@ class x86BootloaderInfo(efiBootloaderInfo): # so we have to do shenanigans to get updated grub installed... # steal some more code above try: - bootDev = storage.fsset.mountpoints["/boot"] + bootDev = self.storage.fsset.mountpoints["/boot"] grubPath = "/grub" cfPath = "/" except KeyError: - bootDev = storage.fsset.mountpoints["/"] + bootDev = self.storage.fsset.mountpoints["/"] grubPath = "/boot/grub" cfPath = "/boot/" @@ -500,7 +500,7 @@ class x86BootloaderInfo(efiBootloaderInfo): cmds.append(cmd) if not justConfigFile: - self.runGrubInstall(instRoot, bootDev cmds, cfPath) + self.runGrubInstall(instRoot, bootDev, cmds, cfPath) return "" @@ -552,9 +552,9 @@ class x86BootloaderInfo(efiBootloaderInfo): return args - def __init__(self): - bootloaderInfo.__init__(self) - efiBootloaderInfo.__init__(self, initialize=False) + def __init__(self, storage): + bootloaderInfo.__init__(self, storage) + efiBootloaderInfo.__init__(self, storage, initialize=False) self._configdir = "/boot/grub" self._configname = "grub.conf" |