xref: /titanic_50/usr/src/cmd/initpkg/rc3.sh (revision 6927f468b0af7710df000f6b16f6ee413e1e3007)
17c478bd9Sstevel@tonic-gate#!/sbin/sh
27c478bd9Sstevel@tonic-gate#
37c478bd9Sstevel@tonic-gate# CDDL HEADER START
47c478bd9Sstevel@tonic-gate#
57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*6927f468Sdp# Common Development and Distribution License (the "License").
7*6927f468Sdp# You may not use this file except in compliance with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
227c478bd9Sstevel@tonic-gate#
237c478bd9Sstevel@tonic-gate# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
247c478bd9Sstevel@tonic-gate# All rights reserved.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate#
27*6927f468Sdp# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
287c478bd9Sstevel@tonic-gate# Use is subject to license terms.
297c478bd9Sstevel@tonic-gate#
307c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gate# Run Commands executed when the system is changing to init state 3,
337c478bd9Sstevel@tonic-gate# same as state 2 (multi-user) but with remote file sharing.
347c478bd9Sstevel@tonic-gate
357c478bd9Sstevel@tonic-gatePATH=/usr/sbin:/usr/bin
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gateif [ -z "$SMF_RESTARTER" ]; then
387c478bd9Sstevel@tonic-gate	echo "This script cannot be run outside smf(5)."
397c478bd9Sstevel@tonic-gate	exit 1
407c478bd9Sstevel@tonic-gatefi
417c478bd9Sstevel@tonic-gate
42*6927f468Sdp. /lib/svc/share/smf_include.sh
43*6927f468Sdp
447c478bd9Sstevel@tonic-gate# Export boot parameters to rc scripts
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gateset -- `/usr/bin/who -r`
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gate_INIT_RUN_LEVEL="$7"	# Current run-level
497c478bd9Sstevel@tonic-gate_INIT_RUN_NPREV="$8"	# Number of times previously at current run-level
507c478bd9Sstevel@tonic-gate_INIT_PREV_LEVEL="$9"	# Previous run-level
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gateset -- `/usr/bin/uname -a`
537c478bd9Sstevel@tonic-gate
547c478bd9Sstevel@tonic-gate_INIT_UTS_SYSNAME="$1"  # Operating system name (uname -s)
557c478bd9Sstevel@tonic-gate_INIT_UTS_NODENAME="$2" # Node name (uname -n)
567c478bd9Sstevel@tonic-gate_INIT_UTS_RELEASE="$3"  # Operating system release (uname -r)
577c478bd9Sstevel@tonic-gate_INIT_UTS_VERSION="$4"  # Operating system version (uname -v)
587c478bd9Sstevel@tonic-gate_INIT_UTS_MACHINE="$5"  # Machine class (uname -m)
597c478bd9Sstevel@tonic-gate_INIT_UTS_ISA="$6"      # Instruction set architecture (uname -p)
607c478bd9Sstevel@tonic-gate_INIT_UTS_PLATFORM="$7" # Platform string (uname -i)
617c478bd9Sstevel@tonic-gate
627c478bd9Sstevel@tonic-gateexport _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
637c478bd9Sstevel@tonic-gate    _INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
647c478bd9Sstevel@tonic-gate    _INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
657c478bd9Sstevel@tonic-gate
66*6927f468Sdp#
67*6927f468Sdp# Set _INIT_NET_STRATEGY and _INIT_NET_IF variables from /sbin/netstrategy
68*6927f468Sdp#
69*6927f468Sdpsmf_netstrategy
707c478bd9Sstevel@tonic-gate
717c478bd9Sstevel@tonic-gate
727c478bd9Sstevel@tonic-gateif [ -d /etc/rc3.d ]; then
737c478bd9Sstevel@tonic-gate	for f in /etc/rc3.d/K*; do
747c478bd9Sstevel@tonic-gate		if [ -s $f ]; then
757c478bd9Sstevel@tonic-gate			case $f in
767c478bd9Sstevel@tonic-gate				*.sh)	/lib/svc/bin/lsvcrun -s $f stop ;;
777c478bd9Sstevel@tonic-gate				*)	/lib/svc/bin/lsvcrun $f stop ;;
787c478bd9Sstevel@tonic-gate			esac
797c478bd9Sstevel@tonic-gate		fi
807c478bd9Sstevel@tonic-gate	done
817c478bd9Sstevel@tonic-gate
827c478bd9Sstevel@tonic-gate	for f in /etc/rc3.d/S*; do
837c478bd9Sstevel@tonic-gate		if [ -s $f ]; then
847c478bd9Sstevel@tonic-gate			case $f in
857c478bd9Sstevel@tonic-gate				*.sh)	/lib/svc/bin/lsvcrun -s $f start ;;
867c478bd9Sstevel@tonic-gate				*)	/lib/svc/bin/lsvcrun $f start ;;
877c478bd9Sstevel@tonic-gate			esac
887c478bd9Sstevel@tonic-gate		fi
897c478bd9Sstevel@tonic-gate	done
907c478bd9Sstevel@tonic-gatefi
917c478bd9Sstevel@tonic-gate
92*6927f468Sdpif smf_is_globalzone; then
937c478bd9Sstevel@tonic-gate	# Unload all the loadable modules brought in during boot
947c478bd9Sstevel@tonic-gate	# Delay a few seconds to allow dtlogin to open console first.
957c478bd9Sstevel@tonic-gate
967c478bd9Sstevel@tonic-gate	(sleep 5; modunload -i 0) & >/dev/null 2>&1
977c478bd9Sstevel@tonic-gatefi
98