summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-05-12 02:34:39 +0200
committerDave Reisner <dreisner@archlinux.org>2012-05-18 15:39:04 +0200
commita68d47b4851828688275921e94b9a9e6bef80ca3 (patch)
treedfc6820ca3c06c02b3af6faac3d4e8c699bbc2d3 /init
parent87c55e67d063bed6b1e2fa296779280182d79c40 (diff)
downloadmkinitcpio-a68d47b4851828688275921e94b9a9e6bef80ca3.tar.gz
mkinitcpio-a68d47b4851828688275921e94b9a9e6bef80ca3.tar.xz
init_functions: move running hooks to separate func
Abstract this out to the init_functions file, and allow this function take 2+ parameters -- the hook name to be run, a user friendly short description, and then the list of hook files to source from. While we're at it, take advantage of the fact that hooks are now installed with executable perms. If a hook isn't marked excutable, we skip it, thereby removing our eval hack. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'init')
-rw-r--r--init17
1 files changed, 2 insertions, 15 deletions
diff --git a/init b/init
index 7cd812f..3c852d9 100644
--- a/init
+++ b/init
@@ -23,7 +23,7 @@ else
fi
for d in ${disablehooks//,/ }; do
- eval "hook_${d}=disabled"
+ [ -e "/hooks/$d" ] && chmod 644 "/hooks/$d"
done
[ -n "${earlymodules//[[:space:]]}" ] && modprobe -qab ${earlymodules//,/ }
@@ -37,20 +37,7 @@ if [ -z "${rootdelay}" ] || ! [ "${rootdelay}" -ge 0 ]; then
rootdelay=10
fi
-if [ -e "/hooks" ]; then
- for h in ${HOOKS}; do
- TST=""
- eval "TST=\$hook_${h}"
- if [ "${TST}" != "disabled" ]; then
- run_hook () { msg "${h}: no run function defined"; }
- if [ -e "/hooks/${h}" ]; then
- . /hooks/${h}
- msg ":: Running Hook [${h}]"
- run_hook
- fi
- fi
- done
-fi
+run_hookfunctions 'run_hook' 'hook' $HOOKS
# honor the old behavior of break=y as a synonym for break=premount
if [ "${break}" = "y" ] || [ "${break}" = "premount" ]; then