diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh index f25026fb80..91c189e825 100755 --- a/modules.d/10i18n/module-setup.sh +++ b/modules.d/10i18n/module-setup.sh @@ -30,11 +30,7 @@ install() { I18N_CONF="/etc/locale.conf" VCONFIG_CONF="/etc/vconsole.conf" - findkeymap() { - # shellcheck disable=SC2064 - trap "$(shopt -p nullglob globstar)" RETURN - shopt -q -s nullglob globstar - + _findkeymap() { local -a MAPS local MAPNAME local INCLUDES @@ -66,12 +62,21 @@ install() { for INCL in "${INCLUDES[@]}"; do for FN in "$dracutsysrootdir""${kbddir}"/keymaps/**/"$INCL"*; do [[ -f $FN ]] || continue - [[ -v KEYMAPS["$FN"] ]] || findkeymap "$FN" + [[ -v KEYMAPS["$FN"] ]] || _findkeymap "$FN" done done done } + # Wrapper around the recursive _findkeymap making sure the shell + # options are restored correctly + findkeymap() { + # shellcheck disable=SC2064 + trap "$(shopt -p nullglob globstar)" RETURN + shopt -q -s nullglob globstar + _findkeymap "$@" + } + # Function gathers variables from distributed files among the tree, maps to # specified names and prints the result in format "new-name=value". #