summaryrefslogtreecommitdiff
path: root/nonsystemd/mkinitcpio/0001-Restore-addition-of-modules-from-config-file.patch
blob: bd2668a36e4a4a852e1933ab1205ab020a906d54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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