#!/bin/sh

# For DEBUG Output - can be left since logfiles are deleted when job finishes
set -x

# To make the script exit whenever a command fails (MUST NOT BE REMOVED)
set -e

case $1 in
	mkiso)
		mkisofs -V "$DISC_ID" -f -r -J -l -allow-lowercase -allow-multidot \
				-graft-points $GRAFT_POINTS >"$ISO_FILE"
	;;

	burndir)
		SPEED=""
		if [ $BURN_SPEED -gt 0 ]; then
			SPEED="-speed=$BURN_SPEED"
		fi
		growisofs -use-the-force-luke=tty $SPEED -Z $DVD_DEVICE \
				  -V "$DISC_ID" -f -r -J -l -allow-lowercase -allow-multidot \
				  -graft-points $GRAFT_POINTS
	;;

	pipeiso)
		mkisofs -V "$DISC_ID" -f -r -J -l -allow-lowercase -allow-multidot \
				-graft-points $GRAFT_POINTS | tee "$ISO_FILE" > $ISO_PIPE
	;;

	burniso)
		SPEED=""
		if [ $BURN_SPEED -gt 0 ]; then
			SPEED="-speed=$BURN_SPEED"
		fi
		growisofs -use-the-force-luke=tty $SPEED -dvd-compat \
				  -Z $DVD_DEVICE=$ISO_PIPE
	;;

	*)
		echo "Usage: $0 {demux}"
		exit 1
	;;
esac

exit $?
