xref: /onnv-gate/usr/src/cmd/initpkg/rc0.sh (revision 8944:e4ff744ddfe1)
10Sstevel@tonic-gate#!/sbin/sh
20Sstevel@tonic-gate#
30Sstevel@tonic-gate# CDDL HEADER START
40Sstevel@tonic-gate#
50Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*8944Sdp@eng.sun.com# Common Development and Distribution License (the "License").
7*8944Sdp@eng.sun.com# You may not use this file except in compliance with the License.
80Sstevel@tonic-gate#
90Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate# See the License for the specific language governing permissions
120Sstevel@tonic-gate# and limitations under the License.
130Sstevel@tonic-gate#
140Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate#
200Sstevel@tonic-gate# CDDL HEADER END
210Sstevel@tonic-gate#
220Sstevel@tonic-gate#
230Sstevel@tonic-gate# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
240Sstevel@tonic-gate# All rights reserved.
250Sstevel@tonic-gate#
260Sstevel@tonic-gate#
27*8944Sdp@eng.sun.com# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
280Sstevel@tonic-gate# Use is subject to license terms.
290Sstevel@tonic-gate#
300Sstevel@tonic-gate
310Sstevel@tonic-gate# "Run Commands" for init states 0, 5 and 6.
320Sstevel@tonic-gate
330Sstevel@tonic-gatePATH=/usr/sbin:/usr/bin
340Sstevel@tonic-gate
350Sstevel@tonic-gateif [ -z "$SMF_RESTARTER" ]; then
360Sstevel@tonic-gate	echo "Cannot be run outside smf(5)"
370Sstevel@tonic-gate	exit 1
380Sstevel@tonic-gatefi
390Sstevel@tonic-gate
400Sstevel@tonic-gate# Export boot parameters to rc scripts
410Sstevel@tonic-gate
420Sstevel@tonic-gateset -- `/usr/bin/who -r`
430Sstevel@tonic-gate
440Sstevel@tonic-gate_INIT_RUN_LEVEL="$7"	# Current run-level
450Sstevel@tonic-gate_INIT_RUN_NPREV="$8"	# Number of times previously at current run-level
460Sstevel@tonic-gate_INIT_PREV_LEVEL="$9"	# Previous run-level
470Sstevel@tonic-gate
480Sstevel@tonic-gateset -- `/usr/bin/uname -a`
490Sstevel@tonic-gate
500Sstevel@tonic-gate_INIT_UTS_SYSNAME="$1"  # Operating system name (uname -s)
510Sstevel@tonic-gate_INIT_UTS_NODENAME="$2" # Node name (uname -n)
520Sstevel@tonic-gate_INIT_UTS_RELEASE="$3"  # Operating system release (uname -r)
530Sstevel@tonic-gate_INIT_UTS_VERSION="$4"  # Operating system version (uname -v)
540Sstevel@tonic-gate_INIT_UTS_MACHINE="$5"  # Machine class (uname -m)
550Sstevel@tonic-gate_INIT_UTS_ISA="$6"      # Instruction set architecture (uname -p)
560Sstevel@tonic-gate_INIT_UTS_PLATFORM="$7" # Platform string (uname -i)
570Sstevel@tonic-gate
580Sstevel@tonic-gateexport _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
590Sstevel@tonic-gate    _INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
600Sstevel@tonic-gate    _INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
610Sstevel@tonic-gate
620Sstevel@tonic-gateif [ -d /etc/rc0.d ]; then
630Sstevel@tonic-gate	for f in /etc/rc0.d/K*; do
640Sstevel@tonic-gate		if [ -s $f ]; then
650Sstevel@tonic-gate			case $f in
660Sstevel@tonic-gate				*.sh)	/lib/svc/bin/lsvcrun -s $f stop;;
670Sstevel@tonic-gate				*)	/lib/svc/bin/lsvcrun $f stop;;
680Sstevel@tonic-gate			esac
690Sstevel@tonic-gate		fi
700Sstevel@tonic-gate	done
710Sstevel@tonic-gate
720Sstevel@tonic-gate	# System cleanup functions ONLY (things that end fast!)
730Sstevel@tonic-gate
740Sstevel@tonic-gate	for f in /etc/rc0.d/S*; do
750Sstevel@tonic-gate		if [ -s $f ]; then
760Sstevel@tonic-gate			case $f in
770Sstevel@tonic-gate				*.sh)	/lib/svc/bin/lsvcrun -s	 $f start;;
780Sstevel@tonic-gate				*)	/lib/svc/bin/lsvcrun $f start ;;
790Sstevel@tonic-gate			esac
800Sstevel@tonic-gate		fi
810Sstevel@tonic-gate	done
820Sstevel@tonic-gatefi
830Sstevel@tonic-gate
840Sstevel@tonic-gate[ -f /etc/.dynamic_routing ] && /usr/bin/rm -f /etc/.dynamic_routing
850Sstevel@tonic-gate
860Sstevel@tonic-gatetrap "" 15
87