From fb8923f681ac4b26c5363c9d4251f3997cfb96c9 Mon Sep 17 00:00:00 2001 From: Victor Lowther Date: Thu, 20 Aug 2009 22:21:33 -0500 Subject: [PATCH] Minor fixups to kernel module loading Also rewrite filter_kernel_modules to make it a little easier to read. --- dracut-functions | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/dracut-functions b/dracut-functions index f40d96b8..b74be435 100755 --- a/dracut-functions +++ b/dracut-functions @@ -327,7 +327,8 @@ check_modules() { install_kmod_with_fw() { local modname=${1##*/} fwdir found modname=${modname%.ko} - inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" + inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" || \ + return 0 # no need to go further if the module is already installed for fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do found='' for fwdir in $fw_dir; do @@ -365,18 +366,16 @@ for_each_kmod_dep() { # The behaviour of this function can vary depending on whether $hostonly is set. # If it is, we will only look at modules that are already in memory. # If it is not, we will look at all kernel modules -# This function returns the full filenames of modules that match +# This function returns the full filenames of modules that match $1 filter_kernel_modules () ( if [[ $hostonly = '' ]]; then - for modname in $(find "$srcmods/kernel/drivers" -name '*.ko'); do - "$1" "$modname" && echo "$modname" - done + filtercmd='find "$srcmods/kernel/drivers" -name "*.ko"' else - while read modname rest; do - modname=$(modinfo -F filename -k $kernel $modname) - "$1" "$modname" && echo "$modname" - done 0)); do - mod=${1%.ko} + mod=${1##*/} + mod=${mod%.ko} case $mod in =*) # This introduces 2 incompatible meanings for =* arguments # to instmods. We need to decide which one to keep. @@ -401,8 +401,7 @@ instmods() { # Must never run this diagnostic-only module shift; continue; ;; - *) mod=${mod##*/} - # if we are already installed, skip this module and go on + *) # if we are already installed, skip this module and go on # to the next one. [[ -f $initdir/$1 ]] && { shift; continue; } # If we are building a host-specific initramfs and this