kldload dm
cryptsetup -y luksFormat /dev/da1s1d
cryptsetup luksOpen /dev/da1s1d root || exit 1
newfs_hammer -L ROOT /dev/mapper/root
mount_hammer /dev/mapper/root /mnt
mkdir /mnt/boot
mount /dev/da0s1a /mnt/boot
mkdir /mnt/pfs
hammer pfs-master /mnt/pfs/usr
hammer pfs-master /mnt/pfs/usr.obj
hammer pfs-master /mnt/pfs/var
hammer pfs-master /mnt/pfs/var.crash
hammer pfs-master /mnt/pfs/var.tmp
hammer pfs-master /mnt/pfs/tmp
hammer pfs-master /mnt/pfs/home
mkdir /mnt/usr
mkdir /mnt/var
mkdir /mnt/tmp
mkdir /mnt/home
mount_null /mnt/pfs/usr /mnt/usr
mount_null /mnt/pfs/var /mnt/var
mount_null /mnt/pfs/tmp /mnt/tmp
mount_null /mnt/pfs/home /mnt/home
mkdir /mnt/usr/obj
mkdir /mnt/var/tmp
mkdir /mnt/var/crash
mount_null /mnt/pfs/var.tmp /mnt/var/tmp
mount_null /mnt/pfs/var.crash /mnt/var/crash
mount_null /mnt/pfs/usr.obj /mnt/usr/obj
chmod 1777 /mnt/tmp
chmod 1777 /mnt/var/tmp
cpdup -o / /mnt
cpdup -o /boot /mnt/boot
cpdup -o /usr /mnt/usr
cpdup -o /var /mnt/var
cpdup -i0 /etc /mnt/etc
chflags -R nohistory /mnt/tmp
chflags -R nohistory /mnt/var/tmp
chflags -R nohistory /mnt/var/crash
chflags -R nohistory /mnt/usr/obj