2 # Get the locations for the files from a single place to avoid confusion
3 OBDDIR="`dirname $0`/.."
6 . $OBDDIR/demos/config.sh
9 if [ "$TMPFILE" -a -f $TMPFILE ]; then
10 echo "$TMPFILE exists; I'm unwilling to overwrite it. Remove [N/y]?" 1>&2
12 [ -f $TMPFILE ] && exit 1
14 [ "$TMPFILE" ] && dd if=/dev/zero of=$TMPFILE bs=1k count=10k
18 insmod loop > /dev/null 2>&1
19 if [ "$LOOPDEV" -a "`losetup $LOOPDEV 2> /dev/null`" ]; then
20 echo "It appears that $LOOPDEV is in use. Unable to continue" 1>&2
21 echo "You need to clean up $LOOPDEV (via cleanup.sh),"
22 echo "or you can change which device is used in demos/config.sh" 1>&2
24 [ "$TMPFILE" ] && rm $TMPFILE
28 [ "$LOOPDEV" ] && losetup $LOOPDEV $TMPFILE
29 # Ensure that we have the correct devices for OBD to work
30 [ ! -c /dev/obd0 ] && mknod /dev/obd0 c $OBDMAJ 0
31 [ ! -c /dev/obd1 ] && mknod /dev/obd1 c $OBDMAJ 1
32 [ ! -c /dev/obd2 ] && mknod /dev/obd2 c $OBDMAJ 2
35 if [ "$BASEDEV" ]; then
36 mke2fs -b 4096 $BASEDEV
38 echo "\$BASEDEV not defined in demos/config.sh. Please fix!"
39 [ "$LOOPDEV" ] && losetup -d $LOOPDEV
40 [ "$TMPFILE" ] && rm $TMPFILE