summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functions20
-rw-r--r--install/base15
-rwxr-xr-xmkinitcpio2
3 files changed, 22 insertions, 15 deletions
diff --git a/functions b/functions
index a6c7163..ed6d78d 100644
--- a/functions
+++ b/functions
@@ -547,4 +547,24 @@ find_in_dirs() {
return 1
}
+write_image_config() {
+ # write a 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"
+ (( ${#modules[*]} )) && printf 'MODULES="%s"\n' "${modules[*]%\?}"
+
+ printf '%s="%s"\n' \
+ 'EARLYHOOKS' "${RUNHOOKS['early']# }" \
+ 'HOOKS' "${RUNHOOKS['hooks']# }" \
+ 'LATEHOOKS' "${RUNHOOKS['late']# }" \
+ 'CLEANUPHOOKS' "${RUNHOOKS['cleanup']% }"
+
+ ) >"$BUILDROOT/config"
+}
+
# vim: set ft=sh ts=4 sw=4 et:
diff --git a/install/base b/install/base
index 7eff431..1df209b 100644
--- a/install/base
+++ b/install/base
@@ -37,21 +37,6 @@ build() {
add_file "/usr/lib/initcpio/init_functions" "/init_functions"
add_file "/usr/lib/initcpio/init" "/init"
add_file "/usr/lib/modprobe.d/usb-load-ehci-first.conf"
-
- # 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"
-
- {
- (( ${#modules[*]} )) && printf 'MODULES="%s"\n' "${modules[*]%\?}"
- (( ${#hooks[*]} )) && printf 'HOOKS="%s"\n' "${hooks[*]}"
- } >"$BUILDROOT/config"
- )
}
help() {
diff --git a/mkinitcpio b/mkinitcpio
index e346169..4804a67 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -399,6 +399,8 @@ for var in cfg_{MODULES,BINARIES,FILES}; do
done
parse_hook
+write_image_config
+
# switch out the error handler to catch all errors
trap -- RETURN
trap '(( ++builderrors ))' ERR