]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Fix loaded host modules filter
authorMarkus Weippert <markus@gekmihesg.de>
Sat, 10 Aug 2024 07:36:56 +0000 (09:36 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 10 Aug 2024 08:35:40 +0000 (10:35 +0200)
Module filenames might use dashes instead of underscores.
Also, anchoring the filename to a directory avoids including unrelated
modules (e.g. exfat vs fat).

mkosi/kmod.py

index cc8562589eea339be2ee9941aa5d457e84835183..e998cb3b452defa4642f425d042d5ee1cdd0aadd 100644 (file)
@@ -15,7 +15,8 @@ from mkosi.util import chdir, parents_below
 
 
 def loaded_modules() -> list[str]:
-    return [fr"{line.split()[0]}\.ko" for line in Path("/proc/modules").read_text().splitlines()]
+    # Loaded modules are listed with underscores but the filenames might use dashes instead.
+    return [fr"/{line.split()[0].replace('_', '[_-]')}\.ko" for line in Path("/proc/modules").read_text().splitlines()]
 
 
 def filter_kernel_modules(root: Path, kver: str, *, include: Iterable[str], exclude: Iterable[str]) -> list[Path]: