From cf4188d69685161a8a676bba25db5d6a92e9f3ab Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Wed, 26 Sep 2012 16:04:58 -0400 Subject: functions: always treat ADDED_MODULES as a hash Overlooked in b8d9c5cd2753e9. This change also assigns a value of "2" to builtin modules which are added to the the ADDED_MODULES array, to distinguish them from actual modules on disk. Using this, we can avoid adding builtins to the image's runtime config. Signed-off-by: Dave Reisner --- functions | 8 ++++---- mkinitcpio | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/functions b/functions index 107319f..ed3a583 100644 --- a/functions +++ b/functions @@ -313,7 +313,7 @@ add_module() { module=${1%.ko*} # skip expensive stuff if this module has already been added - (( ${ADDED_MODULES["$module"]} )) && return + (( ADDED_MODULES["${module//-/_}"] )) && return while IFS=':= ' read -r -d '' field value; do case "$field" in @@ -602,9 +602,9 @@ write_image_config() { # sanitize of any extra whitespace read -ra modules <<<"${MODULES//-/_}" - for mod in "${modules[@]}"; do - in_array "${mod%\?}" "${ADDED_MODULES[@]}" || continue - add+=("${mod%\?}") + for mod in "${modules[@]%\?}"; do + # only add real modules (2 == builtin) + (( ADDED_MODULES["$mod"] == 1 )) && add+=("$mod") done (( ${#add[*]} )) && printf 'MODULES="%s"\n' "${add[*]}" diff --git a/mkinitcpio b/mkinitcpio index 766405a..7c9a48a 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -346,7 +346,7 @@ trap '(( $? )) && [[ $FUNCNAME = add_* ]] && (( ++builderrors ))' RETURN # prime the ADDED_MODULES list with the builtins for this kernel if [[ -r $MODULEDIR/modules.builtin ]]; then while read -a path; do - ADDED_MODULES["${path[-1]%.ko}"]=1 + ADDED_MODULES["${path[-1]%.ko}"]=2 done <"$MODULEDIR/modules.builtin" fi -- cgit v1.2.3-24-g4f1b