FreeBSD mfsbsd pxe

https://github.com/mmatuska/mfsbsd

https://forums.freebsd.org/threads/freebsd-iso-bootable.52444/

https://docs.freebsd.org/en/books/handbook/disks/#disks-virtual

fetch http://ftp4.se.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/13.0/FreeBSD-13.0-RELEASE-amd64-disc1.iso

mdconfig -a -t vnode -f FreeBSD-13.0-RELEASE-amd64-disc1.iso
mount_cd9660 /dev/md0 /cdrom/

git clone https://github.com/mmatuska/mfsbsd
cd mfsbsd

#Customize wanted files in conf/ specially rc.local that kickstarts everything

make iso BASE=/cdrom/usr/freebsd-dist

rc.local

fetch http://<servername>/mfsbsd/installerconfig -o /etc/installerconfig
tail -n 7 /etc/rc.local > /tmp/start.sh
chmod +x /tmp/start.sh
/tmp/start.sh 
exit 0

#!/bin/csh
setenv DISTRIBUTIONS "kernel.txz base.txz"
setenv BSDINSTALL_DISTDIR /tmp
setenv BSDINSTALL_DISTSITE http://ftp4.se.freebsd.org/pub/FreeBSD/releases/amd64/13.0-RELEASE

bsdinstall distfetch 
bsdinstall script /etc/installerconfig

installerconfig, ensure that gpart edits correct harddrive

PARTITIONS=ada0
DISTRIBUTIONS="kernel.txz base.txz"
BSDINSTALL_DISTDIR=/tmp
BSDINSTALL_DISTSITE=http://ftp4.se.freebsd.org/pub/FreeBSD/releases/amd64/13.0-RELEASE

#!/bin/sh
gpart bootcode -b /boot/pmbr    -p /boot/gptboot -i 1 ada0
sysrc ifconfig_em0=DHCP
sysrc sshd_enable=YES
echo "Installation complete, running in host system"
echo "hostname=\"FreeBSD\"" >> /etc/rc.conf
echo "autoboot_delay=\"5\"" >> /boot/loader.conf
echo "sshd_enable=YES" >> /etc/rc.conf
echo "Setup done" >> /tmp/log.txt
echo "Setup done."
poweroff