#!/bin/sh slot=$1 release=$2 #Audit slot and release names case $slot in *[^a-zA-Z0-9]* ) echo "Non-alphanumeric slot $slot"; exit 1 esac case $release in *[^a-zA-Z0-9]* ) echo "Non-alphanumeric release $release"; exit 1 esac if [ -z "$slot" -o -z "$release" ]; then echo "Zero-length slot or release" exit 1 fi if [ -d /scratch/$slot ]; then echo "Pre-existing file system for this slot!" /pkgscripts/reapbuildjail $slot sleep 5 fi cleanup() { rm -f /scratch/$slot.lock /pkgscripts/reapbuildjail $slot exit 1 } set -e trap cleanup EXIT #TODO: localhost networking mkdir -p /scratch/$slot mkdir -p /scratch/tmp/$slot unionfs -o cow -o noatime -o nosuid -o max_files=32000 /scratch/tmp/$slot=RW:/scratch/ports=RO:/scratch/$release=RO /scratch/$slot jail -c name=$slot path=/scratch/$slot host.hostname=$slot.`hostname` persist=true mount.devfs=true trap true EXIT