Whamcloud - gitweb
Fixes to shell scripts to check for errors and other improvements
[fs/lustre-release.git] / lustre / demos / baseclean.sh
index baadee3..5ac231b 100755 (executable)
@@ -1,9 +1,33 @@
 #!/bin/sh
 # Script to remove the loopback device and temp file created in newtest.sh
 OBDDIR="`dirname $0`/.."
-[ "$OBDDIR" = "" ] && OBDDIR=".."
+
+[ "$OBDDIR" = "./.." ] && OBDDIR=".."
+
 . $OBDDIR/demos/config.sh
 
+
+mount | grep $MNTOBD > /dev/null 2>&1
+if [ x$? = x0 ]; then 
+    echo "Stuff still mounted on $MNTOBD"
+    exit 
+fi
+
+mount | grep $MNTSNAP > /dev/null 2>&1
+if [ x$? = x0 ]; then 
+    echo "Stuff still mounted on $MNTSNAP"
+    exit 
+fi
+
+mount | grep $MNTSNAP > /dev/null 2>&1
+if [ x$? = x0 ]; then 
+    echo "Stuff still mounted on $MNTSNAP2"
+    exit 
+fi
+
+
 [ "$LOOPDEV" ] && losetup -d $LOOPDEV
-[ "$TMPFILE" ] && rm $TMPFILE
+rmmod loop > /dev/null 2>&1
+
+# [ "$TMPFILE" -a -f "$TMPFILE" ] && rm $TMPFILE