kernel/usb4bsd: Sync urtwn(4) with current FreeBSD.
[dragonfly.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: src/etc/rc.d/mountcritremote,v 1.6 2003/06/01 01:43:37 gordon Exp $
5 #
6
7 # PROVIDE: mountcritremote
8 # REQUIRE: NETWORKING root mountcritlocal cleanvar
9
10 . /etc/rc.subr
11
12 name="mountcritremote"
13 stop_cmd=":"
14
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                 kldload -n nfs || return 1
31                 ;;
32         esac
33         return 0
34 }
35
36 mountcritremote_start()
37 {
38         # Mount nfs filesystems.
39         #
40         echo -n 'Mounting NFS file systems:'
41         mount -a -t nfs
42         echo '.'
43         # Mount other network filesystems if present in /etc/fstab.
44         case ${extra_netfs_types} in
45         [Nn][Oo])
46                 ;;
47         *)
48                 netfs_types="${netfs_types} ${extra_netfs_types}"
49                 ;;
50         esac
51         for i in ${netfs_types}; do
52                 fstype=${i%:*}
53                 fsdecr=${i#*:}
54                 [ "${fstype}" = "nfs" ] && continue
55                 case "`mount -d -a -t ${fstype}`" in
56                 *mount_${fstype}*)
57                         echo -n "Mounting ${fsdecr} file systems:"
58                         mount -a -t ${fstype}
59                         echo '.'
60                         ;;
61                 esac
62         done
63
64         # Cleanup /var again just in case it's a network mount.
65         /etc/rc.d/cleanvar reload
66         rm -f /var/run/clean_var /var/spool/lock/clean_var
67 }
68
69 load_rc_config $name
70 run_rc_command "$1"