#!/bin/sh

# This script sets up a zfs snapshot of the base jail and any requirements

# install curl
ASSUME_ALWAYS_YES=yes pkg install curl

# Create the base jail
zfs create -o mountpoint=/jails zroot/jails
zfs create zroot/jails/jail
curl -o /tmp/base.txz https://download.freebsd.org/ftp/releases/amd64/12.1-RELEASE/base.txz
zfs snapshot zroot/jails/jail@base

# Setup devfs rules
cat > /etc/devfs.rules1 << DEVFS
[devfsrules_jail=4]
add include \$devfsrules_hide_all
add include \$devfsrules_unhide_basic
add include \$devfsrules_unhide_login
add path zfs unhide
add path 'bpf*' unhide
add path 'pf*' unhide
DEVFS
service devfs restart
