diff options
Diffstat (limited to 'meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh')
-rwxr-xr-x | meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh new file mode 100755 index 0000000000..4fffe4e808 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh | |||
@@ -0,0 +1,90 @@ | |||
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 | . /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 filesystems. If any NFS partition is found and it | ||
20 | # not mounted with the nolock option, we start the rpcbind. | ||
21 | # | ||
22 | rpcbind=no | ||
23 | mount_nfs=no | ||
24 | mount_smb=no | ||
25 | mount_ncp=no | ||
26 | mount_cifs=no | ||
27 | while read device mountpt fstype options | ||
28 | do | ||
29 | case "$device" in | ||
30 | ""|\#*) | ||
31 | continue | ||
32 | ;; | ||
33 | esac | ||
34 | |||
35 | case "$options" in | ||
36 | *noauto*) | ||
37 | continue | ||
38 | ;; | ||
39 | esac | ||
40 | |||
41 | if test "$fstype" = nfs | ||
42 | then | ||
43 | mount_nfs=yes | ||
44 | case "$options" in | ||
45 | *nolock*) | ||
46 | ;; | ||
47 | *) | ||
48 | rpcbind=yes | ||
49 | ;; | ||
50 | esac | ||
51 | fi | ||
52 | if test "$fstype" = smbfs | ||
53 | then | ||
54 | mount_smb=yes | ||
55 | fi | ||
56 | if test "$fstype" = ncpfs | ||
57 | then | ||
58 | mount_ncp=yes | ||
59 | fi | ||
60 | if test "$fstype" = cifs | ||
61 | then | ||
62 | mount_cifs=yes | ||
63 | fi | ||
64 | done | ||
65 | |||
66 | exec 0>&1 | ||
67 | |||
68 | if test "$rpcbind" = yes | ||
69 | then | ||
70 | if test -x /usr/sbin/rpcbind | ||
71 | then | ||
72 | echo -n "Starting rpcbind... " | ||
73 | start-stop-daemon --start --quiet --exec /usr/sbin/rpcbind | ||
74 | sleep 2 | ||
75 | fi | ||
76 | fi | ||
77 | |||
78 | if test "$mount_nfs" = yes || test "$mount_smb" = yes || test "$mount_ncp" = yes || test "$mount_cifs" = yes | ||
79 | then | ||
80 | echo "Mounting remote filesystems..." | ||
81 | test "$mount_nfs" = yes && mount -a -t nfs | ||
82 | test "$mount_smb" = yes && mount -a -t smbfs | ||
83 | test "$mount_ncp" = yes && mount -a -t ncpfs | ||
84 | test "$mount_cifs" = yes && mount -a -t cifs | ||
85 | fi | ||
86 | |||
87 | ) < /etc/fstab | ||
88 | |||
89 | : exit 0 | ||
90 | |||