summaryrefslogtreecommitdiffstats
path: root/install/base
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-07-02 16:18:22 +0200
committerDave Reisner <dreisner@archlinux.org>2011-07-02 16:18:22 +0200
commit08d7abb0769701e3c14053b1b2406147ef9dd021 (patch)
treeda3dd635a6c8d67fb7a276b1f9ec70df25b1e596 /install/base
parentda81935dbb203340e9f3b394d4f6f4e5b3aa63c4 (diff)
downloadmkinitcpio-08d7abb0769701e3c14053b1b2406147ef9dd021.tar.gz
mkinitcpio-08d7abb0769701e3c14053b1b2406147ef9dd021.tar.xz
base/install: rewrite the config to sanitize it
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'install/base')
-rw-r--r--install/base17
1 files changed, 15 insertions, 2 deletions
diff --git a/install/base b/install/base
index 446167c..64ef39a 100644
--- a/install/base
+++ b/install/base
@@ -13,8 +13,21 @@ build() {
add_file "/lib/initcpio/init" "/init"
add_file "/etc/modprobe.d/usb-load-ehci-first.conf"
- # private API call is required here
- _add_file "/config" "$CONFIG" 644
+ # write a new config file. re-source the config as we can't guarantee the
+ # environment hasn't been modified, but subshell it so it doesn't disturb
+ # anyone else.
+ (
+ . "$CONFIG"
+
+ # sanitize of any extra whitespace
+ read -r -a modules <<< "$MODULES"
+ read -r -a hooks <<< "$HOOKS"
+
+ {
+ (( ${#modules[*]} )) && printf 'MODULES="%s"\n' "${modules[*]}"
+ (( ${#hooks[*]} )) && printf 'HOOKS="%s"\n' "${hooks[*]}"
+ } >"$BUILDROOT/config"
+ )
}
help() {