:
#
#	System V NFS
#
#	Copyright 1986, 1987, 1988, 1989 Lachman Associates, Incorporated (LAI)
#
#	All Rights Reserved.
#
#	The copyright above and this notice must be preserved in all
#	copies of this source code.  The copyright above does not
#	evidence any actual or intended publication of this source
#	code.
#
#	This is unpublished proprietary trade secret source code of
#	Lachman Associates.  This source code may not be copied,
#	disclosed, distributed, demonstrated or licensed except as
#	expressly authorized by Lachman Associates.
#

#      @(#)numountall	4.4 System V NFS source

PATH=/etc:/bin:/usr/bin

PIDS=""

#
# Figure out what can be dismounted.
#

PASS1=`/etc/mount | cut -f3 -d' ' - | grep -v '^/' | grep ':/'`

PASS2=`(
for dir in $PASS1
do
	/etc/mount | grep $dir
done |
cut -f1 -d" " - | sort -r | uniq )`

# use fuser to unmount NFS file systems

if [ "$PASS1" != "" ]
then
	echo "(Please wait...)"

	FKLIST=`fuser $PASS1 2>&1 | cut -f2- -d" " - | tr -d '[a-z]'`

	if [ "$FKLIST" != "" ]
	then
		kill -1 $FKLIST 2> /dev/null
		sleep 1
		kill -15 $FKLIST 2> /dev/null
		sleep 1
		kill -9 $FKLIST 2> /dev/null

		echo "Terminated: $FKLIST"
	fi
fi

# Dismount things now.

for mnt in $PASS2
do
	if [ $mnt != "" ]
	then
		echo "[Dismounting $mnt]"
		/etc/umount $mnt
	fi
done
