#!/bin/bash -xe
[ -n "$*" ] || . fail "usage, e.g: BLANK=1 $0 /=pvd"

[ "`id -u`" = 0 ] || . fail "should run $0 as root"
ISO=cd.iso
mkisofs -v -o $ISO -R -J -joliet-long -graft-points "$@" 2>&1 | tee mkisofs.log &
[ -n "$BLANK" ] && cdrecord -v blank=fast
wait
[ -n "$NOBURN" ] || cdrecord -v $ISO
[ -n "$NOKEEP" ] && rm $ISO mkisofs.log
