rc revision 145693
143412Snewton#!/bin/sh
243412Snewton#
343412Snewton# Copyright (c) 2000-2004  The FreeBSD Project
443412Snewton# All rights reserved.
543412Snewton#
643412Snewton# Redistribution and use in source and binary forms, with or without
743412Snewton# modification, are permitted provided that the following conditions
843412Snewton# are met:
948503Sgreen# 1. Redistributions of source code must retain the above copyright
1043412Snewton#    notice, this list of conditions and the following disclaimer.
1143412Snewton# 2. Redistributions in binary form must reproduce the above copyright
1243412Snewton#    notice, this list of conditions and the following disclaimer in the
1343412Snewton#    documentation and/or other materials provided with the distribution.
1443412Snewton#
1543412Snewton# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1643412Snewton# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1743412Snewton# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1843412Snewton# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1943412Snewton# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2043412Snewton# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2143412Snewton# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2243412Snewton# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2343412Snewton# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2443412Snewton# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2543412Snewton# SUCH DAMAGE.
2643412Snewton#
2743412Snewton#	@(#)rc	5.27 (Berkeley) 6/5/91
2843412Snewton# $FreeBSD: head/etc/rc 145693 2005-04-29 23:02:56Z brooks $
2943412Snewton#
3043412Snewton
3143412Snewton# System startup script run by init on autoboot
3243412Snewton# or after single-user.
3343412Snewton# Output and error are redirected to console by init,
3443412Snewton# and the console is the controlling terminal.
3543412Snewton
3643412Snewton# Note that almost all of the user-configurable behavior is no longer in
3743412Snewton# this file, but rather in /etc/defaults/rc.conf.  Please check that file
3843412Snewton# first before contemplating any changes here.  If you do need to change
3943412Snewton# this file for some reason, we would like to know about it.
4043412Snewton
4143412Snewtonstty status '^T'
4243412Snewton
4343412Snewton# Set shell to ignore SIGINT (2), but not children;
4443412Snewton# shell catches SIGQUIT (3) and returns to single user.
4543412Snewton#
4643412Snewtontrap : 2
4743412Snewtontrap "echo 'Boot interrupted'; exit 1" 3
4843412Snewton
4943412SnewtonHOME=/
5043412SnewtonPATH=/sbin:/bin:/usr/sbin:/usr/bin
5143412Snewtonexport HOME PATH
5243412Snewton
5343412Snewton. /etc/rc.subr
5443412Snewton
5543412Snewton# Note: the system configuration files are loaded as part of
5643412Snewton# the RCNG system (rc.d/rcconf.sh).  Do not load them here as it may
5743412Snewton# interfere with diskless booting.
5843412Snewton#
5943412Snewtonif [ "$1" = autoboot ]; then
6043412Snewton	autoboot=yes
6143412Snewton	_boot="faststart"
6243412Snewton	rc_fast=yes        # run_rc_command(): do fast booting
6343412Snewtonelse
6443412Snewton	autoboot=no
6543412Snewton	_boot="start"
6643412Snewtonfi
6743412Snewton
6843412Snewtondlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
6943412Snewtonif [ ${dlv:=0} -ne 0 -o -f /etc/diskless ]; then
7043412Snewton	sh /etc/rc.initdiskless
7143412Snewtonfi
7243412Snewton
7343412Snewtonskip="-s nostart"
7443412Snewton[ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && skip="$skip -s nojail"
7543412Snewtonfiles=`rcorder ${skip} /etc/rc.d/* 2>/dev/null`
7643412Snewton
7743412Snewtonfor _rc_elem in ${files}; do
7843412Snewton	run_rc_script ${_rc_elem} ${_boot}
7943412Snewtondone
8043412Snewton
8143412Snewtonecho ''
8243412Snewtondate
8343412Snewtonexit 0
8443412Snewton