exit 9
fi
+# Strip off a trailing slash
+LASTCHAR=`echo $MNTPT | cut -c ${#MNTPT}`
+if [ "$LASTCHAR" = "/" ] ; then
+ echo "..stripping trailing slash..." >/dev/stderr
+ MNTPT=`echo $MNTPT | cut -c 0-$((${#MNTPT}-1))`
+fi
+
#Check to see if already mounted
if [ -f "$MNTPT/var/lock/qmount-complete" ] ; then
echo "$MNTPT has a qmount already!" >/dev/stderr
# use "regular" loop
echo "mounting $IMGFILE on loop" >/dev/stderr
- NEXTLOOP=""
+ NEXTLOOP=`mount | grep loop | tail -1 | awk '{print $1}' | awk -F "/" '{print $3}' | cut -c 5-6 | awk '{print $0+1}'`
if [ "x$NEXTLOOP" = "x" ] ; then
NEXTLOOP=0
fi