#! /bin/sh # Description: Now that TCP/IP is configured, mount the NFS file # systems in /etc/fstab if needed. If possible, # start the portmapper before mounting (this is needed for # Linux 2.1.x and up). # # Also mounts SMB filesystems now, so the name of # this script is getting increasingly inaccurate. PATH=/sbin:/bin . /lib/init/vars.sh . /lib/lsb/init-functions . /lib/init/mount-functions.sh do_start() { [ -f /etc/fstab ] || return # # Read through fstab line by line. If it is NFS, set the flag # for mounting NFS file systems. If any NFS partition is found and it # not mounted with the nolock option, we start the portmapper. # # If any sec={krb5,krb5i,krb5p} option is given, or any of the file # systems are nfs4, we'll need to start rpc.gssd and/or rpc.idmapd too; # we'll leave that to nfs-common. # exec 9<&0 /dev/null 2>&1 then if [ -x /etc/init.d/portmap ] then /etc/init.d/portmap start else start-stop-daemon --start --quiet --oknodo --exec /sbin/portmap sleep 1 # FIXME: Actually synchronize with the process? fi fi fi # # Initialize nfs-common (which starts rpc.gssd and/or rpc.idmapd, and loads # the right kernel modules if applicable) if we use Kerberos and/or NFSv4 mounts. # if [ "$gss_or_idmap" = yes ] && [ -x /etc/init.d/nfs-common ] then /etc/init.d/nfs-common start fi if [ "$NETFS" ] then mount_all_nfs() { mount -a -t$NETFS ; } # Accept 64 or 96 (32/mount failure + 64/some mount succeeded) # as valid return statuses from mount. This partly works around # the problem of mount reporting an error status when # some filesystems are already mounted. RUNLEVEL=`runlevel` while [ "${RUNLEVEL}" = "unknown" ]; do if ps aux | grep -q " sh /etc/rcS.d/S45waitnfs.sh start$"; then break fi sleep 0.1 RUNLEVEL=`runlevel` done pre_mountall mount_all_nfs post_mountall fi } # Not for loopback! [ "$IFACE" != "lo" ] || exit 0 # Lock around this otherwise insanity may occur mkdir /var/run/network/mountnfs 2>/dev/null || exit 0 do_start rmdir /var/run/network/mountnfs 2>/dev/null || exit 0