zfs create zroot/jails/templates/template01
bsdinstall jail /usr/local/jails/templates/template01
mkdir /usr/local/jails/templates/template01/basejail
mount -t nullfs -o ro /usr/local/jails/basejails/bsdinstall_jail \
/usr/local/jails/templates/template01/basejail
# delete and recreate /usr
rm -rf /usr/local/jails/templates/template01/usr
mkdir /usr/local/jails/templates/template01/usr
# link stuff from basejail into usr
ln -s ../basejail/usr/* .
# create exceptions, local to the jail for which the template is
rm local obj tests
mkdir local obj tests
cd /usr/local/jails/templates/template01
chflags -R noschg sbin rescue libexec lib boot bin
rm -rf sbin rescue libexec lib boot bin
ln -sf basejail/sbin basejail/rescue basejail/libexec basejail/lib basejail/boot basejail/bin .
force a shutdown
jail -r