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
7
# Also mounts SMB filesystems now, so the name of
8
# this script is getting increasingly inaccurate.
10
# Version: @(#)mountnfs.sh 2.86-5 10-Sep-2004 miquels@cistron.nl
15
[ -f /etc/default/rcS ] && . /etc/default/rcS
16
. /etc/init.d/bootclean.sh
19
# Run in a subshell because of I/O redirection.
21
test -f /etc/fstab && (
24
# Read through fstab line by line. If it is NFS, set the flag
25
# for mounting NFS file systems. If any NFS partition is found and it
26
# not mounted with the nolock option, we start the portmapper.
29
while read device mountpt fstype options
53
smbfs|cifs|coda|ncp|ncpfs)
62
$fstype|*,$fstype|$fstype,*|*,$fstype,*)
65
NETFS="$NETFS${NETFS:+,}$fstype"
73
if [ "$portmap" = yes ]
75
if [ -x /sbin/portmap ]
77
echo -n "Starting portmapper..."
78
start-stop-daemon --start --quiet --exec /sbin/portmap
85
echo "Mounting remote filesystems..."
92
# Clean /tmp, /var/lock, /var/run
4
# Required-Start: $local_fs
6
# Should-Start: $network $portmap nfs-common udev-mtab
9
# Short-Description: Wait for network file systems to be mounted
10
# Description: Network file systems are mounted by
11
# /etc/network/if-up.d/mountnfs in the background
12
# when interfaces are brought up; this script waits
13
# for them to be mounted before carrying on.
17
. /lib/lsb/init-functions
19
do_wait_async_mount() {
20
[ -f /etc/fstab ] || return
22
# Read through fstab line by line. If it is NFS, set the flag
23
# for mounting NFS file systems. If any NFS partition is found
24
# then wait around for it.
30
while read DEV MTPT FSTYPE OPTS REST
38
noauto|*,noauto|noauto,*|*,noauto,*)
43
nfs|nfs4|smbfs|cifs|coda|ncp|ncpfs|ocfs2|gfs)
50
/usr/local|/usr/local/*)
53
waitnfs="$waitnfs $MTPT"
56
waitnfs="$waitnfs $MTPT"
63
# Wait for each path, the timeout is for all of them as that's
64
# really the maximum time we have to wait anyway
66
for mountpt in $waitnfs; do
67
log_action_begin_msg "Waiting for $mountpt"
69
while ! mountpoint -q $mountpt; do
72
TIMEOUT=$(( $TIMEOUT - 1 ))
73
if [ $TIMEOUT -le 0 ]; then
79
if [ $TIMEOUT -gt 0 ]; then
87
# Using 'no !=' instead of 'yes =' to make sure async nfs
88
# mounting is the default even without a value in
90
if [ no != "$ASYNCMOUNTNFS" ] ; then
93
FROMINITD=yes /etc/network/if-up.d/mountnfs
96
restart|reload|force-reload)
97
echo "Error: argument '$1' not supported" >&2
103
echo "Usage: $0 start|stop" >&2