Raise an error when there are no initrds
This commit is contained in:
parent
fd8684f1af
commit
93c4a8b830
@ -195,9 +195,13 @@ class TreeBuilder(object):
|
|||||||
if not backup:
|
if not backup:
|
||||||
dracut.append("--force")
|
dracut.append("--force")
|
||||||
|
|
||||||
|
kernels = [kernel for kernel in self.kernels if hasattr(kernel, "initrd")]
|
||||||
|
if not kernels:
|
||||||
|
raise Exception("No initrds found, cannot rebuild_initrds")
|
||||||
|
|
||||||
# Hush some dracut warnings. TODO: bind-mount proc in place?
|
# Hush some dracut warnings. TODO: bind-mount proc in place?
|
||||||
open(joinpaths(self.vars.inroot,"/proc/modules"),"w")
|
open(joinpaths(self.vars.inroot,"/proc/modules"),"w")
|
||||||
for kernel in self.kernels:
|
for kernel in kernels:
|
||||||
if prefix:
|
if prefix:
|
||||||
idir = os.path.dirname(kernel.initrd.path)
|
idir = os.path.dirname(kernel.initrd.path)
|
||||||
outfile = joinpaths(idir, prefix+'-'+kernel.version+'.img')
|
outfile = joinpaths(idir, prefix+'-'+kernel.version+'.img')
|
||||||
@ -282,6 +286,7 @@ def findkernels(root="/", kdir="boot"):
|
|||||||
imgtype = 'initrd'
|
imgtype = 'initrd'
|
||||||
kernel[imgtype] = DataHolder(path=joinpaths(kdir, f))
|
kernel[imgtype] = DataHolder(path=joinpaths(kdir, f))
|
||||||
|
|
||||||
|
logger.debug("kernels=%s" % kernels)
|
||||||
return kernels
|
return kernels
|
||||||
|
|
||||||
# udev whitelist: 'a-zA-Z0-9#+.:=@_-' (see is_whitelisted in libudev-util.c)
|
# udev whitelist: 'a-zA-Z0-9#+.:=@_-' (see is_whitelisted in libudev-util.c)
|
||||||
|
Loading…
Reference in New Issue
Block a user