bsdinstall(8) with custom partitioning

From: artur.brzozowski <artur.brzozowski_at_protonmail.com>
Date: Tue, 24 May 2022 14:53:20 UTC
Hello.

I am writing a custom installer script using bsdinstall(8).  Included
therein is a chunk that prepares a specific disk layout (partitions,
encryption, mount points).

As I understand from the manual, the preamble's PARTITIONS and
DISTRIBUTIONS should be enough to get the system installed before the
script chroot part. I don't think PARTITIONS supports creating layouts
as intricate as mine. For instance, I want to have a separate EFI
partition and boot pool encryption and to achieve that, I first need
to create an EFI partition, then create an encrypted partition with an
additonal (bsd) partition scheme that contains / (and the /boot
inside). Meanwhile, _scriptedpart_ target section of bsdinstall(8)
manual doesn't mention a word of GELI encryption outside of ZFS setup
(I use UFS).

In simple terms, I know what I want the system to look like, I know
where to mount what in order to have it install properly and would
like bsdinstall(8) to accept this personal partitioning (as if with
selecting "Shell" partitioning option in the installer and exiting it
when done). Is there a way to do that?  Something akin to telling
bsdinstall(8) that: "/ partition is mounted <here>, you do the usual
rest and then move on to the chroot section of the script"?

Best wishes,
Artur