diff options
author | Dave Reisner <dreisner@archlinux.org> | 2012-05-12 02:34:39 +0200 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2012-05-18 15:39:04 +0200 |
commit | a68d47b4851828688275921e94b9a9e6bef80ca3 (patch) | |
tree | dfc6820ca3c06c02b3af6faac3d4e8c699bbc2d3 /init_functions | |
parent | 87c55e67d063bed6b1e2fa296779280182d79c40 (diff) | |
download | mkinitcpio-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_functions')
-rw-r--r-- | init_functions | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/init_functions b/init_functions index 60532d2..1bebf45 100644 --- a/init_functions +++ b/init_functions @@ -44,6 +44,22 @@ major_minor_to_device() { return 1 } +run_hookfunctions() { + local hook fn=$1 desc=$2 + + shift 2 + for hook in "$@"; do + [ -x "/hooks/$hook" ] || continue + + unset "$fn" + . "/hooks/$hook" + type "$fn" >/dev/null || continue + + msg ":: running $desc [$hook]" + "$fn" + done +} + parse_cmdline() { local w in_quotes lhs rhs in_quotes=0 |