]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(dracut-fuctions.sh): avoid reading the wrong kconfig
authorMatteo Croce <teknoraver@meta.com>
Fri, 2 Aug 2024 10:00:18 +0000 (12:00 +0200)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Tue, 13 Aug 2024 10:24:34 +0000 (06:24 -0400)
If $no_kernel is set, $kernel will point to the running kernel,
avoid reading the current kernel config in this case.

dracut-functions.sh

index eefbe9d0066f723f1ef2884335f3d6782bfe2638..02a47fc2ee71039181b3c972891be1c5abb1d69f 100755 (executable)
@@ -731,6 +731,11 @@ fs_get_option() {
 check_kernel_config() {
     local _config_opt="$1"
     local _config_file
+
+    # If $no_kernel is set, $kernel will point to the running kernel.
+    # Avoid reading the current kernel config by mistake.
+    [[ $no_kernel == yes ]] && return 0
+
     [[ -f $dracutsysrootdir/boot/config-$kernel ]] \
         && _config_file="/boot/config-$kernel"
     [[ -f $dracutsysrootdir/lib/modules/$kernel/config ]] \