summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2016-06-26 18:28:39 +0200
committerDave Reisner <dreisner@archlinux.org>2016-06-27 14:27:52 +0200
commit73189f9515cc40015381a24731205c493107f04f (patch)
tree4f17ffae0dcd106f5c830bf23367ed8a476eab02
parent97ac4d37aae084a050be512f6d8f4489054668ad (diff)
downloadmkinitcpio-73189f9515cc40015381a24731205c493107f04f.tar.gz
mkinitcpio-73189f9515cc40015381a24731205c493107f04f.tar.xz
handle the case of modinfo returning multiple modules
This is true of more and more modules with the advent of aliases, e.g. $ modinfo -F filename crc32c /lib/modules/4.6.2-rampage/kernel/arch/x86/crypto/crc32c-intel.ko.gz /lib/modules/4.6.2-rampage/kernel/crypto/crc32c_generic.ko.gz
-rw-r--r--functions29
1 files changed, 14 insertions, 15 deletions
diff --git a/functions b/functions
index 0d998a3..0252ab5 100644
--- a/functions
+++ b/functions
@@ -348,8 +348,8 @@ add_module() {
# discovered and added.
# $1: module name
- local module= path= softdeps= deps= field= value= firmware=()
- local ign_errors=0
+ local target= module= softdeps= deps= field= value= firmware=()
+ local ign_errors=0 found=0
[[ $KERNELVERSION == none ]] && return 0
@@ -358,15 +358,19 @@ add_module() {
set -- "${1%?}"
fi
- module=${1%.ko*}
+ target=${1%.ko*} target=${target//-/_}
# skip expensive stuff if this module has already been added
- (( _addedmodules["${module//-/_}"] )) && return
+ (( _addedmodules["$target"] )) && return
while IFS=':= ' read -r -d '' field value; do
case "$field" in
filename)
- path=$value
+ found=1
+ module=${value##*/} module=${module%.ko*}
+ quiet "adding module: %s" "$module"
+ _modpaths["$value"]=1
+ _addedmodules["${module//-/_}"]=1
;;
depends)
IFS=',' read -r -a deps <<< "$value"
@@ -383,26 +387,21 @@ add_module() {
done
;;
esac
- done < <(modinfo -b "$_optmoduleroot" -k "$KERNELVERSION" -0 "$module" 2>/dev/null)
+ done < <(modinfo -b "$_optmoduleroot" -k "$KERNELVERSION" -0 "$target" 2>/dev/null)
- if [[ -z $path ]]; then
+ if (( !found )); then
(( ign_errors )) && return 0
- error "module not found: \`%s'" "$module"
+ error "module not found: \`%s'" "$target"
return 1
fi
if (( ${#firmware[*]} )); then
add_firmware "${firmware[@]}" ||
- warning 'Possibly missing firmware for module: %s' "$module"
+ warning 'Possibly missing firmware for module: %s' "$target"
fi
- # aggregate modules and add them all at once to save some forks
- quiet "adding module: %s" "$1"
- _modpaths["$path"]=1
- _addedmodules["${module//-/_}"]=1
-
# handle module quirks
- case $module in
+ case $target in
fat)
add_module "nls_cp437?"
add_module "nls_iso8859-1?"