xref: /titanic_51/usr/src/cmd/initpkg/rc0.sh (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate#!/sbin/sh
2*7c478bd9Sstevel@tonic-gate#
3*7c478bd9Sstevel@tonic-gate# CDDL HEADER START
4*7c478bd9Sstevel@tonic-gate#
5*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
7*7c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
8*7c478bd9Sstevel@tonic-gate# with the License.
9*7c478bd9Sstevel@tonic-gate#
10*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
12*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
13*7c478bd9Sstevel@tonic-gate# and limitations under the License.
14*7c478bd9Sstevel@tonic-gate#
15*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
16*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
18*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
19*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
20*7c478bd9Sstevel@tonic-gate#
21*7c478bd9Sstevel@tonic-gate# CDDL HEADER END
22*7c478bd9Sstevel@tonic-gate#
23*7c478bd9Sstevel@tonic-gate#
24*7c478bd9Sstevel@tonic-gate# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
25*7c478bd9Sstevel@tonic-gate# All rights reserved.
26*7c478bd9Sstevel@tonic-gate#
27*7c478bd9Sstevel@tonic-gate#
28*7c478bd9Sstevel@tonic-gate# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
29*7c478bd9Sstevel@tonic-gate# Use is subject to license terms.
30*7c478bd9Sstevel@tonic-gate#
31*7c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
32*7c478bd9Sstevel@tonic-gate
33*7c478bd9Sstevel@tonic-gate# "Run Commands" for init states 0, 5 and 6.
34*7c478bd9Sstevel@tonic-gate
35*7c478bd9Sstevel@tonic-gatePATH=/usr/sbin:/usr/bin
36*7c478bd9Sstevel@tonic-gate
37*7c478bd9Sstevel@tonic-gateif [ -z "$SMF_RESTARTER" ]; then
38*7c478bd9Sstevel@tonic-gate	echo "Cannot be run outside smf(5)"
39*7c478bd9Sstevel@tonic-gate	exit 1
40*7c478bd9Sstevel@tonic-gatefi
41*7c478bd9Sstevel@tonic-gate
42*7c478bd9Sstevel@tonic-gate# Export boot parameters to rc scripts
43*7c478bd9Sstevel@tonic-gate
44*7c478bd9Sstevel@tonic-gateset -- `/usr/bin/who -r`
45*7c478bd9Sstevel@tonic-gate
46*7c478bd9Sstevel@tonic-gate_INIT_RUN_LEVEL="$7"	# Current run-level
47*7c478bd9Sstevel@tonic-gate_INIT_RUN_NPREV="$8"	# Number of times previously at current run-level
48*7c478bd9Sstevel@tonic-gate_INIT_PREV_LEVEL="$9"	# Previous run-level
49*7c478bd9Sstevel@tonic-gate
50*7c478bd9Sstevel@tonic-gateset -- `/usr/bin/uname -a`
51*7c478bd9Sstevel@tonic-gate
52*7c478bd9Sstevel@tonic-gate_INIT_UTS_SYSNAME="$1"  # Operating system name (uname -s)
53*7c478bd9Sstevel@tonic-gate_INIT_UTS_NODENAME="$2" # Node name (uname -n)
54*7c478bd9Sstevel@tonic-gate_INIT_UTS_RELEASE="$3"  # Operating system release (uname -r)
55*7c478bd9Sstevel@tonic-gate_INIT_UTS_VERSION="$4"  # Operating system version (uname -v)
56*7c478bd9Sstevel@tonic-gate_INIT_UTS_MACHINE="$5"  # Machine class (uname -m)
57*7c478bd9Sstevel@tonic-gate_INIT_UTS_ISA="$6"      # Instruction set architecture (uname -p)
58*7c478bd9Sstevel@tonic-gate_INIT_UTS_PLATFORM="$7" # Platform string (uname -i)
59*7c478bd9Sstevel@tonic-gate
60*7c478bd9Sstevel@tonic-gateexport _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
61*7c478bd9Sstevel@tonic-gate    _INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
62*7c478bd9Sstevel@tonic-gate    _INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
63*7c478bd9Sstevel@tonic-gate
64*7c478bd9Sstevel@tonic-gateif [ -d /etc/rc0.d ]; then
65*7c478bd9Sstevel@tonic-gate	for f in /etc/rc0.d/K*; do
66*7c478bd9Sstevel@tonic-gate		if [ -s $f ]; then
67*7c478bd9Sstevel@tonic-gate			case $f in
68*7c478bd9Sstevel@tonic-gate				*.sh)	/lib/svc/bin/lsvcrun -s $f stop;;
69*7c478bd9Sstevel@tonic-gate				*)	/lib/svc/bin/lsvcrun $f stop;;
70*7c478bd9Sstevel@tonic-gate			esac
71*7c478bd9Sstevel@tonic-gate		fi
72*7c478bd9Sstevel@tonic-gate	done
73*7c478bd9Sstevel@tonic-gate
74*7c478bd9Sstevel@tonic-gate	# System cleanup functions ONLY (things that end fast!)
75*7c478bd9Sstevel@tonic-gate
76*7c478bd9Sstevel@tonic-gate	for f in /etc/rc0.d/S*; do
77*7c478bd9Sstevel@tonic-gate		if [ -s $f ]; then
78*7c478bd9Sstevel@tonic-gate			case $f in
79*7c478bd9Sstevel@tonic-gate				*.sh)	/lib/svc/bin/lsvcrun -s	 $f start;;
80*7c478bd9Sstevel@tonic-gate				*)	/lib/svc/bin/lsvcrun $f start ;;
81*7c478bd9Sstevel@tonic-gate			esac
82*7c478bd9Sstevel@tonic-gate		fi
83*7c478bd9Sstevel@tonic-gate	done
84*7c478bd9Sstevel@tonic-gatefi
85*7c478bd9Sstevel@tonic-gate
86*7c478bd9Sstevel@tonic-gate[ -f /etc/.dynamic_routing ] && /usr/bin/rm -f /etc/.dynamic_routing
87*7c478bd9Sstevel@tonic-gate
88*7c478bd9Sstevel@tonic-gatetrap "" 15
89*7c478bd9Sstevel@tonic-gate
90*7c478bd9Sstevel@tonic-gate[ -x /usr/lib/acct/closewtmp ] && /usr/lib/acct/closewtmp
91*7c478bd9Sstevel@tonic-gate/sbin/sync; /sbin/sync; /sbin/sync
92