Make sure we have at least one kernel
If the only kernel we have is a PAE or xen kernel, make sure we copy it to the isolinux directory, and create the efi images.
This commit is contained in:
parent
d8e07aeac0
commit
38b6fce4e5
@ -174,27 +174,41 @@ class Lorax(BaseLoraxClass):
|
||||
initrd = images.InitRD(self.installtree, modules, initrd_template,
|
||||
self.workdir)
|
||||
|
||||
# get all kernels and initrds
|
||||
kernel_normal, kernel_pae, kernel_xen = [], [], []
|
||||
for kernel, initrd in initrd.create():
|
||||
if kernel.is_pae:
|
||||
kernelfile = "vmlinuz-PAE"
|
||||
initrdfile = "initrd-PAE.img"
|
||||
|
||||
# add images section to treeinfo
|
||||
section = "images-xen"
|
||||
data = {"kernel": "images/pxeboot/vmlinuz-PAE",
|
||||
"initrd": "images/pxeboot/initrd-PAE.img"}
|
||||
self.treeinfo_add_section(self.conf.treeinfo, section, data)
|
||||
kernel_pae.append((kernel, initrd))
|
||||
elif kernel.is_xen:
|
||||
kernelfile = "vmlinuz-xen"
|
||||
initrdfile = "initrd-xen.img"
|
||||
kernel_xen.append((kernel, initrd))
|
||||
else:
|
||||
kernel_normal.append((kernel, initrd))
|
||||
|
||||
# if we have a normal kernel, set it as the main kernel
|
||||
kernels = []
|
||||
try:
|
||||
kernels.append(kernel_normal.pop(0))
|
||||
except IndexError:
|
||||
pass
|
||||
|
||||
# add pae and xen kernels to the list of kernels
|
||||
kernels.extend(kernel_pae)
|
||||
kernels.extend(kernel_xen)
|
||||
|
||||
# check if we have at least one kernel
|
||||
if not kernels:
|
||||
self.pcritical("no kernel images found")
|
||||
sys.exit(1)
|
||||
|
||||
# main kernel
|
||||
kernel, initrd = kernels.pop(0)
|
||||
kernelfile = "vmlinuz"
|
||||
initrdfile = "initrd.img"
|
||||
|
||||
# add images section to treeinfo
|
||||
section = "images-{0}".format(self.conf.basearch)
|
||||
data = {"kernel": "images/pxeboot/vmlinuz",
|
||||
"initrd": "images/pxeboot/initrd.img"}
|
||||
data = {"kernel": "images/pxeboot/{0}".format(kernelfile),
|
||||
"initrd": "images/pxeboot/{0}".format(initrdfile)}
|
||||
self.treeinfo_add_section(self.conf.treeinfo, section, data)
|
||||
|
||||
# copy the kernel and initrd image to the isolinux directory
|
||||
@ -203,6 +217,12 @@ class Lorax(BaseLoraxClass):
|
||||
shutil.copy2(kernel.path, kdst)
|
||||
shutil.copy2(initrd, idst)
|
||||
|
||||
# copy the kernel and initrd image to the pxe directory
|
||||
kdst = os.path.join(self.conf.pxedir, kernelfile)
|
||||
idst = os.path.join(self.conf.pxedir, initrdfile)
|
||||
shutil.copy2(kernel.path, kdst)
|
||||
shutil.copy2(initrd, idst)
|
||||
|
||||
# create the efi images
|
||||
if self.installtree.do_efi:
|
||||
efi = images.EFI(self.installtree, kernel, initrd,
|
||||
@ -214,6 +234,25 @@ class Lorax(BaseLoraxClass):
|
||||
shutil.copy2(efiboot, self.conf.imgdir)
|
||||
shutil.copy2(efidisk, self.conf.imgdir)
|
||||
|
||||
# other kernels
|
||||
for kernel, initrd in kernels:
|
||||
if kernel.is_pae:
|
||||
kernelfile = "vmlinuz-PAE"
|
||||
initrdfile = "initrd-PAE.img"
|
||||
# XXX add images section to treeinfo
|
||||
section = "images-xen"
|
||||
data = {"kernel": "images/pxeboot/{0}".format(kernelfile),
|
||||
"initrd": "images/pxeboot/{0}".format(initrdfile)}
|
||||
self.treeinfo_add_section(self.conf.treeinfo, section, data)
|
||||
elif kernel.is_xen:
|
||||
kernelfile = "vmlinuz-xen"
|
||||
initrdfile = "initrd-xen.img"
|
||||
# XXX add images section to treeinfo
|
||||
section = "images-xen"
|
||||
data = {"kernel": "images/pxeboot/{0}".format(kernelfile),
|
||||
"initrd": "images/pxeboot/{0}".format(initrdfile)}
|
||||
self.treeinfo_add_section(self.conf.treeinfo, section, data)
|
||||
|
||||
# copy the kernel and initrd image to the pxe directory
|
||||
kdst = os.path.join(self.conf.pxedir, kernelfile)
|
||||
idst = os.path.join(self.conf.pxedir, initrdfile)
|
||||
|
Loading…
Reference in New Issue
Block a user