treewide: replace /sbin/sh hashbangs with /bin/sh
[unleashed.git] / usr / src / cmd / initpkg / rc3.sh
blobbe9ba62ac8e4d1d5e04a452d392d23358502b1d9
1 #!/bin/sh
3 # CDDL HEADER START
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
20 # CDDL HEADER END
23 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
24 # All rights reserved.
27 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
28 # Use is subject to license terms.
30 # ident "%Z%%M% %I% %E% SMI"
32 # Run Commands executed when the system is changing to init state 3,
33 # same as state 2 (multi-user) but with remote file sharing.
35 PATH=/usr/sbin:/usr/bin
37 if [ -z "$SMF_RESTARTER" ]; then
38 echo "This script cannot be run outside smf(5)."
39 exit 1
42 . /lib/svc/share/smf_include.sh
44 # Export boot parameters to rc scripts
46 set -- `/usr/bin/who -r`
48 _INIT_RUN_LEVEL="$7" # Current run-level
49 _INIT_RUN_NPREV="$8" # Number of times previously at current run-level
50 _INIT_PREV_LEVEL="$9" # Previous run-level
52 set -- `/usr/bin/uname -a`
54 _INIT_UTS_SYSNAME="$1" # Operating system name (uname -s)
55 _INIT_UTS_NODENAME="$2" # Node name (uname -n)
56 _INIT_UTS_RELEASE="$3" # Operating system release (uname -r)
57 _INIT_UTS_VERSION="$4" # Operating system version (uname -v)
58 _INIT_UTS_MACHINE="$5" # Machine class (uname -m)
59 _INIT_UTS_ISA="$6" # Instruction set architecture (uname -p)
60 _INIT_UTS_PLATFORM="$7" # Platform string (uname -i)
62 export _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
63 _INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
64 _INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
67 # Set _INIT_NET_STRATEGY and _INIT_NET_IF variables from /sbin/netstrategy
69 smf_netstrategy
72 if [ -d /etc/rc3.d ]; then
73 for f in /etc/rc3.d/K*; do
74 if [ -s $f ]; then
75 case $f in
76 *.sh) /lib/svc/bin/lsvcrun -s $f stop ;;
77 *) /lib/svc/bin/lsvcrun $f stop ;;
78 esac
80 done
82 for f in /etc/rc3.d/S*; do
83 if [ -s $f ]; then
84 case $f in
85 *.sh) /lib/svc/bin/lsvcrun -s $f start ;;
86 *) /lib/svc/bin/lsvcrun $f start ;;
87 esac
89 done
92 if smf_is_globalzone; then
93 # Unload all the loadable modules brought in during boot
94 # Delay a few seconds to allow dtlogin to open console first.
96 (sleep 5; modunload -i 0) & >/dev/null 2>&1