From: Fabian Vogt Date: Thu, 21 Jan 2016 16:13:07 +0000 (+0100) Subject: Correctly handle module aliases X-Git-Tag: 045~169^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F123%2Fhead;p=thirdparty%2Fdracut.git Correctly handle module aliases Handle module aliases correctly to not generate unbootable initrds with different kernel versions when modules were renamed or replaced. Signed-off-by: Fabian Vogt --- diff --git a/dracut.sh b/dracut.sh index 98dbe0bcc..ae8772b40 100755 --- a/dracut.sh +++ b/dracut.sh @@ -1195,6 +1195,27 @@ if [[ $hostonly ]]; then while read m rest || [ -n "$m" ]; do host_modules["$m"]=1 done = 4.4, mpt2sas isn't loaded, + # so it's not included. + # Both ways result in an unbootable initrd. + + # also add aliases of loaded modules + for mod in "${!host_modules[@]}"; do + aliases=$(modinfo -F alias "$mod" 2>&1) + for alias in $aliases; do + host_modules["$alias"]=1 + done + # mod might be an alias in the target kernel, find the real module + mod_filename=$(modinfo -k "$kernel" "$mod" -F filename) + [ $? -ne 0 ] && continue + host_modules["$(basename -s .ko "$mod_filename")"]=1 + done fi unset m