summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-11-27 16:45:43 +0100
committerDave Reisner <dreisner@archlinux.org>2011-11-29 11:56:42 +0100
commitdadb1d1a4ad7684dba5a3f16b6441081196dc5a3 (patch)
tree6ae9d1daf3ba421eadf3ba307c9dfe3e96cfca3e
parentb59b5d7540084bd4759e45e0e2765c04e0448656 (diff)
downloadmkinitcpio-dadb1d1a4ad7684dba5a3f16b6441081196dc5a3.tar.gz
mkinitcpio-dadb1d1a4ad7684dba5a3f16b6441081196dc5a3.tar.xz
mkinitcpio: parse vars from config file last
This lets the config file be an override for any files or binaries added by hooks. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rwxr-xr-xmkinitcpio12
1 files changed, 10 insertions, 2 deletions
diff --git a/mkinitcpio b/mkinitcpio
index 5579bba..ec54408 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -297,8 +297,10 @@ declare -i builderrors=0
set -E
trap '[[ $FUNCNAME = parse_hook ]] && (( ++builderrors ))' ERR
-#parse 'global' hook, as defined in ${CONFIG}
-parse_hook
+# save vars from $CONFIG; they will be parsed last
+for var in MODULES BINARIES FILES; do
+ declare "cfg_$var=${!var}"
+done
for hook in ${HOOKS}; do
in_array "$hook" "${SKIPHOOKS[@]}" && continue
@@ -331,6 +333,12 @@ for hook in ${HOOKS}; do
fi
done
+# restore $CONFIG vars add to image
+for var in cfg_{MODULES,BINARIES,FILES}; do
+ declare "${var#cfg_}=${!var}"
+done
+parse_hook
+
# unset errtrace and trap
set +E
trap ERR