8.8 Using Hooks

A Hook is a callout which gives Tinderbox the ability to run custom code at pre-determined times. For example, you can establish a Hook to run just before a Port is built, after a Build is extracted, before a PortsTree is updated, etc. Pre-condition Hooks can even cause an operation to terminate if so desired. To see a list of all available Hooks:

# ./tc listHooks

To add a new command for an existing Hook, use:

# ./tc updateHookCmd -h {hook} -c {command}

To disable a Hook:

# ./tc updateHookCmd -h {hook} -c ""

Note: The null string after -c disables the Hook.

There is no way to add new Hooks dynamically. However, if you have an idea for a new Hook, please contact tinderbox-list@marcuscom.com.

An example use for a Hook could be to restrict the number of CPUs used when building:

# ./tc updateHookCmd -h postJailExtract -c 'echo MAKE_JOBS_NUMBER=2 >> ${DESTDIR}/etc/make.conf'