X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fdemos%2Fbasesetup.sh;h=7cecc93673e32d29e5d65b8aa8a3389bf982502f;hb=bbb126f8d22cff6180bf362487cc373facdb9274;hp=887437272d7ed3ac3f565394c2c9f62a6936d647;hpb=066289819fddf00635b3134a44893eb47cb5ef6b;p=fs%2Flustre-release.git diff --git a/lustre/demos/basesetup.sh b/lustre/demos/basesetup.sh index 8874372..7cecc93 100755 --- a/lustre/demos/basesetup.sh +++ b/lustre/demos/basesetup.sh @@ -1,36 +1,47 @@ #! /bin/sh # Get the locations for the files from a single place to avoid confusion OBDDIR="`dirname $0`/.." -[ "$OBDDIR" = "" ] && OBDDIR=".." +[ "$OBDDIR" = "./.." ] && OBDDIR=".." + +# source config info . $OBDDIR/demos/config.sh -#if [ "$TMPFILE" -a -f $TMPFILE ]; then -# echo "$TMPFILE exists; I'm unwilling to overwrite it." 1>&2 -# exit 1 -#fi +[ ! -d $MNTOBD ] && mkdir $MNTOBD +[ ! -d $MNTSNAP ] && mkdir $MNTSNAP +[ ! -d $MNTSNAP2 ] && mkdir $MNTSNAP2 + + +# temp file +if [ "$TMPFILE" -a -f $TMPFILE ]; then + echo "$TMPFILE exists; I'm unwilling to overwrite it." 1>&2 + exit 1 +fi +[ "$TMPFILE" ] && dd if=/dev/zero of=$TMPFILE bs=1k count=10k -# We assume the loop module will be installed by kerneld if required. -# If not, the following line should be uncommented. -#insmod loop +# loop device +insmod loop > /dev/null 2>&1 if [ "$LOOPDEV" -a "`losetup $LOOPDEV 2> /dev/null`" ]; then echo "It appears that $LOOPDEV is in use. Unable to continue" 1>&2 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 exit 2 fi +[ "$LOOPDEV" ] && losetup $LOOPDEV $TMPFILE # Ensure that we have the correct devices for OBD to work [ ! -c /dev/obd0 ] && mknod /dev/obd0 c $OBDMAJ 0 [ ! -c /dev/obd1 ] && mknod /dev/obd1 c $OBDMAJ 1 [ ! -c /dev/obd2 ] && mknod /dev/obd2 c $OBDMAJ 2 -[ "$TMPFILE" ] && dd if=/dev/zero of=$TMPFILE bs=1k count=10k -[ "$LOOPDEV" ] && losetup $LOOPDEV $TMPFILE if [ "$BASEDEV" ]; then mke2fs -b 4096 $BASEDEV else echo "\$BASEDEV not defined in demos/config.sh. Please fix!" - exit 1 + [ "$LOOPDEV" ] && losetup -d $LOOPDEV + rm $TMPFILE + exit 3 fi