#! /bin/sh
#
# |-----------------------------------------------------------|
# | Copyright (c) 1991, 1990 MIPS Computer Systems, Inc.      |
# | All Rights Reserved                                       |
# |-----------------------------------------------------------|
# |          Restricted Rights Legend                         |
# | Use, duplication, or disclosure by the Government is      |
# | subject to restrictions as set forth in                   |
# | subparagraph (c)(1)(ii) of the Rights in Technical        |
# | Data and Computer Software Clause of DFARS 252.227-7013.  |
# |         MIPS Computer Systems, Inc.                       |
# |         950 DeGuigne Avenue                               |
# |         Sunnyvale, California 94088-3650, USA             |
# |-----------------------------------------------------------|
#
# $Header: diskumount,v 1.6.2.1 92/06/24 13:47:42 marker Exp $
#	perform a umount, complain if it doesn't work

#!	chmod +x ${file}

#	$1 == the device mounted.
#	$2 == the mount point directory (optional).

ndrive='drive'

case "$1" in
-n )
	ndrive=$2
	shift
	shift
esac

msg=`/etc/umount ${1:?} 2>&1`
case "${msg}" in
'' )
	if [ -d "$2" ]
	then
		chmod 0 $2
	fi
	echo >&2 $2 ${2:+'unmounted. '} \
		"You may now remove the medium from the ${ndrive}.\n"
	;;
*' busy' )
	echo >&2 "
	The file system is \"busy\" which means that either some command
	is using files under ${2:-it} or someone is logged in and currently
	in a directory within the file system."
	exit 1
	;;
*' not mounted' )
	;;
* )
	admerr $0 "/etc/umount got '${msg}'"
	exit 1
esac
exit 0
