diff options
author | nl6720 <nl6720@gmail.com> | 2023-10-31 09:50:32 +0200 |
---|---|---|
committer | nl6720 <nl6720@gmail.com> | 2023-10-31 10:56:02 +0200 |
commit | 938741d8da5180023ef4f0256954243b262a654b (patch) | |
tree | ee9725a7813f08ce7005278e87c2dbcd529cbbe8 | |
parent | 298e979025837643a59f50f378a89f213258c080 (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-- | functions | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -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[@]}" } |