freebsd-dev/etc/rc.d/mountcritlocal
Dag-Erling Smørgrav 4b4f91707c Teach mount(8) about a 'late' keyword, which means the file system should
not be mounted unless the -l flag was specified.

Add an rc script, mountlate, which basically runs 'mount -a -l'.  It runs
after DAEMON but before LOGIN.

This is useful for things like loopback mounts, because mountcritremote
runs before mountd  / nfsd (since /usr might be a remote file system), so
an attempt to mount a loopback network file system in mountcritremote will
fail.

Also add a progress message to mountcritlocal, for the sake of symmetry
with similar messages in mountcritremote and mountlate.

Reviewed by:	freebsd-rc
MFC after:	3 weeks
2006-07-12 16:05:51 +00:00

53 lines
953 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: mountcritlocal,v 1.7 2002/04/29 12:29:53 lukem Exp $
# $FreeBSD$
#
# PROVIDE: mountcritlocal
# REQUIRE: root
# KEYWORD: nojail
. /etc/rc.subr
name="mountcritlocal"
start_cmd="mountcritlocal_start"
stop_cmd=":"
mountcritlocal_start()
{
# 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.
echo -n 'Mounting local file systems:'
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}
echo '.'
case $? in
0)
;;
*)
echo 'Mounting /etc/fstab filesystems failed,' \
' startup aborted'
kill -QUIT $$
;;
esac
}
load_rc_config $name
run_rc_command "$1"