Fix cleaning up of modules if we have more kernels
This commit is contained in:
parent
8e589fb8b7
commit
87ad91c475
@ -273,7 +273,9 @@ class Lorax(BaseLoraxClass):
|
||||
# get the list of required modules
|
||||
logger.info("getting list of required modules")
|
||||
modules = [f[1:] for f in template if f[0] == "module"]
|
||||
modules = itertools.chain.from_iterable(modules)
|
||||
modules = list(itertools.chain.from_iterable(modules))
|
||||
|
||||
self.installtree.move_modules()
|
||||
|
||||
for kernel in self.installtree.kernels:
|
||||
logger.info("cleaning up kernel modules")
|
||||
@ -827,9 +829,18 @@ class LoraxInstallTree(BaseLoraxClass):
|
||||
|
||||
os.symlink("/dev/null", pyc)
|
||||
|
||||
def move_modules(self):
|
||||
shutil.move(joinpaths(self.root, "lib/modules"),
|
||||
joinpaths(self.root, "modules"))
|
||||
shutil.move(joinpaths(self.root, "lib/firmware"),
|
||||
joinpaths(self.root, "firmware"))
|
||||
|
||||
os.symlink("../modules", joinpaths(self.root, "lib/modules"))
|
||||
os.symlink("../firmware", joinpaths(self.root, "lib/firmware"))
|
||||
|
||||
def cleanup_kernel_modules(self, keepmodules, kernel):
|
||||
moddir = joinpaths(self.root, "lib/modules", kernel.version)
|
||||
fwdir = joinpaths(self.root, "lib/firmware")
|
||||
moddir = joinpaths(self.root, "modules", kernel.version)
|
||||
fwdir = joinpaths(self.root, "firmware")
|
||||
|
||||
# expand required modules
|
||||
modules = set()
|
||||
@ -957,17 +968,6 @@ class LoraxInstallTree(BaseLoraxClass):
|
||||
for modname in sorted(modlist.keys()):
|
||||
fobj.write(modlist[modname])
|
||||
|
||||
|
||||
|
||||
# create symlinks in /
|
||||
shutil.move(joinpaths(self.root, "lib/modules"),
|
||||
joinpaths(self.root, "modules"))
|
||||
shutil.move(joinpaths(self.root, "lib/firmware"),
|
||||
joinpaths(self.root, "firmware"))
|
||||
|
||||
os.symlink("../modules", joinpaths(self.root, "lib/modules"))
|
||||
os.symlink("../firmware", joinpaths(self.root, "lib/firmware"))
|
||||
|
||||
def compress_modules(self, kernel):
|
||||
moddir = joinpaths(self.root, "modules", kernel.version)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user