Modify installer iso before build

I’m experimenting with packer, to build FreeBSD images.
I can already build using boot_command, but what I really want to do is to prepare the iso file with the installerconfig (freebsd way of auto install script) before boot.
We already have shell scripts and ansible playbooks that do this today, but I want to use packer to easily configure multiple builders and integration into CI.

Packer already downloads ISO files and caches them, is there a way to run a script after the installer ISO has been fetched, but before it is booted?