Hooks can be used in order to change the runtime behaviour of the package manager. There are a variety of package hooks, mostly self explanatory:
Run just before the
build script is run
Run after the
build script is run successfully
Run if the
build script fails
Run before the
test script is run
Run if the
test script fails
Run before a package is installed for each package
Run after a package is installed for each package
Run before a package is removed for each package
Run after a package is removed for each package
Run before all repositories are fetched
Run after all repositories are fetched
Run after a tarball for a package is created
In order to use hooks, you will need to set the ‘CPT_HOOK’ variable pointing to your hook file. Your hook file MUST be a POSIX shell script as its contents are sourced by the package manager.
The hook is given 3 variables when it is executed. Those are:
The type of the hook, (‘pre-build’, ‘post-build’, etc.)
The package that ‘cpt’ is currently working on. Can be null.
The destination of the operation. Can be null.