summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornl6720 <nl6720@gmail.com>2023-10-31 09:50:32 +0200
committernl6720 <nl6720@gmail.com>2023-10-31 10:56:02 +0200
commit938741d8da5180023ef4f0256954243b262a654b (patch)
treeee9725a7813f08ce7005278e87c2dbcd529cbbe8
parent298e979025837643a59f50f378a89f213258c080 (diff)
functions: add_checked_modules_from_symbol: do not fail if there are no autodetected modules to add
Only fail if no modules with the symbol can be found. Fixes https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio/-/issues/218 Fixes: 1760deea68f4a915a502c5602c82c7f9f8404a51 ("add_checked_modules_from_symbol: avoid double-lookup")
-rw-r--r--functions14
1 files changed, 9 insertions, 5 deletions
diff --git a/functions b/functions
index a0fe637..8a689ee 100644
--- a/functions
+++ b/functions
@@ -1161,15 +1161,19 @@ add_all_modules_from_symbol() {
add_checked_modules_from_symbol() {
local -a mods
+ mapfile -t mods < <(find_module_from_symbol "$@")
+ (( ${#mods[@]} )) || return 1
+
# _autodetect_cache is declared in mkinitcpio and assigned in install/autodetect
# shellcheck disable=SC2154
- if (( ${#_autodetect_cache[*]} )); then
- mapfile -t mods < <(find_module_from_symbol "$@" | grep -xFf <(printf '%s\n' "${!_autodetect_cache[@]}"))
- else
- mapfile -t mods < <(find_module_from_symbol "$@")
+ if (( ${#_autodetect_cache[@]} )); then
+ mapfile -t mods < <(grep -xFf <(printf '%s\n' "${!_autodetect_cache[@]}") <<<"${mods[@]}")
+ # Do not fail if no autodetected module has the symbol
+ if (( ${#mods[@]} )); then
+ return 0
+ fi
fi
- (( ${#mods[*]} )) || return 1
map add_module "${mods[@]}"
}