home *** CD-ROM | disk | FTP | other *** search
/ norge.freeshell.org (192.94.73.8) / 192.94.73.8.tar / 192.94.73.8 / pub / computers / 3b2 / diskumount < prev    next >
Text File  |  1985-05-23  |  753b  |  42 lines

  1. #    @(#)diskumount    1.4    /sccs/src/cmd/sadmin/shell/s.diskumount
  2. #    perform a umount, complain if it doesn't work
  3.  
  4. #!    chmod +x ${file}
  5.  
  6. #    $1 == the device mounted.
  7. #    $2 == the mount point directory (optional).
  8.  
  9. ndrive='drive'
  10.  
  11. case "$1" in
  12. -n )
  13.     ndrive=$2
  14.     shift
  15.     shift
  16. esac
  17.  
  18. msg=`/etc/umount ${1:?} 2>&1`
  19. case "${msg}" in
  20. '' )
  21.     if [ -d "$2" ]
  22.     then
  23.         chmod 0 $2
  24.     fi
  25.     echo >&2 $2 ${2:+'unmounted. '} \
  26.         "You may now remove the medium from the ${ndrive}.\n"
  27.     ;;
  28. *' busy' )
  29.     echo >&2 "
  30.     The file system is \"busy\" which means that either some command
  31.     is using files under ${2:-it} or someone is logged in and currently
  32.     in a directory within the file system."
  33.     exit 1
  34.     ;;
  35. *' not mounted' )
  36.     ;;
  37. * )
  38.     admerr $0 "/etc/umount got '${msg}'"
  39.     exit 1
  40. esac
  41. exit 0
  42.