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