[arch-projects] [mkinitcpio][PATCH 1/4] init: simplify disabling of hooks
Dave Reisner
d at falconindy.com
Sat Jun 4 13:17:58 EDT 2011
Instead of dynamically creating variables to test against, simply remove
the read permission from the hook.
Signed-off-by: Dave Reisner <d at falconindy.com>
---
init | 21 ++++++++-------------
1 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/init b/init
index 1f6bc4e..67039c8 100644
--- a/init
+++ b/init
@@ -40,9 +40,9 @@ else
fi
if [ -n "${disablehooks}" ]; then
- for d in $(echo "${disablehooks}" | sed 's|,| |g'); do
- eval "hook_${d}=disabled"
- done
+ cd /hooks >/dev/null
+ chmod -r ${disablehooks//,/ } 2>/dev/null
+ cd - >/dev/null
fi
if [ -n "${earlymodules}" ]; then
@@ -60,16 +60,11 @@ 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
+ [ -r "/hooks/$h" ] || continue
+ run_hook () { msg "${h}: no run function defined"; }
+ . /hooks/${h}
+ msg ":: Running Hook [${h}]"
+ run_hook
done
fi
--
1.7.5.4
More information about the arch-projects
mailing list