core/mkinitcpio/0001-Restore-addition-of-modules-from-config-file.patch

40 lines
1.2 KiB
Diff
Raw Normal View History

From 5bba09cb1c661627fde76b977cfe9f937b1264a3 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Fri, 6 Oct 2017 08:15:43 -0400
Subject: [mkinitcpio] [PATCH] Restore addition of modules from config file
Broken by c5ad00c2.
ref: https://bugs.archlinux.org/task/55870
---
functions | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/functions b/functions
index 1486f2f..ba95e80 100644
--- a/functions
+++ b/functions
@@ -627,9 +627,18 @@ parse_config() {
map add_file "${FILES[@]}"
tee "$BUILDROOT/buildconfig" < "$1" | {
+ # When MODULES is not an array (but instead implicitly converted at
+ # startup), sourcing the config causes the string value of MODULES
+ # to be assigned as MODULES[0]. Avoid this by explicitly unsetting
+ # MODULES before re-sourcing the config.
+ unset MODULES
+
. /dev/stdin
- for mod in "${modules[@]%\?}"; do
+ # arrayize MODULES if necessary.
+ [[ ${MODULES@a} != *a* ]] && read -ra MODULES <<<"${MODULES//-/_}"
+
+ for mod in "${MODULES[@]%\?}"; do
mod=${mod//-/_}
# only add real modules (2 == builtin)
(( _addedmodules["$mod"] == 1 )) && add+=("$mod")
--
2.14.2