---
booty/alpha.py | 6 +++---
booty/bootloaderInfo.py | 21 ++++++++++++++-------
booty/ia64.py | 3 ---
booty/ppc.py | 6 +++---
booty/s390.py | 15 +++++++--------
booty/sparc.py | 6 +++---
booty/x86.py | 12 ++++++------
7 files changed, 36 insertions(+), 33 deletions(-)
diff --git a/booty/alpha.py b/booty/alpha.py
index 8384162..afdb476 100644
--- a/booty/alpha.py
+++ b/booty/alpha.py
@@ -82,9 +82,9 @@ class alphaBootloaderInfo(bootloaderInfo):
f.write("%d:%d%s" %(lines, bpn, kernelFile))
# See if we can come up with an initrd argument that exists
- initrd = self.makeInitrd(kernelTag)
- if os.path.isfile(instRoot + initrd):
- f.write(" initrd=%sinitrd%s.img" %(kernelPath, kernelTag))
+ initrd = self.makeInitrd(kernelTag, instRoot)
+ if initrd:
+ f.write(" initrd=%s%s" %(kernelPath, initrd))
realroot = rootDevice.fstabSpec
f.write(" root=%s" %(realroot,))
diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py
index 71a3c9e..e7cd5e3 100644
--- a/booty/bootloaderInfo.py
+++ b/booty/bootloaderInfo.py
@@ -303,8 +303,16 @@ class bootloaderInfo:
else:
self.defaultDevice = "partition"
- def makeInitrd(self, kernelTag):
- return "/boot/initrd%s.img" % kernelTag
+ def makeInitrd(self, kernelTag, instRoot):
+ initrd = "initrd%s.img" % kernelTag
+ if os.access(instRoot + "/boot/" + initrd, os.R_OK):
+ return initrd
+
+ initrd = "initrd-generic%s.img" % kernelTag
+ if os.access(instRoot + "/boot/" + initrd, os.R_OK):
+ return initrd
+
+ return None
def getBootloaderConfig(self, instRoot, bl, kernelList,
chainList, defaultDev):
@@ -353,13 +361,12 @@ class bootloaderInfo:
sl = LiloConfigFile(imageType = "image", path = kernelFile)
- initrd = self.makeInitrd(kernelTag)
+ initrd = self.makeInitrd(kernelTag, instRoot)
sl.addEntry("label", label)
- if os.access (instRoot + initrd, os.R_OK):
- sl.addEntry("initrd", "%sinitrd%s.img" %(self.kernelLocation,
- kernelTag))
-
+ if initrd:
+ sl.addEntry("initrd", "%s%s" %(self.kernelLocation, initrd))
+
sl.addEntry("read-only")
append = "%s" %(self.args.get(),)
diff --git a/booty/ia64.py b/booty/ia64.py
index bf2689f..24bcf6b 100644
--- a/booty/ia64.py
+++ b/booty/ia64.py
@@ -33,9 +33,6 @@ class ia64BootloaderInfo(efiBootloaderInfo):
return rc
return self.addNewEfiEntry(instRoot)
- def makeInitrd(self, kernelTag):
- return "/boot/efi/EFI/redhat/initrd%s.img" % kernelTag
-
def __init__(self, instData):
efiBootloaderInfo.__init__(self, instData)
self._configname = "elilo.conf"
diff --git a/booty/ppc.py b/booty/ppc.py
index 5b96be7..aa4d8dc 100644
--- a/booty/ppc.py
+++ b/booty/ppc.py
@@ -111,9 +111,9 @@ class ppcBootloaderInfo(bootloaderInfo):
f.write("\tlabel=%s\n" %(label,))
f.write("\tread-only\n")
- initrd = self.makeInitrd(kernelTag)
- if os.access(instRoot + initrd, os.R_OK):
- f.write("\tinitrd=%s/initrd%s.img\n" %(cfPath,kernelTag))
+ initrd = self.makeInitrd(kernelTag, instRoot)
+ if initrd:
+ f.write("\tinitrd=%s/%s\n" %(cfPath, initrd))
append = "%s" %(self.args.get(),)
diff --git a/booty/s390.py b/booty/s390.py
index e865931..a60811d 100644
--- a/booty/s390.py
+++ b/booty/s390.py
@@ -43,12 +43,11 @@ class s390BootloaderInfo(bootloaderInfo):
sl = LiloConfigFile(imageType = "image", path = kernelFile)
- initrd = self.makeInitrd(kernelTag)
+ initrd = self.makeInitrd(kernelTag, instRoot)
sl.addEntry("label", label)
- if os.access (instRoot + initrd, os.R_OK):
- sl.addEntry("initrd",
- "%sinitrd%s.img" %(self.kernelLocation, kernelTag))
+ if initrd:
+ sl.addEntry("initrd", "%s%s" %(self.kernelLocation, initrd))
sl.addEntry("read-only")
sl.addEntry("root", rootDev.path)
@@ -138,12 +137,12 @@ class s390BootloaderInfo(bootloaderInfo):
kernelTag = "-" + version
kernelFile = "%svmlinuz%s" % (cfPath, kernelTag)
- initrd = self.makeInitrd(kernelTag)
+ initrd = self.makeInitrd(kernelTag, instRoot)
f.write('[%s]\n' % (label))
f.write('\timage=%s\n' % (kernelFile))
- if os.access (instRoot + initrd, os.R_OK):
- f.write('\tramdisk=%sinitrd%s.img\n' %(self.kernelLocation,
- kernelTag))
+ if initrd:
+ f.write('\tramdisk=%s%s\n' %(self.kernelLocation, initrd))
+
realroot = rootDev.fstabSpec
f.write('\tparameters="root=%s' %(realroot,))
if bl.args.get():
diff --git a/booty/sparc.py b/booty/sparc.py
index 5b379b9..45d58c4 100644
--- a/booty/sparc.py
+++ b/booty/sparc.py
@@ -56,9 +56,9 @@ class sparcBootloaderInfo(bootloaderInfo):
f.write("\tlabel=%s\n" % (label,))
f.write("\tread-only\n")
- initrd = self.makeInitrd(kernelTag)
- if os.access(instRoot + initrd, os.R_OK):
- f.write("\tinitrd=%s/initrd%s.img\n" % (cfPath, kernelTag))
+ initrd = self.makeInitrd(kernelTag, instRoot)
+ if initrd:
+ f.write("\tinitrd=%s/%s\n" % (cfPath, initrd))
append = "%s" % (self.args.get(),)
diff --git a/booty/x86.py b/booty/x86.py
index d9bebcb..5e02f3d 100644
--- a/booty/x86.py
+++ b/booty/x86.py
@@ -186,7 +186,7 @@ class x86BootloaderInfo(efiBootloaderInfo):
f.write('# root %s\n' % self.grubbyPartitionName(bootDevs[0]))
f.write("# kernel %svmlinuz-version ro root=%s\n" % (cfPath, rootDev.path))
- f.write("# initrd %sinitrd-version.img\n" % (cfPath))
+ f.write("# initrd %sinitrd-[generic-]version.img\n" % (cfPath))
f.write("#boot=/dev/%s\n" % (grubTarget))
# get the default image to boot... we have to walk and find it
@@ -239,7 +239,7 @@ class x86BootloaderInfo(efiBootloaderInfo):
kernelTag = "-" + version
kernelFile = "%svmlinuz%s" % (cfPath, kernelTag)
- initrd = self.makeInitrd(kernelTag)
+ initrd = self.makeInitrd(kernelTag, instRoot)
f.write('title %s (%s)\n' % (longlabel, version))
f.write('\troot %s\n' % self.grubbyPartitionName(bootDevs[0]))
@@ -270,16 +270,16 @@ class x86BootloaderInfo(efiBootloaderInfo):
f.write(' %s' % self.args.get())
f.write('\n')
- if os.access (instRoot + initrd, os.R_OK):
- f.write('\tmodule %sinitrd%s.img\n' % (cfPath, kernelTag))
+ if initrd:
+ f.write('\tmodule %s%s\n' % (cfPath, initrd))
else: # normal kernel
f.write('\tkernel %s ro%s' % (kernelFile, realroot))
if self.args.get():
f.write(' %s' % self.args.get())
f.write('\n')
- if os.access (instRoot + initrd, os.R_OK):
- f.write('\tinitrd %sinitrd%s.img\n' % (cfPath, kernelTag))
+ if initrd:
+ f.write('\tinitrd %s%s\n' % (cfPath, initrd))
for (label, longlabel, device) in chainList:
if ((not longlabel) or (longlabel == "")):