freebsd-skq/libexec/rc/rc.d/mountcritlocal
bz 6fa8790c31 Move the rc framework out of sbin/init into libexec/rc.
The reasons for this are forward looking to pkgbase:
 * /sbin/init is a special binary; try not to replace it with
   every package update because an rc script was touched.
   (a follow-up commit will make init its own package)
 * having rc in its own place will allow more easy replacement
   of the rc framework with alternatives, such as openrc.

Discussed with:		brd (during BSDCam), kmoore
Requested by:		cem, bz
PR:			231522
Approved by:		re (gjb)
2018-10-17 16:49:11 +00:00

65 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: mountcritlocal
# REQUIRE: root hostid_save mdconfig
# KEYWORD: nojail shutdown
. /etc/rc.subr
name="mountcritlocal"
desc="Mount critical local filesystems"
start_cmd="mountcritlocal_start"
stop_cmd=sync
mountcritlocal_start()
{
local err holders waited
# Set up the list of network filesystem types for which mounting
# should be delayed until after network initialization.
case ${extra_netfs_types} in
[Nn][Oo])
;;
*)
netfs_types="${netfs_types} ${extra_netfs_types}"
;;
esac
# Mount everything except nfs filesystems.
check_startmsgs && echo -n 'Mounting local filesystems:'
mount_excludes='no'
for i in ${netfs_types}; do
fstype=${i%:*}
mount_excludes="${mount_excludes}${fstype},"
done
mount_excludes=${mount_excludes%,}
mount -a -t ${mount_excludes}
err=$?
if [ ${err} -ne 0 ]; then
echo 'Mounting /etc/fstab filesystems failed,' \
'will retry after root mount hold release'
root_hold_wait
mount -a -t ${mount_excludes}
err=$?
fi
check_startmsgs && echo '.'
case ${err} in
0)
;;
*)
echo 'Mounting /etc/fstab filesystems failed,' \
'startup aborted'
stop_boot true
;;
esac
}
load_rc_config $name
run_rc_command "$1"