]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(dracut-functions.sh): check_kernel_module should follow dracutsysrootdir
authorKairui Song <kasong@tencent.com>
Tue, 6 Dec 2022 09:20:26 +0000 (17:20 +0800)
committerAntonio Álvarez Feijoo <antonio.feijoo@suse.com>
Wed, 21 Dec 2022 16:07:46 +0000 (17:07 +0100)
check_kernel_module calls modprobe and tries to dry-run a module load to
check if a module is available. modprobe supports `-d` to specify a
rootdir, so just pass dracutsysrootdir to it to make it work as expected
when building initramfs for another rootfs.

Signed-off-by: Kairui Song <kasong@tencent.com>
dracut-functions.sh

index adef37f733143f9e3071c33ba0beb52c05b8f5e1..6ab31aa87182c52a1c7f0216b7592b6131933e85 100755 (executable)
@@ -731,7 +731,7 @@ 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 -S "$kernel" --dry-run "$1" &> /dev/null || return 1
+    modprobe -d "$dracutsysrootdir" -S "$kernel" --dry-run "$1" &> /dev/null || return 1
 }
 
 # get_cpu_vendor