Whamcloud - gitweb
class/obdcontrol: added "basedev" parameter to the attach command
[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 [ "$TMPFILE" ] && dd if=/dev/zero of=$TMPFILE bs=1k count=10k
24
25 [ "$LOOPDEV" ] && losetup $LOOPDEV $TMPFILE
26 if [ "$BASEDEV" ]; then
27     mke2fs -b 4096 $BASEDEV
28 else
29     echo "\$BASEDEV not defined in demos/config.sh.  Please fix!"
30     exit 1
31 fi