This simple script, used as a git hook, executes all scripts in the
corresponding hook-name.d
directory.
It is also capable of daemonizing itself for a limited set of git hooks where the scripts execution will not affect the outcome of the action.
Drop this script into your hooks directory. Another option is to clone this
directory, and point your core.hooksPath
config variable to it.
Example (replace the directories paths with your own):
export HOOKS_ROOT=path/to/your/hooks/root/dir
cd "$HOOKS_ROOT"
# either direct download
#mkdir -p overlord && wget https://raw.githubusercontent.com/amartos/overlord/master/overlord -O overlord/overlord
# or clone the repo
git clone https://github.com/amartos/overlord
cd path/to/your/git/repo
git config core.hooksPath "$HOOKS_ROOT"/overlord
Then, symlink the overlord
script as a git hook, and create the corresponding
hook-name.d
directory alongside the overlord
script.
cd path/to/your/hooks/root/dir/overlord
export HOOK=hook-name
ln -s overlord "$HOOK" && mkdir "$HOOK".d
The script is able do this by itself, for multiple hooks at once. Just call it directly, passing the names of all the hooks to init.
cd path/to/your/hooks/root/dir/overlord
./overlord first-hook-name second-hook-name # ...
To print the manual:
./overlord -h
Now, any script within the hook-name.d
directories will be executed when the
corresponding hook is triggered, transparently receiving both the
input and arguments of the hook.
Moreover, you can execute the hook-name
script yourself to trigger all
of them manually.
For hooks that do not affect the outcome of the action (even through
their exit status), the overlord
script will execute all the
hook-name.d
scripts asynchronously, making those hooks
non-blocking. However, the background execution will stop immediately
if the current hook-name.d
script exits with a non-zero status code.
The list of daemonized hooks can be found in the NOTES
section of the
script manual ./overlord -h
.