freebsd-dev/etc/rc.d/mountcritlocal
Sean Chittenden 7e6b2a1467 Add a script that allows software RAID sets to be created before file
systems are mounted.  An example set of entries for /etc/rc.conf:

ataraid_enable="YES"
ataraid_devices="ar0"
ataraid_ar0_set="ad2 ad3"
ataraid_ar0_type="RAID1"

Because there is no "correct" way of doing ATA raid (ie, geom vs.
atacontrol vs. vinum) that is bikeshed proof, this rcng script stays within
the bounds of atacontrol and assumes that other RAID solutions for GEOM or
vinum will end up in a different rcNG script.

Reviewed by:	green
2003-12-14 09:42:02 +00:00

68 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
#
# $NetBSD: mountcritlocal,v 1.7 2002/04/29 12:29:53 lukem Exp $
# $FreeBSD$
#
# PROVIDE: mountcritlocal
# REQUIRE: root ataraid
# KEYWORD: FreeBSD NetBSD
. /etc/rc.subr
name="mountcritlocal"
start_cmd="mountcritlocal_start"
stop_cmd=":"
mountcritlocal_start()
{
case ${OSTYPE} in
FreeBSD)
# 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.
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}
case $? in
0)
;;
*)
echo 'Mounting /etc/fstab filesystems failed,' \
' startup aborted'
kill -QUIT $$
;;
esac
;;
NetBSD)
# Mount critical filesystems that are `local'
# (as specified in $critical_filesystems_local)
# This usually includes /var.
#
mount_critical_filesystems local
# clean up left-over files.
# this could include the cleanup of lock files and /var/run, etc.
#
rm -f /etc/nologin /var/spool/lock/LCK.* /var/spool/uucp/STST/*
(cd /var/run && rm -rf -- *)
;;
esac
}
load_rc_config $name
run_rc_command "$1"