xref: /onnv-gate/usr/src/cmd/initpkg/rc2.sh (revision 2621:4ea88858d952)
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
61573Sdp# Common Development and Distribution License (the "License").
71573Sdp# 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#
271573Sdp# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
280Sstevel@tonic-gate# Use is subject to license terms.
290Sstevel@tonic-gate#
300Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate
320Sstevel@tonic-gate# Run Commands executed when the system is changing to init state 2,
330Sstevel@tonic-gate# traditionally called "multi-user". Pick up start-up packages for mounts,
340Sstevel@tonic-gate# daemons, services, etc.
350Sstevel@tonic-gate
360Sstevel@tonic-gatePATH=/usr/sbin:/usr/bin
370Sstevel@tonic-gate
380Sstevel@tonic-gateif [ -z "$SMF_RESTARTER" ]; then
390Sstevel@tonic-gate	echo "Cannot be run outside smf(5)"
400Sstevel@tonic-gate	exit 1
410Sstevel@tonic-gatefi
420Sstevel@tonic-gate
431573Sdp. /lib/svc/share/smf_include.sh
441573Sdp
450Sstevel@tonic-gateaction=$1
460Sstevel@tonic-gate
470Sstevel@tonic-gate# Export boot parameters to rc scripts
480Sstevel@tonic-gate
490Sstevel@tonic-gateset -- `/usr/bin/who -r`
500Sstevel@tonic-gate
510Sstevel@tonic-gate_INIT_RUN_LEVEL="$7"	# Current run-level
520Sstevel@tonic-gate_INIT_RUN_NPREV="$8"	# Number of times previously at current run-level
530Sstevel@tonic-gate_INIT_PREV_LEVEL="$9"	# Previous run-level
540Sstevel@tonic-gate
550Sstevel@tonic-gateset -- `/usr/bin/uname -a`
560Sstevel@tonic-gate
570Sstevel@tonic-gate_INIT_UTS_SYSNAME="$1"	# Operating system name (uname -s)
580Sstevel@tonic-gate_INIT_UTS_NODENAME="$2"	# Node name (uname -n)
590Sstevel@tonic-gate_INIT_UTS_RELEASE="$3"	# Operating system release (uname -r)
600Sstevel@tonic-gate_INIT_UTS_VERSION="$4"	# Operating system version (uname -v)
610Sstevel@tonic-gate_INIT_UTS_MACHINE="$5"	# Machine class (uname -m)
620Sstevel@tonic-gate_INIT_UTS_ISA="$6"	# Instruction set architecture (uname -p)
630Sstevel@tonic-gate_INIT_UTS_PLATFORM="$7"	# Platform string (uname -i)
640Sstevel@tonic-gate
650Sstevel@tonic-gateexport _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
660Sstevel@tonic-gate    _INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
670Sstevel@tonic-gate    _INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
680Sstevel@tonic-gate
691573Sdp#
701573Sdp# Set _INIT_NET_STRATEGY and _INIT_NET_IF variables from /sbin/netstrategy
711573Sdp#
721573Sdpsmf_netstrategy
730Sstevel@tonic-gate
740Sstevel@tonic-gatecase $action in
750Sstevel@tonic-gate	stop)
760Sstevel@tonic-gate		if [ -d /etc/rc2.d ]; then
770Sstevel@tonic-gate			for f in /etc/rc2.d/K*; do
780Sstevel@tonic-gate				if [ ! -s $f ]; then
790Sstevel@tonic-gate					continue
800Sstevel@tonic-gate				fi
810Sstevel@tonic-gate
820Sstevel@tonic-gate				case $f in
830Sstevel@tonic-gate					*.sh)	/lib/svc/bin/lsvcrun -s $f \
840Sstevel@tonic-gate							stop ;;
850Sstevel@tonic-gate					*)	/lib/svc/bin/lsvcrun $f stop ;;
860Sstevel@tonic-gate				esac
870Sstevel@tonic-gate			done
880Sstevel@tonic-gate		fi
890Sstevel@tonic-gate		;;
900Sstevel@tonic-gate
910Sstevel@tonic-gate	start)
920Sstevel@tonic-gate		for f in /etc/rc2.d/S*; do
930Sstevel@tonic-gate			if [ -s $f ]; then
940Sstevel@tonic-gate				case $f in
950Sstevel@tonic-gate					*.sh)	/lib/svc/bin/lsvcrun -s $f \
960Sstevel@tonic-gate							start ;;
970Sstevel@tonic-gate					*)	/lib/svc/bin/lsvcrun $f start ;;
980Sstevel@tonic-gate				esac
990Sstevel@tonic-gate			fi
1000Sstevel@tonic-gate		done
1010Sstevel@tonic-gate		;;
1020Sstevel@tonic-gate
1030Sstevel@tonic-gate	*)
1040Sstevel@tonic-gate		echo "Invalid argument"
1050Sstevel@tonic-gate		exit 1
1060Sstevel@tonic-gateesac
1070Sstevel@tonic-gate
108*2621Sllai1if smf_is_globalzone; then
109*2621Sllai1	# enable full implicit device reconfig
110*2621Sllai1	/usr/sbin/devfsadm -S
111*2621Sllai1fi
112*2621Sllai1
1130Sstevel@tonic-gateexit 0
114