1#!/bin/sh 2### BEGIN INIT INFO 3# Provides: mountnfs 4# Required-Start: $local_fs $network $rpcbind 5# Required-Stop: 6# Default-Start: S 7# Default-Stop: 8### END INIT INFO 9 10# 11# Run in a subshell because of I/O redirection. 12# 13test -f /etc/fstab && ( 14 15# 16# Read through fstab line by line. If it is NFS, set the flag 17# for mounting NFS filesystems. If any NFS partition is found and it 18# not mounted with the nolock option, we start the rpcbind. 19# 20rpcbind=no 21mount_nfs=no 22mount_smb=no 23mount_ncp=no 24mount_cifs=no 25while read device mountpt fstype options 26do 27 case "$device" in 28 ""|\#*) 29 continue 30 ;; 31 esac 32 33 case "$options" in 34 *noauto*) 35 continue 36 ;; 37 esac 38 39 if test "$fstype" = nfs 40 then 41 mount_nfs=yes 42 case "$options" in 43 *nolock*) 44 ;; 45 *) 46 rpcbind=yes 47 ;; 48 esac 49 fi 50 if test "$fstype" = smbfs 51 then 52 mount_smb=yes 53 fi 54 if test "$fstype" = ncpfs 55 then 56 mount_ncp=yes 57 fi 58 if test "$fstype" = cifs 59 then 60 mount_cifs=yes 61 fi 62done 63 64exec 0>&1 65 66if test "$rpcbind" = yes 67then 68 if test -x /usr/sbin/rpcbind 69 then 70 service rpcbind status > /dev/null 71 if [ $? != 0 ]; then 72 echo -n "Starting rpcbind..." 73 start-stop-daemon --start --quiet --exec /usr/sbin/rpcbind 74 sleep 2 75 fi 76 fi 77fi 78 79if test "$mount_nfs" = yes || test "$mount_smb" = yes || test "$mount_ncp" = yes || test "$mount_cifs" = yes 80then 81 echo "Mounting remote filesystems..." 82 test "$mount_nfs" = yes && mount -a -t nfs 83 test "$mount_smb" = yes && mount -a -t smbfs 84 test "$mount_ncp" = yes && mount -a -t ncpfs 85 test "$mount_cifs" = yes && mount -a -t cifs 86fi 87 88) < /etc/fstab 89 90: exit 0 91 92