#!/bin/sh slot=$1 #Audit slot and release names case $slot in *[^a-zA-Z0-9]* ) echo "Non-alphanumeric slot $slot"; exit 1 esac if [ -z "$slot" ]; then echo "Zero-length slot or release" exit 1 fi if [ ! -d /scratch/$slot ]; then echo "No file system for slot!" exit 1 fi set +e set -o noclobber echo > /scratch/$slot.lock jail -f /scratch/$slot.conf -r $slot umount -f /scratch/$slot || true rm -rf /scratch/$slot /scratch/$slot.conf /scratch/$slot.fstab set +e rm /scratch/$slot.lock