summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--install/base3
-rwxr-xr-xmkinitcpio16
2 files changed, 15 insertions, 4 deletions
diff --git a/install/base b/install/base
index ca77071..7eff431 100644
--- a/install/base
+++ b/install/base
@@ -1,6 +1,8 @@
#!/bin/bash
build() {
+ local dir applet
+
for dir in new_root proc sys dev run tmp usr/bin; do
add_dir "/$dir"
done
@@ -44,7 +46,6 @@ build() {
# sanitize of any extra whitespace
read -r -a modules <<< "$MODULES"
- read -r -a hooks <<< "$HOOKS"
{
(( ${#modules[*]} )) && printf 'MODULES="%s"\n' "${modules[*]%\?}"
diff --git a/mkinitcpio b/mkinitcpio
index fb1db85..084dff7 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -104,6 +104,13 @@ get_kernver() {
return 1
}
+compute_hookset() {
+ for h in $HOOKS "${ADDHOOKS[@]}"; do
+ in_array "$h" "${SKIPHOOKS[@]}" && continue
+ hooks+=("$h")
+ done
+}
+
. "$FUNCTIONS"
trap 'cleanup 130' INT
@@ -312,7 +319,11 @@ if [[ ! -f "$CONFIG" ]]; then
fi
. "$CONFIG"
-if [[ -z ${HOOKS//[[:space:]]} && -z ${ADDHOOKS[@]} ]]; then
+# after returning, hooks are populated into the array 'hooks'
+# HOOKS should not be referenced from here on
+compute_hookset
+
+if (( ${#hooks[*]} == 0 )); then
die "Invalid config: No hooks found"
fi
@@ -352,8 +363,7 @@ for var in MODULES BINARIES FILES; do
declare "cfg_$var=${!var}"
done
-for hook in ${HOOKS} "${ADDHOOKS[@]}"; do
- in_array "$hook" "${SKIPHOOKS[@]}" && continue
+for hook in "${hooks[@]}"; do
unset MODULES BINARIES FILES SCRIPT
build() { error "$hook: no build function..."; return 1; }