From ee916b72cc6ec89adf68d5b538044ebb5edcdbbd Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 30 Oct 2013 12:22:52 +0100 Subject: [PATCH] Handle crypto modules with and without modaliases If new kernels have modules split out, handle the case, where modules have to modalias and just install them. Also add the crypto drivers and names to host_modalias. --- dracut-functions.sh | 14 ++++++++++---- dracut.sh | 5 +++++ modules.d/01fips/fips.sh | 1 - 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/dracut-functions.sh b/dracut-functions.sh index 2e6e845..38095ba 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -1480,7 +1480,7 @@ dracut_kernel_post() { module_is_host_only() { local _mod=$1 - local _modenc a i + local _modenc a i _k _s _v _aliases _mod=${_mod##*/} _mod=${_mod%.ko} _modenc=${_mod//-/_} @@ -1497,19 +1497,25 @@ module_is_host_only() { # this covers the case, where a new module is introduced # or a module was renamed # or a module changed from builtin to a module + if [[ -d /lib/modules/$kernel_current ]]; then # if the modinfo can be parsed, but the module # is not loaded, then we can safely return 1 modinfo -F filename "$_mod" &>/dev/null && return 1 fi - # Finally check all modalias, if we install for a kernel - # different from the current one - for a in $(modinfo -k $kernel -F alias $_mod 2>/dev/null); do + _aliases=$(modinfo -k $kernel -F alias $_mod 2>/dev/null) + + # if the module has no aliases, install it + [[ $_aliases ]] || return 0 + + # finally check all modalias + for a in $_aliases; do for i in "${!host_modalias[@]}"; do [[ $i == $a ]] && return 0 done done + fi return 1 diff --git a/dracut.sh b/dracut.sh index 173a259..c6a388a 100755 --- a/dracut.sh +++ b/dracut.sh @@ -968,6 +968,11 @@ if [[ $hostonly ]]; then rm -f -- "$initdir/.modalias" + while read _k _s _v; do + [ "$_k" != "name" -a "$_k" != "driver" ] && continue + host_modalias["$_v"]=1 + done