+1 323 268 0395 kmw@caltek.net

turnkeylinux

inihooks

Hi there,

The way we usually do things is completely install the application, using either random and/or generic values. Then to ensure that the application includes relevant config, we provide scripts that run at firstboot. We call them "inithooks"[1]. They run at firstboot, so that they also apply to other builds (such as OVA and LXC which are essentially "pre-installed") not just ISOs. They also support pre-seeding (which is what the Hub uses to allow users to simply fill in a web form).

[1] https://www.turnkeylinux.org/docs/inithooks

The inithooks are relevant to the specific appliance and are provided via overlay scripts (in the appliance build code). These scripts are separated into "firstboot" scripts, and "bin" scripts. To use our WordPress appliance as an example, '20regen-wordpress-secrets'[2] ensures that each user has unique "secrets" and '40wordpress'[3] simply hands pre-seeded values (if they exist) to the 'wordpress.py'[4] "bin" script, were any additionally required values are set (in the case of WordPress, admin password and email). If the values passed to the "bin" script are empty (i.e. no pre-seeding) then the "bin" script runs interactively.

[2] https://github.com/turnkeylinux-apps/wordpress/blob/master/overlay/usr/lib/inithooks/firstboot.d/20regen-wordpress-secrets
[3] https://github.com/turnkeylinux-apps/wordpress/blob/master/overlay/usr/lib/inithooks/firstboot.d/40wordpress
[4] https://github.com/turnkeylinux-apps/wordpress/blob/master/overlay/usr/lib/inithooks/bin/wordpress.py

As I mentioned, if you wish to share the code, I'm happy to give some specific feedback and include them in our "official" library.