nrelease - fix/improve livecd
[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
9 # BEFORE:  SERVERS
10
11 . /etc/rc.subr
12
13 name="mountcritremote"
14 stop_cmd=":"
15
16 start_cmd="mountcritremote_start"
17 start_precmd="mountcritremote_precmd"
18
19 # Mount NFS filesystems if present in /etc/fstab
20 #
21 # XXX When the vfsload() issues with nfsclient support and related sysctls
22 # have been resolved, this block can be removed, and the condition that
23 # skips nfs in the following block (for "other network filesystems") can
24 # be removed.
25 #
26 mountcritremote_precmd()
27 {
28         case "`mount -d -a -t nfs 2> /dev/null`" in
29         *mount_nfs*)
30                 # Handle absent nfs client support
31                 kldstat -qm nfs || kldload -n nfs || return 1
32                 ;;
33         esac
34         return 0
35 }
36
37 mountcritremote_start()
38 {
39         # Mount nfs filesystems.
40         #
41         echo -n 'Mounting NFS file systems:'
42         mount -a -t nfs
43         echo '.'
44         # Mount other network filesystems if present in /etc/fstab.
45         case ${extra_netfs_types} in
46         [Nn][Oo])
47                 ;;
48         *)
49                 netfs_types="${netfs_types} ${extra_netfs_types}"
50                 ;;
51         esac
52         for i in ${netfs_types}; do
53                 fstype=${i%:*}
54                 fsdecr=${i#*:}
55                 [ "${fstype}" = "nfs" ] && continue
56                 case "`mount -d -a -t ${fstype}`" in
57                 *mount_${fstype}*)
58                         echo -n "Mounting ${fsdecr} file systems:"
59                         mount -a -t ${fstype}
60                         echo '.'
61                         ;;
62                 esac
63         done
64
65         # Cleanup /var again just in case it's a network mount.
66         /etc/rc.d/cleanvar reload
67         rm -f /var/run/clean_var /var/spool/lock/clean_var
68 }
69
70 load_rc_config $name
71 run_rc_command "$1"