From: Daan De Meyer Date: Tue, 5 Mar 2024 07:52:41 +0000 (+0100) Subject: Only remove kernel modules when not generating a cached image X-Git-Tag: v21~11^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2459%2Fhead;p=thirdparty%2Fmkosi.git Only remove kernel modules when not generating a cached image This allows KernelModulesExclude= to be modified without having to rebuild the cached image every time. Fixes #2458 --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 52a2ec677..3ea771c1e 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -2517,13 +2517,14 @@ def run_depmod(context: Context, *, cache: bool = False) -> None: if all(m.stat().st_mtime <= mtime for m in modulesd.rglob("*.ko*")): continue - process_kernel_modules( - context.root, kver, - include=context.config.kernel_modules_include, - exclude=context.config.kernel_modules_exclude, - host=context.config.kernel_modules_include_host, - sandbox=context.sandbox, - ) + if not cache: + process_kernel_modules( + context.root, kver, + include=context.config.kernel_modules_include, + exclude=context.config.kernel_modules_exclude, + host=context.config.kernel_modules_include_host, + sandbox=context.sandbox, + ) with complete_step(f"Running depmod for {kver}"): run(["depmod", "--all", "--basedir", context.root, kver],