/build-postgres.sh
#!/bin/sh

. lib.sh
. common.opts

load_opts "$1"

JAILNAME=$POSTGRES_JAILNAME
ADDR=$POSTGRES_ADDR

set -e
set -x

(
	cd postgres/postgres_exporter/cmd/postgres_exporter
	GOOS=freebsd GOARCH=amd64 go build
)

bastille create $JAILNAME $FREEBSD_RELEASE $ADDR
bastille stop $JAILNAME
bastille config $JAILNAME set sysvshm new
bastille config $JAILNAME set sysvmsg new
bastille config $JAILNAME set sysvsem new
bastille start $JAILNAME
bastille template $JAILNAME ./postgres