From: Markus Weippert Date: Sat, 10 Aug 2024 07:36:56 +0000 (+0200) Subject: Fix loaded host modules filter X-Git-Tag: v25~362 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=776aae8ae4365bbfb4986d2943cb5d0c65b32c32;p=thirdparty%2Fmkosi.git Fix loaded host modules filter Module filenames might use dashes instead of underscores. Also, anchoring the filename to a directory avoids including unrelated modules (e.g. exfat vs fat). --- diff --git a/mkosi/kmod.py b/mkosi/kmod.py index cc8562589..e998cb3b4 100644 --- a/mkosi/kmod.py +++ b/mkosi/kmod.py @@ -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]: