Skip to content

Commit

Permalink
fix(load_fstype): avoid false positive searchs
Browse files Browse the repository at this point in the history
Refactor to avoid substring matches
  and to speed processing.
Also avoid xtracing.
  • Loading branch information
FGrose authored and LaszloGombos committed Dec 30, 2022
1 parent 08b63a2 commit 10cf8e4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules.d/99base/dracut-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1140,5 +1140,10 @@ remove_hostonly_files() {
# returns OK if kernel_module is loaded
# modprobe fails if /lib/modules is not available (--no-kernel use case)
load_fstype() {
strstr "$(cat /proc/filesystems)" "${2:-$1}" || modprobe "$1"
local - fs _fs="${2:-$1}"
set +x
while read -r d fs || [ "$d" ]; do
[ "${fs:-$d}" = "$_fs" ] && return 0
done < /proc/filesystems
modprobe "$1"
}

0 comments on commit 10cf8e4

Please sign in to comment.