Advanced usage (configuration hook scripts)

Overview

If granular configuration is required, the configuration script 'conf' can be replaced with a conf directory containing the following configuration script hooks to be executed in the chroot (rootfs):

conf/pre-debs       # executed before apply-debs
conf/post-debs      # executed after apply-debs
conf/pre-overlay    # executed before apply-overlay
conf/post-overlay   # executed after apply-overlay

The hook scripts provides a powerful interface to support any use case, for example:

  • Installing dependencies or preseeding of custom debs (pre-debs)
  • Tweaking the debs installation after installation (post-debs)
  • Installing packages and customizing them prior to applying the overlay (pre-overlay)
  • Tweaking after the overlay is applied (post-overlay - equivalent to the simple conf)

 

DRY - Don't Repeat Yourself

Advanced users will also appreciate the added DRY support included with the advanced conf scripts, providing the ability to include generic helper functions or scripts, for example:

conf/functions

install()
{
    apt-get update
    DEBIAN_FRONTEND=noninteractive apt-get -y \
        -o DPkg::Options::=--force-confdef \
        -o DPkg::Options::=--force-confold \
        install $@
}

 

conf/pre-overlay

#!/bin/bash -ex
source $(dirname $0)/functions

install hello

 

Advanced hello world example

tklpatch-example can be executed with the --advanced option to generate an example patch including the advanced configuration hook scripts, and a basic functions file.

tklpatch-example --advanced helloworld