* Add file support in the runHook function.

svn path=/nixpkgs/branches/stdenv-updates/; revision=18467
This commit is contained in:
Nicolas Pierron 2009-11-19 17:19:32 +00:00
parent 8c638e5e68
commit 6ba27ab552

View File

@ -4,11 +4,12 @@
# environment variables) and from shell scripts (as functions). # environment variables) and from shell scripts (as functions).
runHook() { runHook() {
local hookName="$1" local hookName="$1"
if test "$(type -t $hookName)" = function; then case "$(type -t $hookName)" in
$hookName (function|alias|builtin) $hookName;;
else (file) source $hookName;;
eval "${!hookName}" (keyword) :;;
fi (*) eval "${!hookName}";;
esac
} }