create a jail skel #
find /usr/jails/_basejail14.0/ -mindepth 1 -maxdepth 1 | sed -e 's/.*\///' | xargs -IQ ln -s basejail/Q
rm var proc dev mnt media net root sys tmp usr etc
mkdir var proc dev mnt media net root sys tmp usr
cp -Rav /usr/jails/_basejail14.0/etc .
find /usr/jails/_basejail14.0/usr/ -mindepth 1 -maxdepth 1 | sed -e 's/.*\///' | xargs -IQ ln -s ../basejail/usr/Q usr/
rm usr/local
mkdir usr/local
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