]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/rc.d/mountcritlocal
Merge branch 'releng/11.3' into releng-CDN/11.3
[FreeBSD/FreeBSD.git] / etc / rc.d / mountcritlocal
1 #!/bin/sh
2 #
3 # $FreeBSD$
4 #
5
6 # PROVIDE: mountcritlocal
7 # REQUIRE: root hostid_save mdconfig
8 # KEYWORD: nojail shutdown
9
10 . /etc/rc.subr
11
12 name="mountcritlocal"
13 desc="Mount critical local filesystems"
14 start_cmd="mountcritlocal_start"
15 stop_cmd=sync
16
17 mountcritlocal_start()
18 {
19         local err holders waited
20
21         # Set up the list of network filesystem types for which mounting
22         # should be delayed until after network initialization.
23         case ${extra_netfs_types} in
24         [Nn][Oo])
25                 ;;
26         *)
27                 netfs_types="${netfs_types} ${extra_netfs_types}"
28                 ;;
29         esac
30
31         # Mount everything except nfs filesystems.
32         check_startmsgs && echo -n 'Mounting local filesystems:'
33         mount_excludes='no'
34         for i in ${netfs_types}; do
35                 fstype=${i%:*}
36                 mount_excludes="${mount_excludes}${fstype},"
37         done
38         mount_excludes=${mount_excludes%,}
39
40         mount -a -t ${mount_excludes}
41         err=$?
42         if [ ${err} -ne 0 ]; then
43                 echo 'Mounting /etc/fstab filesystems failed,' \
44                     'will retry after root mount hold release'
45                 root_hold_wait
46                 mount -a -t ${mount_excludes}
47                 err=$?
48         fi
49
50         check_startmsgs && echo '.'
51
52         case ${err} in
53         0)
54                 ;;
55         *)
56                 echo 'Mounting /etc/fstab filesystems failed,' \
57                     'startup aborted'
58                 stop_boot true
59                 ;;
60         esac
61 }
62
63 load_rc_config $name
64 run_rc_command "$1"