#!/bin/posix/sh
#@(#)HP X Station Admin Scripts
#
# wherelives
#  Get mount point of file system to which file/dir from $1 belongs
#  (to be used later to update /etc/exports in order for this X station
#  to be able to access file server via NFS.)
#
set -u
FILE=$1
#
# do basic file/dir existence check
#
if [ ! -r $FILE ]
then
  $NLECHO "fileNotExist $FILE"
  exit 1
fi

MOUNTPOINT=`osMountPoint $FILE`

if [ $? -ne 0 ]
then
  $NLECHO "noMountPoint $FILE"
  exit 1
fi

#
# Now make sure the mount point is a local file system
#
grep '^/' $MOUNTTABLE | grep $MOUNTPOINT > /dev/null

if [ $? -ne 0 ]
then
  $NLECHO "nonLocalMountPoint $FILE"
  exit 1
fi

echo $MOUNTPOINT

exit 0




