< Previous | Contents | Next >
9.3.4. Using Hooks to Tweak the Contents of the Image
live-build offers hooks that can be executed at different steps of the build process. Chroot hooks are executable scripts that you install as hooks/live/*.chroot files in your config tree and that are executed within the chroot. While chroot is the command that lets you temporarily changes the operating system’s root directory to a directory of your choice, it is also used by extension to
designate a directory hosting a full (alternate) file system tree. This is the case here with live- build, where the chroot directory is the directory where the live file system is being prepared. Since applications started in a chroot can’t see outside of that directory, the same goes with the chroot hooks: you can only use and modify anything available in that chroot environment. We rely on those hooks to perform multiple Kali specific customizations (see kali-config/common/ hooks/live/kali-hacks.chroot).
Binary hooks (hooks/live/*.binary) are executed in the context of the build process (and not chrooted anywhere) at the end of the process. You can modify the content of the ISO image built but not of the live file system since at this point, it has already been generated. We use this feature in Kali to make some changes to the default isolinux configuration generated by live-build. For example, see kali-config/common/hooks/live/persistence.binary where we add the boot menu entries enabling persistence.