Unleashed v1.4
[unleashed.git] / usr / src / cmd / initpkg / rc0.sh
blob3a1a6fa7b1431a889fb89511143b9894d064398d
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 2009 Sun Microsystems, Inc. All rights reserved.
28 # Use is subject to license terms.
31 # "Run Commands" for init states 0, 5 and 6.
33 PATH=/usr/sbin:/usr/bin
35 if [ -z "$SMF_RESTARTER" ]; then
36 echo "Cannot be run outside smf(5)"
37 exit 1
40 # Export boot parameters to rc scripts
42 set -- `/usr/bin/who -r`
44 _INIT_RUN_LEVEL="$7" # Current run-level
45 _INIT_RUN_NPREV="$8" # Number of times previously at current run-level
46 _INIT_PREV_LEVEL="$9" # Previous run-level
48 set -- `/usr/bin/uname -a`
50 _INIT_UTS_SYSNAME="$1" # Operating system name (uname -s)
51 _INIT_UTS_NODENAME="$2" # Node name (uname -n)
52 _INIT_UTS_RELEASE="$3" # Operating system release (uname -r)
53 _INIT_UTS_VERSION="$4" # Operating system version (uname -v)
54 _INIT_UTS_MACHINE="$5" # Machine class (uname -m)
55 _INIT_UTS_ISA="$6" # Instruction set architecture (uname -p)
56 _INIT_UTS_PLATFORM="$7" # Platform string (uname -i)
58 export _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
59 _INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
60 _INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
62 if [ -d /etc/rc0.d ]; then
63 for f in /etc/rc0.d/K*; do
64 if [ -s $f ]; then
65 case $f in
66 *.sh) /lib/svc/bin/lsvcrun -s $f stop;;
67 *) /lib/svc/bin/lsvcrun $f stop;;
68 esac
70 done
72 # System cleanup functions ONLY (things that end fast!)
74 for f in /etc/rc0.d/S*; do
75 if [ -s $f ]; then
76 case $f in
77 *.sh) /lib/svc/bin/lsvcrun -s $f start;;
78 *) /lib/svc/bin/lsvcrun $f start ;;
79 esac
81 done
84 [ -f /etc/.dynamic_routing ] && /usr/bin/rm -f /etc/.dynamic_routing
86 trap "" 15