1#!/bin/sh 2# 3# 4 5# PROVIDE: mountcritlocal 6# REQUIRE: root hostid_save mdconfig 7# KEYWORD: nojail shutdown 8 9. /etc/rc.subr 10 11name="mountcritlocal" 12desc="Mount critical local filesystems" 13start_cmd="mountcritlocal_start" 14stop_cmd=sync 15 16mountcritlocal_start() 17{ 18 local err holders waited 19 20 # Set up the list of network filesystem types for which mounting 21 # should be delayed until after network initialization. 22 case ${extra_netfs_types} in 23 [Nn][Oo]) 24 ;; 25 *) 26 netfs_types="${netfs_types} ${extra_netfs_types}" 27 ;; 28 esac 29 30 while read a b vfstype rest; do 31 if [ "$vfstype" = "zfs" -a "${a#\#}" = "$a" ]; then 32 # zpool is needed for legacy ZFS 33 echo 'Importing zpools for legacy ZFS' 34 /etc/rc.d/zpool start 35 break 36 fi 37 done < /etc/fstab 38 39 # Mount everything except nfs filesystems. 40 startmsg -n 'Mounting local filesystems:' 41 mount_excludes='no' 42 for i in ${netfs_types}; do 43 fstype=${i%:*} 44 mount_excludes="${mount_excludes}${fstype}," 45 done 46 mount_excludes=${mount_excludes%,} 47 48 mount -a -t ${mount_excludes} 49 err=$? 50 if [ ${err} -ne 0 ]; then 51 echo 'Mounting /etc/fstab filesystems failed,' \ 52 'will retry after root mount hold release' 53 root_hold_wait 54 mount -a -t ${mount_excludes} 55 err=$? 56 fi 57 58 startmsg '.' 59 60 case ${err} in 61 0) 62 ;; 63 *) 64 echo 'Mounting /etc/fstab filesystems failed,' \ 65 'startup aborted' 66 stop_boot true 67 ;; 68 esac 69} 70 71load_rc_config $name 72 73# mounting shall not be performed in a svcj 74mountcritlocal_svcj="NO" 75 76run_rc_command "$1" 77