@@ -160,6 +160,37 @@ _mount()
$MOUNT_PROG `_mount_ops_filter $*`
}
+# the mount point must be the last parameter
+_get_mount()
+{
+ local mnt_point=${!#}
+
+ _mount $*
+ if [ $? -eq 0 ];then
+ MOUNTED_POINT_STACK=`echo "$mnt_point $MOUNTED_POINT_STACK"`
+ else
+ return 1
+ fi
+}
+
+_put_mount()
+{
+ local last_mnt=`echo $MOUNTED_POINT_STACK | awk '{print $1}'`
+
+ if [ -n "$last_mnt" ];then
+ umount $last_mnt
+ fi
+ MOUNTED_POINT_STACK=`echo $MOUNTED_POINT_STACK | cut -d\ -f2-`
+}
+
+_clear_mount_stack()
+{
+ if [ -n "$MOUNTED_POINT_STACK" ];then
+ umount $MOUNTED_POINT_STACK
+ fi
+ MOUNTED_POINT_STACK=""
+}
+
_scratch_options()
{
type=$1