Whamcloud - gitweb
887437272d7ed3ac3f565394c2c9f62a6936d647
[fs/lustre-release.git] / lustre / demos / basesetup.sh
1 #! /bin/sh
2 # Get the locations for the files from a single place to avoid confusion
3 OBDDIR="`dirname $0`/.."
4 [ "$OBDDIR" = "" ] && OBDDIR=".."
5 . $OBDDIR/demos/config.sh
6
7 #if [ "$TMPFILE" -a -f $TMPFILE ]; then 
8 #    echo "$TMPFILE exists; I'm unwilling to overwrite it." 1>&2
9 #    exit 1
10 #fi
11
12 # We assume the loop module will be installed by kerneld if required.
13 # If not, the following line should be uncommented.
14 #insmod loop
15
16 if [ "$LOOPDEV" -a "`losetup $LOOPDEV 2> /dev/null`" ]; then
17     echo "It appears that $LOOPDEV is in use.  Unable to continue" 1>&2
18     echo "You need to clean up $LOOPDEV (via cleanup.sh),"
19     echo "or you can change which device is used in demos/config.sh" 1>&2
20     exit 2
21 fi
22
23 # Ensure that we have the correct devices for OBD to work
24 [ ! -c /dev/obd0 ] && mknod /dev/obd0 c $OBDMAJ 0
25 [ ! -c /dev/obd1 ] && mknod /dev/obd1 c $OBDMAJ 1
26 [ ! -c /dev/obd2 ] && mknod /dev/obd2 c $OBDMAJ 2
27
28 [ "$TMPFILE" ] && dd if=/dev/zero of=$TMPFILE bs=1k count=10k
29
30 [ "$LOOPDEV" ] && losetup $LOOPDEV $TMPFILE
31 if [ "$BASEDEV" ]; then
32     mke2fs -b 4096 $BASEDEV
33 else
34     echo "\$BASEDEV not defined in demos/config.sh.  Please fix!"
35     exit 1
36 fi