#!/bin/sh

set -e
set -x
set -u

BASE_RO=dpool/jail/ttmpl/base-ro/13.2-RELEASE
SKEL_RW=dpool/jail/ttmpl/skel-rw/13.2-RELEASE

NEW_VER="p5"

MOUNTPOINT="/var/tmp/13.2"

ftjail mount-tmpl -P "$BASE_RO" "$SKEL_RW" "$MOUNTPOINT"

freebsd-update -b "$MOUNTPOINT" fetch 
freebsd-update -b "$MOUNTPOINT" install

ftjail snapshot-tmpl "$BASE_RO" "$SKEL_RW" "$NEW_VER"

ftjail build-etcupdate-current-tmpl "$MOUNTPOINT" /jail/RELEASE/etcupdate-current-13.2@${NEW_VER}.tbz
