#! /bin/sh
# Get the locations for the files from a single place to avoid confusion
OBDDIR="`dirname $0`/.."
-[ "$OBDDIR" = "./.." ] && OBDDIR=".."
# source config info
. $OBDDIR/demos/config.sh
# temp file
if [ "$TMPFILE" -a -f $TMPFILE ]; then
- echo "$TMPFILE exists; I'm unwilling to overwrite it." 1>&2
- exit 1
+ echo "$TMPFILE exists; I'm unwilling to overwrite it. Remove [N/y]?" 1>&2
+ rm -i $TMPFILE
+ [ -f $TMPFILE ] && exit 1
fi
[ "$TMPFILE" ] && dd if=/dev/zero of=$TMPFILE bs=1k count=10k
echo "You need to clean up $LOOPDEV (via cleanup.sh),"
echo "or you can change which device is used in demos/config.sh" 1>&2
# undo previous
- rm $TMPFILE
+ [ "$TMPFILE" ] && rm $TMPFILE
exit 2
fi
else
echo "\$BASEDEV not defined in demos/config.sh. Please fix!"
[ "$LOOPDEV" ] && losetup -d $LOOPDEV
- rm $TMPFILE
+ [ "$TMPFILE" ] && rm $TMPFILE
exit 3
fi