]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(dracut-functions): check for kmod
authorJo Zzsi <jozzsicsataban@gmail.com>
Sun, 25 Jan 2026 17:36:28 +0000 (12:36 -0500)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Sun, 25 Jan 2026 22:04:05 +0000 (17:04 -0500)
Check for kmod before depending on a kmod specific functionality.

This code pattern is taken from the base module which already
includes a similar kmod check.

dracut-functions.sh

index 3e3c81ebe8d812a8bd5c16865d51d7d83810940f..f81ae3fc39b334d6aa6feb57a07714ab548e568a 100755 (executable)
@@ -774,7 +774,9 @@ check_kernel_config() {
 # 0 if the kernel module is either built-in or available
 # 1 if the kernel module is not enabled
 check_kernel_module() {
-    modprobe -d "$drivers_dir/../../../" -S "$kernel" --dry-run "$1" &> /dev/null || return 1
+    if command -v kmod > /dev/null 2> /dev/null; then
+        modprobe -d "$drivers_dir/../../../" -S "$kernel" --dry-run "$1" &> /dev/null || return 1
+    fi
 }
 
 # get_cpu_vendor