]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
refactor(dracut): remove unnecessary 'realpath' call if -k/--kmoddir specified
authorMewt R <25155631+MewtR@users.noreply.github.com>
Mon, 20 Apr 2026 00:37:27 +0000 (20:37 -0400)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Fri, 1 May 2026 19:00:26 +0000 (15:00 -0400)
No need to use 'realpath' to resolve a default directory to look for modules
if one has already been specified. 'realpath' will complain if the directory doesn't exist
which can lead a user to think that something went wrong.

dracut.sh

index 18edc521419c8dc9bfda8a90e263af22294444ca..43703dfdb35ce5545001cff84c7773e3b50a7e0a 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -1468,11 +1468,11 @@ fi
 
 export LC_MESSAGES=C kernel
 
-srcmods="$(realpath -e "${dracutsysrootdir-}/lib/modules/$kernel")"
-
-[[ ${drivers_dir-} ]] && {
+if [[ ${drivers_dir-} ]]; then
     srcmods="$drivers_dir"
-}
+else
+    srcmods="$(realpath -e "${dracutsysrootdir-}/lib/modules/$kernel")"
+fi
 export srcmods
 
 # export standard hookdirs