#!/bin/sh

###############################################################################
#									      #
#	       UNIX Interactive Tools 4.3.1  auto-mount script		      #
#	    Copyright (c) 1993, 1994 Tudor Hulubei & Andrei Pitis	      #
#									      #
###############################################################################

#
# This script is for Linux only.
# The ideea of this script is quite general but the script needs
# some changes in order to run on other UNIX systems.
# The major change is in the file system types list.
#
# If you enhance this script, please send me a patch (tudor@ulise.cs.pub.ro).
# I'll include it in the next release.
#

name=`basename $0`

if [ $# != 1 ]
then
    echo usage: ${name} device  "    (ex:  " $name fd0 ")"
    exit 1
fi

for fstype in ext2 msdos minix ext xiafs hpfs
do
    echo checking for $fstype file system ...
    mount -t $fstype /dev/$1 /mnt/$1 > /dev/null 2> /dev/null
    ok=$?
    if [ $ok = 0 ]
    then
	echo $fstype file system succesfully mounted
	exit 0
    fi
done

echo wrong fs type, /dev/$1 already mounted, /mnt/$1 busy, or other error >&2
exit 1
