I have created a stand-alone copy of usr.sbin/bsdinstall, slightly
modified in order to allow local testing without requiring a new
installation image for every change.
$ git clone --branch khorben/finalconfig \
https://github.com/khorben/bsdinstall.git
$ cd bsdinstall
$ less README.md
[...]
$ cat > test.sh << EOF
#!/bin/sh
BSDINSTALLDIR="\$PWD"
DESTDIR="\$BSDINSTALLDIR/destdir"
BSDINSTALL_DISTDIR="\$DESTDIR/usr/freebsd-dist"; export BSDINSTALL_DISTDIR
SRCDIR="/usr/src"
TMPDIR="\$(mktemp -d)"; export TMPDIR
for target in "\$@"; do
BSDCFG_SHARE="\$SRCDIR/usr.sbin/bsdconfig/share" \
BSDINSTALL_CHROOT="\$DESTDIR" \
BSDINSTALL_CONFIGCURRENT="yes" \
BSDINSTALL_SCRIPTS="\$BSDINSTALLDIR/scripts" \
./bsdinstall "\$target"
done
EOF
$ sh test.sh auto
[perform a simulated install into the "destdir" subfolder]