home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 February / PCWorld_2000-02_cd.bin / live / etc / init.d / mountnfs.sh < prev    next >
Text File  |  1998-10-05  |  1KB  |  59 lines

  1. #
  2. # mountnfs.sh    Now that TCP/IP is configured, mount the NFS file
  3. #        systems in /etc/fstab if needed. If possible,
  4. #        start the portmapper before mounting (this is needed for
  5. #        Linux 2.1.x and up).
  6. #
  7. # Version:    @(#)mountnfs.sh  1.11  05-Oct-1998  miquels@cistron.nl
  8. #
  9.  
  10. . /etc/default/rcS
  11.  
  12. #
  13. #    Run in a subshell because of I/O redirection.
  14. #
  15. test -f /etc/fstab && (
  16.  
  17. #
  18. #    Read through fstab line by line. If it is NFS, set the flag
  19. #    for mounting NFS file systems. If any NFS partition is found and it
  20. #    not mounted with the nolock option, we start the portmapper.
  21. #
  22. portmap=no
  23. mount_nfs=no
  24. while read device mountpt fstype options
  25. do
  26.     if [ "$fstype" = nfs ]
  27.     then
  28.         mount_nfs=yes
  29.         case "$options" in
  30.             *nolock*)
  31.                 ;;
  32.             *)
  33.                 portmap=yes
  34.                 ;;
  35.         esac
  36.     fi
  37. done
  38.  
  39. exec 0>&1
  40.  
  41. if [ "$portmap" = yes ]
  42. then
  43.     if [ -x /sbin/portmap ]
  44.     then
  45.         echo -n "Starting portmapper... "
  46.         start-stop-daemon --start --quiet --exec /sbin/portmap
  47.         sleep 2
  48.     fi
  49. fi
  50.  
  51. if [ "$mount_nfs" = yes ]
  52. then
  53.     echo "Mounting remote filesystems..."
  54.     mount -a -t nfs
  55. fi
  56.  
  57. ) < /etc/fstab
  58.  
  59.