]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/rc.d/mountcritremote
This commit was generated by cvs2svn to compensate for changes in r165009,
[FreeBSD/FreeBSD.git] / etc / rc.d / mountcritremote
1 #!/bin/sh
2 #
3 # $NetBSD: mountcritremote,v 1.7 2002/04/29 12:29:53 lukem Exp $
4 # $FreeBSD$
5 #
6
7 # PROVIDE: mountcritremote
8 # REQUIRE: NETWORKING root mountcritlocal cleanvar ipsec
9 # KEYWORD: nojail
10
11 . /etc/rc.subr
12
13 name="mountcritremote"
14 stop_cmd=":"
15 start_cmd="mountcritremote_start"
16 start_precmd="mountcritremote_precmd"
17
18 # Mount NFS filesystems if present in /etc/fstab
19 #
20 # XXX When the vfsload() issues with nfsclient support and related sysctls
21 # have been resolved, this block can be removed, and the condition that
22 # skips nfs in the following block (for "other network filesystems") can
23 # be removed.
24 #
25 mountcritremote_precmd()
26 {
27         case "`mount -d -a -t nfs 2> /dev/null`" in
28         *mount_nfs*)
29                 # Handle absent nfs client support
30                 if ! sysctl vfs.nfs >/dev/null 2>&1; then
31                         kldload nfsclient || { warn 'nfs mount ' \
32                             'requested, but no nfs client in kernel'; \
33                             return 1; }
34                 fi
35                 ;;
36         esac
37         return 0
38 }
39
40 mountcritremote_start()
41 {
42         # Mount nfs filesystems.
43         #
44         echo -n 'Mounting NFS file systems:'
45         mount -a -t nfs
46         echo '.'
47
48         # Mount other network filesystems if present in /etc/fstab.
49         case ${extra_netfs_types} in
50         [Nn][Oo])
51                 ;;
52         *)
53                 netfs_types="${netfs_types} ${extra_netfs_types}"
54                 ;;
55         esac
56
57         for i in ${netfs_types}; do
58                 fstype=${i%:*}
59                 fsdecr=${i#*:}
60
61                 [ "${fstype}" = "nfs" ] && continue
62
63                 case "`mount -d -a -t ${fstype}`" in
64                 *mount_${fstype}*)
65                         echo -n "Mounting ${fsdecr} file systems:"
66                         mount -a -t ${fstype}
67                         echo '.'
68                         ;;
69                 esac
70         done
71
72         # Cleanup /var again just in case it's a network mount.
73         /etc/rc.d/cleanvar reload
74         rm -f /var/run/clean_var /var/spool/lock/clean_var
75 }
76
77 load_rc_config $name
78 run_rc_command "$1"