summaryrefslogtreecommitdiff
path: root/usr/src/cmd/initpkg
diff options
context:
space:
mode:
authorstevel@tonic-gate <none@none>2005-06-14 00:00:00 -0700
committerstevel@tonic-gate <none@none>2005-06-14 00:00:00 -0700
commit7c478bd95313f5f23a4c958a745db2134aa03244 (patch)
treec871e58545497667cbb4b0a4f2daf204743e1fe7 /usr/src/cmd/initpkg
downloadillumos-joyent-7c478bd95313f5f23a4c958a745db2134aa03244.tar.gz
OpenSolaris Launch
Diffstat (limited to 'usr/src/cmd/initpkg')
-rw-r--r--usr/src/cmd/initpkg/Makefile120
-rw-r--r--usr/src/cmd/initpkg/bootrc114
-rw-r--r--usr/src/cmd/initpkg/dfstab.sh50
-rw-r--r--usr/src/cmd/initpkg/init.d/Makefile114
-rw-r--r--usr/src/cmd/initpkg/init.d/README83
-rw-r--r--usr/src/cmd/initpkg/init.d/README.rc259
-rw-r--r--usr/src/cmd/initpkg/init.d/README.rc350
-rw-r--r--usr/src/cmd/initpkg/init.d/README.rcS73
-rw-r--r--usr/src/cmd/initpkg/init.d/acctadm47
-rw-r--r--usr/src/cmd/initpkg/init.d/boot.server52
-rw-r--r--usr/src/cmd/initpkg/init.d/cachefs.daemon70
-rw-r--r--usr/src/cmd/initpkg/init.d/deallocate56
-rw-r--r--usr/src/cmd/initpkg/init.d/devlinks58
-rw-r--r--usr/src/cmd/initpkg/init.d/dhcp55
-rw-r--r--usr/src/cmd/initpkg/init.d/drvconfig36
-rw-r--r--usr/src/cmd/initpkg/init.d/init.dmi73
-rw-r--r--usr/src/cmd/initpkg/init.d/init.snmpdx58
-rw-r--r--usr/src/cmd/initpkg/init.d/ldap.client50
-rw-r--r--usr/src/cmd/initpkg/init.d/mkdtab39
-rw-r--r--usr/src/cmd/initpkg/init.d/nfs.server45
-rw-r--r--usr/src/cmd/initpkg/init.d/nscd48
-rw-r--r--usr/src/cmd/initpkg/init.d/pcmcia46
-rw-r--r--usr/src/cmd/initpkg/init.d/sendmail52
-rw-r--r--usr/src/cmd/initpkg/init.d/slpd47
-rw-r--r--usr/src/cmd/initpkg/init.d/sysetup96
-rw-r--r--usr/src/cmd/initpkg/init.d/uucp36
-rw-r--r--usr/src/cmd/initpkg/init.d/volmgt48
-rw-r--r--usr/src/cmd/initpkg/inittab43
-rw-r--r--usr/src/cmd/initpkg/mountall.sh389
-rw-r--r--usr/src/cmd/initpkg/nscd.conf86
-rw-r--r--usr/src/cmd/initpkg/rc0.d/mk.rc0.d.sh58
-rw-r--r--usr/src/cmd/initpkg/rc0.sh91
-rw-r--r--usr/src/cmd/initpkg/rc1.d/mk.rc1.d.sh58
-rw-r--r--usr/src/cmd/initpkg/rc1.sh116
-rw-r--r--usr/src/cmd/initpkg/rc2.d/mk.rc2.d.sh71
-rw-r--r--usr/src/cmd/initpkg/rc2.sh120
-rw-r--r--usr/src/cmd/initpkg/rc3.d/mk.rc3.d.sh57
-rw-r--r--usr/src/cmd/initpkg/rc3.sh108
-rw-r--r--usr/src/cmd/initpkg/rcS.d/mk.rcS.d.sh67
-rw-r--r--usr/src/cmd/initpkg/rcS.sh224
-rw-r--r--usr/src/cmd/initpkg/security/crypt.conf32
-rw-r--r--usr/src/cmd/initpkg/shutdown.sh238
-rw-r--r--usr/src/cmd/initpkg/swapadd.sh146
-rw-r--r--usr/src/cmd/initpkg/umountall.sh331
-rw-r--r--usr/src/cmd/initpkg/vfstab.sh43
45 files changed, 3953 insertions, 0 deletions
diff --git a/usr/src/cmd/initpkg/Makefile b/usr/src/cmd/initpkg/Makefile
new file mode 100644
index 0000000000..f8a685681c
--- /dev/null
+++ b/usr/src/cmd/initpkg/Makefile
@@ -0,0 +1,120 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+#
+
+SHFILES= dfstab vfstab
+CPFILES= rcS rc0 rc1 rc2 rc3 mountall shutdown swapadd umountall
+ALL= $(SHFILES) $(CPFILES)
+TXTS= rcS.d/mk.rcS.d.sh rc0.d/mk.rc0.d.sh \
+ rc1.d/mk.rc1.d.sh rc2.d/mk.rc2.d.sh rc3.d/mk.rc3.d.sh
+CLOBBERFILES= $(ALL)
+SUBDIRS= rcS.d rc0.d rc1.d rc2.d rc3.d
+
+include ../Makefile.cmd
+
+ETCINITD= $(ROOTETC)/init.d
+ETCDFSD= $(ROOTETC)/dfs
+DIRS= $(ETCINITD) $(ETCDFSD) $(ROOTETC)/security
+
+SBINF= rcS mountall rc0 rc1 rc2 rc3 swapadd umountall
+SBINL= rc5 rc6
+USRSBINF= mountall shutdown umountall
+
+sparc_ETCTABS=
+i386_ETCTABS= bootrc
+ETCTABS= vfstab inittab nscd.conf security/crypt.conf $($(MACH)_ETCTABS)
+
+DFSTAB= dfstab
+SBINETC= rcS mountall rc0 rc1 rc2 rc3 rc5 rc6 swapadd umountall
+USRSBINETC= shutdown
+
+OWNER= root
+GROUP= sys
+FILEMODE= 0744
+
+ROOTSBINF= $(SBINF:%=$(ROOTSBIN)/%)
+ROOTSBINL= $(SBINL:%=$(ROOTSBIN)/%)
+ROOTUSRSBINF= $(USRSBINF:%=$(ROOTUSRSBIN)/%)
+ROOTETCTABS= $(ETCTABS:%=$(ROOTETC)/%)
+ROOTDFSTAB= $(DFSTAB:%=$(ETCDFSD)/%)
+SYMSBINF= $(SBINETC:%=$(ROOTETC)/%)
+SYMUSRSBINF= $(USRSBINETC:%=$(ROOTETC)/%)
+
+$(ROOTETC)/inittab := FILEMODE = 0644
+$(ROOTETC)/vfstab := FILEMODE = 0644
+$(ROOTETC)/nscd.conf := FILEMODE = 0644
+$(ROOTETC)/security/crypt.conf := FILEMODE = 0644
+$(ROOTETC)/bootrc := FILEMODE = 0755
+$(ROOTDFSTAB) := FILEMODE = 0644
+$(ROOTSBIN)/mountall := FILEMODE = 0555
+$(ROOTUSRSBIN)/mountall := FILEMODE = 0555
+$(ROOTSBIN)/umountall := FILEMODE = 0555
+$(ROOTUSRSBIN)/umountall := FILEMODE = 0555
+$(ROOTUSRSBIN)/shutdown := FILEMODE = 0755
+
+$(ETCDFSD)/% : %
+ $(INS.file)
+
+.KEEP_STATE:
+
+all: $(ALL) all_init.d $(TXTS)
+
+$(SYMSBINF):
+ $(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
+
+$(SYMUSRSBINF):
+ $(RM) $@; $(SYMLINK) ../usr/sbin/$(@F) $@
+
+$(ROOTSBINL): $(ROOTSBIN)/rc0
+ $(RM) $@; $(LN) $(ROOTSBIN)/rc0 $@
+
+all_init.d: FRC
+ @cd init.d; pwd; $(MAKE) $(MFLAGS) all
+
+ins_init.d: FRC
+ @cd init.d; pwd; $(MAKE) $(MFLAGS) install
+
+$(SHFILES):
+ sh $@.sh $(ROOT)
+
+install: $(ALL) ins_all ins_init.d $(SUBDIRS)
+
+ins_all : $(ROOTSBINF) $(ROOTSBINL) $(ROOTUSRSBINF) $(ROOTETCTABS) \
+ $(ROOTDFSTAB) $(SYMSBINF) $(SYMUSRSBINF)
+
+# Don't re-install directories already installed by Targetdirs
+#$(DIRS):
+# $(INS.dir)
+
+$(SUBDIRS): FRC
+ @cd $@; pwd; ROOT=$(ROOT) CH=$(CH) sh mk.$@.sh
+
+FRC:
+
+clean lint:
+
+include ../Makefile.targ
diff --git a/usr/src/cmd/initpkg/bootrc b/usr/src/cmd/initpkg/bootrc
new file mode 100644
index 0000000000..9ddeb3e911
--- /dev/null
+++ b/usr/src/cmd/initpkg/bootrc
@@ -0,0 +1,114 @@
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# initial properties, set during installation
+# NOTICE: bootpath and boot-args should be set by this point.
+#================================================================
+getprop bootpath bp
+getprop boot-args bootargs
+if .streq ( "${bootargs}"X , kernel/unixX )
+ set bootargs
+endif
+
+set ba0 bogus_response
+set cmd_err 0
+
+# display current defaults
+echo " <<< Current Boot Parameters >>>
+Boot path: ${bp}
+Boot args: ${bootargs}"
+
+#comment out following line if auto booting is not desired
+set boot_timeout 5
+
+# display initial boot prompt
+echo '
+Type b [file-name] [boot-flags] <ENTER> to boot with options
+or i <ENTER> to enter boot interpreter
+or <ENTER> to boot with defaults'
+
+if ! .streq ( ${boot_timeout}X , X )
+ echo "
+ <<< timeout in ${boot_timeout} seconds >>>"
+endif
+
+echo -n '
+Select (b)oot or (i)nterpreter: '
+
+# read response to boot prompt
+if .streq ( ${boot_timeout}X , X )
+ read ba0 ba1 ba2 ba3 ba4 ba5 ba6 ba7 ba8
+else
+ readt ${boot_timeout} ba0 ba1 ba2 ba3 ba4 ba5 ba6 ba7 ba8
+endif
+
+# process response to boot prompt
+# i command
+if .streq ( ${ba0}X , iX )
+ echo 'Entering boot interpreter - type ctrl-d to resume boot'
+ console
+ if .streq ( ${bootfile}X , X ) # if bootfile not set
+ set bootfile $def_bootfile # set to default
+ endif
+
+# b command
+elseif .streq ( ${ba0}X , bX ) || .streq ( ${ba0}X , bootX )
+ if .strneq ( ${ba1}X , \\- , 1 ) # if first arg is a flag
+ # save it in bootargs
+ set bootargs "$ba1 $ba2 $ba3 $ba4 $ba5 $ba6 $ba7 $ba8"
+ set bootfile $def_bootfile # set default boot file
+ elseif ! .streq ( ${ba1}X , X ) # else if first arg is present
+ set bootfile $ba1 # set bootfile to it
+ set bootargs "$ba2 $ba3 $ba4 $ba5 $ba6 $ba7 $ba8"
+ else # else
+ set bootfile $def_bootfile # set default boot file
+ endif
+ setprop boot-args "$bootargs"
+
+# anything else
+else # no command
+ if ! .streq ( ${ba0}X , X )
+ echo "invalid response: \"${ba0}\""
+ set cmd_err 1 # user entered invalid response
+ endif
+ if .streq ( ${bootfile}X , X ) # if bootfile not set
+ set bootfile $def_bootfile # set to default
+ endif
+endif
+
+# other stuff
+
+setprop whoami $bootfile
+
+# 'b', 'i', or <ENTER> are the only valid responses
+if ( ${cmd_err} == 1 )
+ source /etc/bootrc
+else
+ run $bootfile
+ echo "could not run ${bootfile}"
+ set bootfile
+ source /etc/bootrc
+endif
diff --git a/usr/src/cmd/initpkg/dfstab.sh b/usr/src/cmd/initpkg/dfstab.sh
new file mode 100644
index 0000000000..2c93f5eef8
--- /dev/null
+++ b/usr/src/cmd/initpkg/dfstab.sh
@@ -0,0 +1,50 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
+# All Rights Reserved
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1.2.1 */
+case "$MACH" in
+ "u3b2"|"sparc"|"i386"|"ppc" )
+ echo "
+# Place share(1M) commands here for automatic execution
+# on entering init state 3.
+#
+# Issue the command 'svcadm enable network/nfs/server' to
+# run the NFS daemon processes and the share commands, after adding
+# the very first entry to this file.
+#
+# share [-F fstype] [ -o options] [-d \"<text>\"] <pathname> [resource]
+# .e.g,
+# share -F nfs -o rw=engineering -d \"home dirs\" /export/home2
+" >dfstab
+ ;;
+ * )
+ echo "Unknown architecture."
+ exit 1
+ ;;
+esac
diff --git a/usr/src/cmd/initpkg/init.d/Makefile b/usr/src/cmd/initpkg/init.d/Makefile
new file mode 100644
index 0000000000..0d7415a4f4
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/Makefile
@@ -0,0 +1,114 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../../Makefile.cmd
+
+sparc_PROG=
+i386_PROG=
+
+PROG= \
+ README \
+ acctadm \
+ boot.server \
+ cachefs.daemon \
+ deallocate \
+ devlinks \
+ dhcp \
+ drvconfig \
+ init.dmi \
+ init.snmpdx \
+ ldap.client \
+ mkdtab \
+ nfs.server \
+ nscd \
+ pcmcia \
+ sendmail \
+ slpd \
+ sysetup \
+ uucp \
+ volmgt \
+ $($(MACH)_PROG)
+
+
+OTHERPROG= README.rcS README.rc2 README.rc3
+
+ROOTETCINITD= $(ROOTETC)/init.d
+ROOTETCRCSD= $(ROOTETC)/rcS.d
+ROOTETCRC0D= $(ROOTETC)/rc0.d
+ROOTETCRC1D= $(ROOTETC)/rc1.d
+ROOTETCRC2D= $(ROOTETC)/rc2.d
+ROOTETCRC3D= $(ROOTETC)/rc3.d
+
+DIRS= $(ROOTETCINITD) \
+ $(ROOTETCRCSD) \
+ $(ROOTETCRC0D) \
+ $(ROOTETCRC1D) \
+ $(ROOTETCRC2D) \
+ $(ROOTETCRC3D)
+
+ROOTETCINITDPROG= $(PROG:%=$(ROOTETCINITD)/%)
+
+DIRMODE = 0755
+FILEMODE = 0744
+$(ROOTETCINITD)/README := FILEMODE = 0644
+$(ROOTETCRCSD)/README := FILEMODE = 0644
+$(ROOTETCRC2D)/README := FILEMODE = 0644
+$(ROOTETCRC3D)/README := FILEMODE = 0644
+OWNER = root
+GROUP = sys
+
+.KEEP_STATE:
+
+all: $(PROG)
+
+# Don't re-install directories already installed by Targetdirs
+#$(DIRS):
+# $(INS.dir)
+
+$(ROOTETCINITD)/%: %
+ $(INS.file)
+
+$(ROOTETCRCSD)/%: %.rcS
+ $(INS.rename)
+
+$(ROOTETCRC2D)/%: %.rc2
+ $(INS.rename)
+
+$(ROOTETCRC3D)/%: %.rc3
+ $(INS.rename)
+
+install: all $(ROOTETCINITDPROG) \
+ $(ROOTETCRCSD)/README \
+ $(ROOTETCRC2D)/README \
+ $(ROOTETCRC3D)/README
+
+lint:
+
+clean:
+
+clobber:
diff --git a/usr/src/cmd/initpkg/init.d/README b/usr/src/cmd/initpkg/init.d/README
new file mode 100644
index 0000000000..d70545ccc7
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/README
@@ -0,0 +1,83 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#ident "%Z%%M% %I% %E% SMI"
+Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+Use is subject to license terms.
+
+NOTE: This directory contains legacy initialization and termination
+scripts for managing services. The preferred method of service
+management is via the Service Management Facility; to read more about
+SMF, consult smf(5).
+
+File names in rc?.d directories are of the form [SK]nn<init.d filename>
+where 'S' means start this job, 'K' means kill this job, and 'nn' is the
+relative sequence number for killing or starting the job. When
+executing each script in one of the /etc/rc[S0-6] directories, the
+/sbin/rc[S0-6] script passes a single argument. It passes the argument
+'stop' for scripts prefixed with 'K' and the argument 'start' for
+scripts prefixed with 'S'. There is no harm in applying the same
+sequence number to multiple scripts. In this case the order of
+execution is deterministic but unspecified. It is recommended that
+scripts be hard-linked from the same file stored in /etc/init.d/.
+
+On earlier Solaris releases, a script named with a suffix of '.sh' would
+be sourced, allowing scripts to modify the environment of other scripts
+executed later. This behavior is no longer supported; for altering the
+environment in which services are run, refer to the SMF documentation.
+
+Legacy services are reported by the default svcs(1m) output, and (where
+appropriate) the utility's '-p' option. This reporting assumes a
+behavior as described above, such that each 'S' script has a suitable
+matching 'K' script, and they are both hard linked to a script in
+/etc/init.d/. If this is not the case, legacy service reporting may not
+operate accurately; under all circumstances, the scripts are always
+executed as described above.
+
+The run-levels operate as follows:
+
+s/S
+
+ Read /etc/rcS.d/README for details. This run-level corresponds to
+ the milestone svc:/milestone/single-user:default.
+
+0/5/6
+
+ All /etc/rc0.d/K* scripts are run, followed by all /etc/rc0.d/S*
+ scripts. The S* scripts should only be used for cleanup during
+ shutdown.
+
+1
+
+ If the system was in a higher run-level, all /etc/rc1.d/K* scripts
+ are run. Regardless of the previous run-level, all /etc/rc1.d/S*
+ scripts are run.
+
+2
+
+ Read /etc/rc2.d/README for details. This run-level corresponds to
+ the milestone svc:/milestone/multi-user:default.
+
+3
+
+ Read /etc/rc3.d/README for details. This run-level corresponds to
+ the milestone svc:/milestone/multi-user-server:default.
+
diff --git a/usr/src/cmd/initpkg/init.d/README.rc2 b/usr/src/cmd/initpkg/init.d/README.rc2
new file mode 100644
index 0000000000..d5267e5ca4
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/README.rc2
@@ -0,0 +1,59 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#ident "%Z%%M% %I% %E% SMI"
+Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+Use is subject to license terms.
+
+NOTE: This directory contains legacy initialization and termination
+scripts for managing services. The preferred method of service
+management is via the Service Management Facility; to read more about
+SMF, consult smf(5).
+
+For a general discussion of the mechanism used to invoke these scripts
+see the file /etc/init.d/README.
+
+After all its dependencies have been satisfied, the start method of the
+SMF major milestone "svc:/milestone/multi-user:default" executes each
+'S' script within /etc/rc2.d/ with the argument 'start'. All start
+scripts in the directory /etc/rcS.d/ will have been run as part of the
+earlier single user milestone. Any warnings, errors, or output from the
+scripts in /etc/rc2.d/ are logged to the file:
+
+/var/svc/log/milestone-multi-user:default.log
+
+If the system is changing from a higher run-level (for example, through
+an invocation of "init 2"), SMF executes all 'K' scripts within
+/etc/rc2.d/ with the argument 'stop'. Any warnings, errors, or output
+from these scripts are logged to the file:
+
+/var/svc/log/rc2.log
+
+Scripts in /etc/rc2.d/ may assume the following:
+
+ Temporary directories have been cleaned as appropriate.
+
+ The system is a fully configured NFS client, and all NFS
+ file systems are mounted. The name service, if any, is running.
+ The system logger is running. Cron is running.
+
+For a full list of services brought online before scripts are run, see
+the output of "svcs -l svc:/milestone/multi-user:default".
diff --git a/usr/src/cmd/initpkg/init.d/README.rc3 b/usr/src/cmd/initpkg/init.d/README.rc3
new file mode 100644
index 0000000000..cb3f9a1377
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/README.rc3
@@ -0,0 +1,50 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#ident "%Z%%M% %I% %E% SMI"
+Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+Use is subject to license terms.
+
+NOTE: This directory contains legacy initialization and termination
+scripts for managing services. The preferred method of service
+management is via the Service Management Facility; to read more about
+SMF, consult smf(5).
+
+For a general discussion of the mechanism used to invoke these scripts
+see the file /etc/init.d/README.
+
+When moving to run-level 3, via an "init 3" invocation or the SMF major
+milestone "svc:/milestone/multi-user-server:default", /sbin/rc3 executes
+each 'K' script within /etc/rc3.d/ with the argument 'stop', followed by
+each 'S' script within /etc/rc3.d/ with the argument 'start'. All
+start scripts in the directories /etc/rcS.d/ and /etc/rc2.d/ will have
+been run as part of the earlier major milestones. Any warnings, errors,
+or output from the scripts in /etc/rc3.d/ are logged to the file:
+
+/var/svc/log/milestone-multi-user-server:default.log
+
+Scripts in /etc/rc3.d/ may assume the following:
+
+ The NFS server, if enabled, is running and shared NFS filesystems
+ are exported.
+
+For a full list of services brought online before scripts are run, see
+the output of "svcs -l svc:/milestone/multi-user-server:default".
diff --git a/usr/src/cmd/initpkg/init.d/README.rcS b/usr/src/cmd/initpkg/init.d/README.rcS
new file mode 100644
index 0000000000..f2e151645c
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/README.rcS
@@ -0,0 +1,73 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#ident "%Z%%M% %I% %E% SMI"
+Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+Use is subject to license terms.
+
+NOTE: This directory contains legacy initialization and termination
+scripts for managing services. The preferred method of service
+management is via the Service Management Facility; to read more about
+SMF, consult smf(5).
+
+For a general discussion of the mechanism used to invoke these scripts
+see the file /etc/init.d/README.
+
+After all its dependencies have been satisfied, the start method of the
+SMF major milestone "svc:/milestone/single-user:default" executes each
+'S' script within /etc/rcS.d/ with the argument 'start'. Any warnings,
+errors, or output from these scripts are logged to the file:
+
+/var/svc/log/milestone-single-user:default.log
+
+If the system is changing from a higher run-level (for example, through
+an invocation of "init S"), SMF executes all 'K' scripts within
+/etc/rcS.d/ with the argument 'stop'. Any warnings, errors, or output
+from these scripts are logged to the file:
+
+/var/svc/log/rcS.log
+
+Scripts in /etc/rcS.d/ may assume the following:
+
+ Enough network plumbing has been done to NFS mount /usr/.
+
+ All system-supplied device file names have been established.
+
+ The environment variable _INIT_RECONFIG is set if this is
+ a reconfiguration boot.
+
+ The base system mounts have been performed, and the file
+ systems are read/write if so specified. These are:
+
+ /
+ /usr
+ /proc
+ /dev/fd
+ /tmp
+ /var
+ /var/adm
+ /var/run
+ /dev
+ /devices
+ /etc
+
+For a full list of services brought online before scripts are run, see
+the output of "svcs -l svc:/milestone/single-user:default".
diff --git a/usr/src/cmd/initpkg/init.d/acctadm b/usr/src/cmd/initpkg/init.d/acctadm
new file mode 100644
index 0000000000..6b192861cb
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/acctadm
@@ -0,0 +1,47 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 1999-2000 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#ident "%Z%%M% %I% %E% SMI"
+#
+# Restore the extended accounting configuration that was in effect before
+# reboot.
+#
+
+case "$1" in
+start)
+ [ -x /usr/sbin/acctadm -a -f /etc/acctadm.conf ] || exit 0
+ /usr/sbin/acctadm -u
+ ;;
+
+stop)
+ ;;
+
+*)
+ echo "Usage: $0 { start | stop }"
+ exit 1
+ ;;
+esac
+exit 0
diff --git a/usr/src/cmd/initpkg/init.d/boot.server b/usr/src/cmd/initpkg/init.d/boot.server
new file mode 100644
index 0000000000..2ceaf3d17c
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/boot.server
@@ -0,0 +1,52 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+[ ! -d /usr/bin ] && exit
+
+# Start/stop processes required for boot server
+
+case "$1" in
+'start')
+
+ # If /rplboot exists become a boot server for x86 clients
+
+ if [ -d /rplboot ]; then
+ /usr/sbin/rpld -a
+ fi
+ ;;
+
+'stop')
+ /usr/bin/pkill -x -u 0 rpld
+
+ ;;
+*)
+ echo "Usage: $0 { start | stop }"
+ exit 1
+ ;;
+esac
+exit 0
diff --git a/usr/src/cmd/initpkg/init.d/cachefs.daemon b/usr/src/cmd/initpkg/init.d/cachefs.daemon
new file mode 100644
index 0000000000..d6e8734186
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/cachefs.daemon
@@ -0,0 +1,70 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+# If /usr is a cachefs file system then start up the
+# cachefsd for it and any other cachefs file system.
+
+if [ "x`/usr/lib/fs/cachefs/cfsfstype /usr/lib 2>/dev/null`" != xcachefs ]; then
+ exit 0
+fi
+
+rpcprogram=100235
+rpcvers=1
+cachefsd_fmri="network/rpc-${rpcprogram}_${rpcvers}/rpc_ticotsord:ticotsord"
+cachefsd=/usr/lib/fs/cachefs/cachefsd
+inetconf=/etc/inet/inetd.conf
+svcfound=no
+
+enabled=`/usr/bin/svcprop -p general/enabled $cachefsd_fmri 2>/dev/null`
+if [ $? != 0 ]; then
+ echo "WARNING: cachefs service not present" >& 2
+ exit 1
+fi
+if [ "$enabled" != "true" ]; then
+ echo "WARNING: cachefs service not enabled" >& 2
+ exit 1
+fi
+
+for i in 1 2 3 4 5; do
+ if /usr/bin/rpcinfo -l `/usr/bin/uname -n` $rpcprogram $rpcvers \
+ 2>/dev/null | /usr/bin/grep 100235 >/dev/null 2>&1; then
+ svcfound=yes
+ break
+ fi
+
+ sleep 1
+done
+
+if [ $svcfound = no ]; then
+ echo "WARNING: Timed out waiting for cachefs service to register" >&2
+fi
+
+/usr/lib/fs/cachefs/cfsadmin -C /dev/null 2>/dev/null
+
+/usr/lib/fs/cachefs/cachefspack /usr/lib/fs/cachefs \
+ /etc/netconfig /etc/vfstab /etc/inittab /etc/cachefstab
diff --git a/usr/src/cmd/initpkg/init.d/deallocate b/usr/src/cmd/initpkg/init.d/deallocate
new file mode 100644
index 0000000000..7ef8aeeb6d
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/deallocate
@@ -0,0 +1,56 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+# if the audit state is "disabled" auditconfig returns
+# non-zero exit status unless the c2audit module is loaded;
+# if c2audit is loaded, "disabled" becomes "noaudit" early
+# in the boot cycle and "auditing" only after auditd starts.
+# in both cases, "noaudit" and "auditing", a zero exit status
+# is returned
+
+AUDITCONFIG=/usr/sbin/auditconfig
+
+AUDITCOND=`$AUDITCONFIG -getcond 2> /dev/null`
+if [ $? -ne 0 ]; then
+ exit 0;
+fi
+
+case "$1" in
+'start')
+ /usr/sbin/deallocate -Is
+ ;;
+
+'stop')
+ ;;
+
+*)
+ echo "Usage: $0 { start | stop }"
+ exit 1
+ ;;
+esac
+exit 0
diff --git a/usr/src/cmd/initpkg/init.d/devlinks b/usr/src/cmd/initpkg/init.d/devlinks
new file mode 100644
index 0000000000..6794b2f6d3
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/devlinks
@@ -0,0 +1,58 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
+# All rights reserved.
+#
+#
+# Copyright (c) 1991-93, 1997 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+if [ -n "$_INIT_RECONFIG" ]; then
+ echo 'Configuring the /dev directory'
+
+ /usr/sbin/devlinks
+ /usr/sbin/disks
+ /usr/sbin/ports
+ /usr/sbin/tapes
+ /usr/sbin/audlinks
+
+ if [ -x /usr/ucb/ucblinks -a -f /usr/ucblib/ucblinks.awk ]; then
+ echo 'Configuring the /dev directory (compatibility devices)'
+ /usr/ucb/ucblinks >/dev/null 2>&1
+ fi
+fi
+
+# Establish the default framebuffer name.
+
+fbdev=`/usr/sbin/prtconf -F 2>/dev/null`
+
+if [ $? -eq 0 ]; then
+ set -- /devices$fbdev*
+ if [ -c $1 ]; then
+ rm -f /dev/fb
+ ln -s $1 /dev/fb
+ fi
+fi
diff --git a/usr/src/cmd/initpkg/init.d/dhcp b/usr/src/cmd/initpkg/init.d/dhcp
new file mode 100644
index 0000000000..808f0c7fdb
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/dhcp
@@ -0,0 +1,55 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+# This service is managed by smf(5). Thus, this script provides
+# compatibility with previously documented init.d script behaviour.
+
+FMRI=network/dhcp-server:default
+
+case "$1" in
+'start')
+ [ -x /usr/lib/inet/in.dhcpd ] && [ -f /etc/inet/dhcpsvc.conf ] && {
+ eval `grep '^DAEMON_ENABLED=' /etc/inet/dhcpsvc.conf`
+ GO=`echo ${DAEMON_ENABLED} | /usr/bin/cut -c1`
+ if [ "${GO}" = "t" -o "${GO}" = "T" ]; then
+ /usr/sbin/svcadm enable -t $FMRI
+ fi
+ }
+ ;;
+
+'stop')
+ /usr/sbin/svcadm disable -t $FMRI
+ ;;
+
+*)
+ echo "Usage: $0 { start | stop }"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/usr/src/cmd/initpkg/init.d/drvconfig b/usr/src/cmd/initpkg/init.d/drvconfig
new file mode 100644
index 0000000000..0f41b24c31
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/drvconfig
@@ -0,0 +1,36 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
+# All rights reserved.
+#
+#
+# Copyright (c) 1991-1997 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+if [ -n "$_INIT_RECONFIG" ]; then
+ echo 'Configuring the /devices directory'
+ /usr/sbin/drvconfig
+fi
diff --git a/usr/src/cmd/initpkg/init.d/init.dmi b/usr/src/cmd/initpkg/init.d/init.dmi
new file mode 100644
index 0000000000..32c0f4f177
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/init.dmi
@@ -0,0 +1,73 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+DMI_CONF=/etc/dmi/conf/dmispd.conf
+
+case "$1" in
+'start')
+ if [ -f ${DMI_CONF} -a -x /usr/lib/dmi/dmispd ]; then
+ if /usr/bin/egrep -v '^[ ]*(#|$)' ${DMI_CONF} > \
+ /dev/null 2>&1; then
+ /usr/lib/dmi/dmispd
+ else
+ #
+ # Do not start dmi if dmispd.conf contents are trivial.
+ #
+ exit 0
+ fi
+ fi
+
+ if [ -f /etc/dmi/conf/snmpXdmid.conf -a \
+ -x /usr/lib/dmi/snmpXdmid ]; then
+
+ if /usr/bin/pgrep -x -u 0 snmpdx >/dev/null 2>&1; then
+ [ -z "$_INIT_UTS_NODENAME" ] && \
+ _INIT_UTS_NODENAME=`/usr/bin/uname -n`
+ `/usr/lib/dmi/snmpXdmid -s $_INIT_UTS_NODENAME`
+ fi
+ fi
+
+ if [ -x /etc/dmi/ciagent/ciinvoke ]; then
+ dirents=`echo /etc/dmi/ciagent/*`
+ if [ "$dirents" != /etc/dmi/ciagent/ciinvoke ]; then
+ /etc/dmi/ciagent/ciinvoke
+ fi
+ fi
+ ;;
+
+'stop')
+ /usr/bin/pkill -9 -x -u 0 -z ${_INIT_ZONENAME:=`/sbin/zonename`} \
+ '(snmpXdmid|dmispd)'
+ ;;
+
+*)
+ echo "Usage: $0 { start | stop }"
+ exit 1
+ ;;
+esac
+exit 0
diff --git a/usr/src/cmd/initpkg/init.d/init.snmpdx b/usr/src/cmd/initpkg/init.d/init.snmpdx
new file mode 100644
index 0000000000..0e3bee28d7
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/init.snmpdx
@@ -0,0 +1,58 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+SNMP_RSRC=/etc/snmp/conf/snmpdx.rsrc
+
+case "$1" in
+'start')
+ if [ -f ${SNMP_RSRC} -a -x /usr/lib/snmp/snmpdx ]; then
+ if /usr/bin/egrep -v '^[ ]*(#|$)' ${SNMP_RSRC} > \
+ /dev/null 2>&1; then
+ /usr/lib/snmp/snmpdx -y -c /etc/snmp/conf
+ else
+ #
+ # Do not start snmpdx if snmpdx.rsrc contents are
+ # trivial.
+ #
+ exit 0
+ fi
+
+ fi
+ ;;
+
+'stop')
+ /usr/bin/pkill -9 -x -u 0 -z ${_INIT_ZONENAME:=`/sbin/zonename`} \
+ '(snmpdx|snmpv2d|mibiisa)'
+ ;;
+
+*)
+ echo "Usage: $0 { start | stop }"
+ exit 1
+ ;;
+esac
+exit 0
diff --git a/usr/src/cmd/initpkg/init.d/ldap.client b/usr/src/cmd/initpkg/init.d/ldap.client
new file mode 100644
index 0000000000..665e3b363f
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/ldap.client
@@ -0,0 +1,50 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+# This service is managed by smf(5). Thus, this script provides
+# compatibility with previously documented init.d script behaviour.
+
+FMRI=network/ldap/client:default
+
+case "$1" in
+'start')
+ [ -f /var/ldap/ldap_client_file ] && \
+ [ -f /usr/lib/ldap/ldap_cachemgr ] || exit 0
+
+ /usr/sbin/svcadm enable -t $FMRI
+ ;;
+
+'stop')
+ /usr/sbin/svcadm disable -t $FMRI
+ ;;
+
+*)
+ echo "Usage: $0 { start | stop }"
+ exit 1
+ ;;
+esac
diff --git a/usr/src/cmd/initpkg/init.d/mkdtab b/usr/src/cmd/initpkg/init.d/mkdtab
new file mode 100644
index 0000000000..2abb95a986
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/mkdtab
@@ -0,0 +1,39 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 1994-1997 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+#
+# Update device.tab and dgroup.tab files to reflect configuration.
+# Script runs once at installation time and then removes itself.
+#
+
+if [ -x /usr/sadm/sysadm/bin/mkdtab ]; then
+ /usr/sadm/sysadm/bin/mkdtab
+ /usr/bin/rm -f /etc/rc2.d/S82mkdtab
+ /usr/sbin/removef SUNWcsr /etc/rc2.d/S82mkdtab > /dev/null 2>&1
+ /usr/sbin/removef -f SUNWcsr > /dev/null 2>&1
+fi
diff --git a/usr/src/cmd/initpkg/init.d/nfs.server b/usr/src/cmd/initpkg/init.d/nfs.server
new file mode 100644
index 0000000000..4f60fc8f4b
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/nfs.server
@@ -0,0 +1,45 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+# This service is managed by smf(5). Thus, this script provides
+# compatibility with previously documented init.d script behaviour.
+
+case "$1" in
+'start')
+ svcadm enable -t network/nfs/server
+ ;;
+
+'stop')
+ svcadm disable -t network/nfs/server
+ ;;
+
+*)
+ echo "Usage: $0 { start | stop }"
+ exit 1
+ ;;
+esac
diff --git a/usr/src/cmd/initpkg/init.d/nscd b/usr/src/cmd/initpkg/init.d/nscd
new file mode 100644
index 0000000000..de78fe8812
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/nscd
@@ -0,0 +1,48 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+# This service is managed by smf(5). Thus, this script provides
+# compatibility with previously documented init.d script behaviour.
+
+FMRI=system/name-service-cache:default
+
+case "$1" in
+'start')
+ [ -f /etc/nscd.conf ] && [ -f /usr/sbin/nscd ] || exit 0
+ /usr/sbin/svcadm enable -t $FMRI
+ ;;
+
+'stop')
+ [ -f /usr/sbin/nscd ] && /usr/sbin/svcadm disable -t $FMRI
+ ;;
+
+*)
+ echo "Usage: $0 { start | stop }"
+ exit 1
+ ;;
+esac
diff --git a/usr/src/cmd/initpkg/init.d/pcmcia b/usr/src/cmd/initpkg/init.d/pcmcia
new file mode 100644
index 0000000000..e3d30a1623
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/pcmcia
@@ -0,0 +1,46 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 1994-1998 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+case "$1" in
+'start')
+ if [ -c /dev/pem -a -f /usr/lib/pcmciad ] ; then
+ /usr/lib/pcmciad 1>/dev/msglog 2>&1 && \
+ echo 'starting PCMCIA user daemon.'
+ fi
+ ;;
+
+'stop')
+ /usr/bin/pkill -x -u 0 pcmciad
+ ;;
+
+*)
+ echo "Usage: $0 { start | stop }"
+ exit 1
+ ;;
+esac
+exit 0
diff --git a/usr/src/cmd/initpkg/init.d/sendmail b/usr/src/cmd/initpkg/init.d/sendmail
new file mode 100644
index 0000000000..5a3548d03b
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/sendmail
@@ -0,0 +1,52 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+# This service is managed by smf(5). Thus, this script provides
+# compatibility with previously documented init.d script behaviour.
+
+case "$1" in
+'restart')
+ # The previous init.d/sendmail restart behaviour matches
+ # the smf(5) 'refresh' semantics.
+
+ svcadm refresh network/smtp:sendmail
+ ;;
+
+'start')
+ svcadm enable -t network/smtp:sendmail
+ ;;
+
+'stop')
+ svcadm disable -t network/smtp:sendmail
+ ;;
+
+*)
+ echo "Usage: $0 { start | stop | restart }"
+ exit 1
+ ;;
+esac
diff --git a/usr/src/cmd/initpkg/init.d/slpd b/usr/src/cmd/initpkg/init.d/slpd
new file mode 100644
index 0000000000..d5283fa7f9
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/slpd
@@ -0,0 +1,47 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+# This service is managed by smf(5). Thus, this script provides
+# compatibility with previously documented init.d script behaviour.
+
+FMRI=network/slp:default
+
+case "$1" in
+'start')
+ /usr/sbin/svcadm enable -t $FMRI
+ ;;
+
+'stop')
+ /usr/sbin/svcadm disable -t $FMRI
+ ;;
+
+*)
+ echo "Usage: $0 { start | stop }"
+ exit 1
+ ;;
+esac
diff --git a/usr/src/cmd/initpkg/init.d/sysetup b/usr/src/cmd/initpkg/init.d/sysetup
new file mode 100644
index 0000000000..e06d23d141
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/sysetup
@@ -0,0 +1,96 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+if [ -z "$_INIT_PREV_LEVEL" ]; then
+ set -- `/usr/bin/who -r`
+ _INIT_PREV_LEVEL="$9"
+fi
+
+[ $_INIT_PREV_LEVEL != S -a $_INIT_PREV_LEVEL != 1 ] && exit 0
+
+# Uncomment this line to print the complete system configuration on startup
+#[ -x /usr/sbin/prtconf ] && /usr/sbin/prtconf
+
+# If there are trademark files, print them.
+
+[ -d /etc/tm ] && /usr/bin/cat /etc/tm/* 2>/dev/null
+
+#
+# Set default scheduling class
+#
+if [ -f /etc/dispadmin.conf ] && [ -x /usr/sbin/dispadmin ] && \
+ [ -x /usr/bin/priocntl ] && \
+ [ "${_INIT_ZONENAME:=`/sbin/zonename`}" = "global" ]; then
+ ERROR="$0: cannot set default scheduling class to "
+ DISPADMIN_D=`/usr/sbin/dispadmin -d`
+
+ if [ $? -eq 0 ]; then
+ #
+ # Inform the kernel about the default scheduling class.
+ #
+ dispadmin -u
+
+ DEFAULT_SCHEDULER=`echo $DISPADMIN_D | \
+ /usr/bin/awk '{ print $1 }'`
+
+ /usr/bin/priocntl -s -c $DEFAULT_SCHEDULER \
+ -i all >/dev/null 2>&1
+
+ if [ $? -ne 0 ]; then
+ echo $ERROR $DEFAULT_SCHEDULER
+ else
+ #
+ # Also need to move init process explicitly
+ # because it was ignored by "-i all".
+ #
+ /usr/bin/priocntl -s -c $DEFAULT_SCHEDULER \
+ -i pid 1 >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo $ERROR $DEFAULT_SCHEDULER
+ fi
+ fi
+ fi
+fi
+
+#
+# Run rctladm to configure system resource controls based on the settings
+# previously saved by rctladm. See rctladm(1m) for instructions on how to
+# modify resource control settings.
+#
+if [ -f /etc/rctladm.conf ] && [ -x /usr/sbin/rctladm ]; then
+ /usr/sbin/rctladm -u
+fi
+
+#
+# Run pooladm to configure system pools. See pooladm(1m) for more information.
+#
+if [ -f /etc/pooladm.conf ] && [ -x /usr/sbin/pooladm ] && \
+ [ "$_INIT_ZONENAME" = "global" ]; then
+ /usr/sbin/pooladm -e
+ /usr/sbin/pooladm -c
+fi
diff --git a/usr/src/cmd/initpkg/init.d/uucp b/usr/src/cmd/initpkg/init.d/uucp
new file mode 100644
index 0000000000..3fbc668976
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/uucp
@@ -0,0 +1,36 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 1997 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+if [ -z "$_INIT_PREV_LEVEL" ]; then
+ set -- `/usr/bin/who -r`
+ _INIT_PREV_LEVEL="$9"
+fi
+
+if [ $_INIT_PREV_LEVEL = S -o $_INIT_PREV_LEVEL = 1 ]; then
+ /usr/bin/rm -rf /usr/spool/locks/* >/dev/null 2>&1 &
+fi
diff --git a/usr/src/cmd/initpkg/init.d/volmgt b/usr/src/cmd/initpkg/init.d/volmgt
new file mode 100644
index 0000000000..fda76aebf3
--- /dev/null
+++ b/usr/src/cmd/initpkg/init.d/volmgt
@@ -0,0 +1,48 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+case "$1" in
+'start')
+ if [ -f /etc/vold.conf -a -f /usr/sbin/vold -a \
+ "${_INIT_ZONENAME:=`/sbin/zonename`}" = "global" ]; then
+ echo 'volume management starting.'
+ /usr/sbin/vold >/dev/msglog 2>&1 &
+ fi
+ ;;
+
+'stop')
+ /usr/bin/pkill -x -u 0 -z ${_INIT_ZONENAME:=`/sbin/zonename`} vold
+ ;;
+
+*)
+ echo "Usage: $0 { start | stop }"
+ exit 1
+ ;;
+
+esac
+exit 0
diff --git a/usr/src/cmd/initpkg/inittab b/usr/src/cmd/initpkg/inittab
new file mode 100644
index 0000000000..aa2395f0b7
--- /dev/null
+++ b/usr/src/cmd/initpkg/inittab
@@ -0,0 +1,43 @@
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# The /etc/inittab file controls the configuration of init(1M); for more
+# information refer to init(1M) and inittab(4). It is no longer
+# necessary to edit inittab(4) directly; administrators should use the
+# Solaris Service Management Facility (SMF) to define services instead.
+# Refer to smf(5) and the System Administration Guide for more
+# information on SMF.
+#
+# For modifying parameters passed to ttymon, use svccfg(1m) to modify
+# the SMF repository. For example:
+#
+# # svccfg
+# svc:> select system/console-login
+# svc:/system/console-login> setprop ttymon/terminal_type = "xterm"
+# svc:/system/console-login> exit
+#
+#ident "%Z%%M% %I% %E% SMI"
+ap::sysinit:/sbin/autopush -f /etc/iu.ap
+sp::sysinit:/sbin/soconfig -f /etc/sock2path
+smf::sysinit:/lib/svc/bin/svc.startd >/dev/msglog 2<>/dev/msglog </dev/console
+p3:s1234:powerfail:/usr/sbin/shutdown -y -i5 -g0 >/dev/msglog 2<>/dev/msglog
diff --git a/usr/src/cmd/initpkg/mountall.sh b/usr/src/cmd/initpkg/mountall.sh
new file mode 100644
index 0000000000..4cd5c99a98
--- /dev/null
+++ b/usr/src/cmd/initpkg/mountall.sh
@@ -0,0 +1,389 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+#ident "%Z%%M% %I% %E% SMI"
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
+# All Rights Reserved
+#
+
+# checkmessage "fsck_device | mount_point"
+#
+# Simple auxilary routine to the shell function checkfs. Prints out
+# instructions for a manual file system check before entering the shell.
+#
+checkmessage() {
+ echo "" > /dev/console
+ if [ "$1" != "" ] ; then
+ echo "WARNING - Unable to repair one or more \c" > /dev/console
+ echo "of the following filesystem(s):" > /dev/console
+ echo "\t$1" > /dev/console
+ else
+ echo "WARNING - Unable to repair one or more filesystems." \
+ > /dev/console
+ fi
+ echo "Run fsck manually (fsck filesystem...)." > /dev/console
+ echo "" > /dev/console
+}
+
+#
+# checkfs raw_device fstype mountpoint
+#
+# Check the file system specified. The return codes from fsck have the
+# following meanings.
+# 0 - file system is unmounted and okay
+# 32 - file system is unmounted and needs checking (fsck -m only)
+# 33 - file system is already mounted
+# 34 - cannot stat device
+# 36 - uncorrectable errors detected - terminate normally (4.1 code 8)
+# 37 - a signal was caught during processing (4.1 exit 12)
+# 39 - uncorrectable errors detected - terminate rightaway (4.1 code 8)
+# 40 - for root, same as 0 (used by rcS to remount root)
+#
+checkfs() {
+ /usr/sbin/fsck -F $2 -m $1 >/dev/null 2>&1
+
+ if [ $? -ne 0 ]
+ then
+ # Determine fsck options by file system type
+ case "$2" in
+ ufs) foptions="-o p"
+ ;;
+ *) foptions="-y"
+ ;;
+ esac
+
+ echo "The "$3" file system ("$1") is being checked."
+ /usr/sbin/fsck -F $2 ${foptions} $1
+
+ case $? in
+ 0|40) # file system OK
+ ;;
+
+ *) # couldn't fix the file system
+ echo "/usr/sbin/fsck failed with exit code "$?"."
+ checkmessage "$1"
+ ;;
+ esac
+ fi
+}
+
+#
+# Used to save an entry that we will want to mount either in
+# a command file or as a mount point list.
+#
+# saveentry fstype options special mountp
+#
+saveentry() {
+ if [ "$ALTM" ]; then
+ echo "/sbin/mount -F $1 $2 $3 $4" >> $ALTM
+ else
+ mntlist="$mntlist $4"
+ fi
+}
+
+
+PATH=/usr/sbin:/usr/bin
+USAGE="Usage:\nmountall [-F FSType] [-l|-r|-g] [file_system_table]"
+TYPES=all
+FSTAB=/etc/vfstab
+err=0
+
+#
+# Process command line args
+#
+while getopts ?grlsF: c
+do
+ case $c in
+ g) GFLAG="g";;
+ r) RFLAG="r";;
+ l) LFLAG="l";;
+ s) SFLAG="s";;
+ F) FSType="$OPTARG";
+ if [ "$TYPES" = "one" ]
+ then
+ echo "mountall: more than one FSType specified"
+ exit 2
+ fi
+ TYPES="one";
+
+ case $FSType in
+ ?????????*)
+ echo "mountall: FSType $FSType exceeds 8 characters"
+ exit 2
+ esac
+ ;;
+ \?) echo "$USAGE" 1>&2; exit 2;;
+ esac
+done
+
+shift `/usr/bin/expr $OPTIND - 1` # get past the processed args
+
+if [ $# -gt 1 ]; then
+ echo "mountall: multiple arguments not supported" 1>&2
+ echo "$USAGE" 1>&2
+ exit 2
+fi
+
+# get file system table name and make sure file exists
+if [ $# = 1 ]; then
+ case $1 in
+ "-") FSTAB=""
+ ;;
+ *) FSTAB=$1
+ ;;
+ esac
+fi
+#
+# if an alternate vfstab file is used or serial mode is specified, then
+# use a mount command file
+#
+if [ $# = 1 -o "$SFLAG" ]; then
+ ALTM=/var/tmp/mount$$
+ rm -f $ALTM
+fi
+
+if [ "$FSTAB" != "" -a ! -s "$FSTAB" ]
+then
+ echo "mountall: file system table ($FSTAB) not found"
+ exit 1
+fi
+
+#
+# Check for incompatible args
+#
+if [ "$GFLAG" = "g" -a "$RFLAG$LFLAG" != "" -o \
+ "$RFLAG" = "r" -a "$GFLAG$LFLAG" != "" -o \
+ "$LFLAG" = "l" -a "$RFLAG$GFLAG" != "" ]
+then
+ echo "mountall: options -g, -r and -l are mutually exclusive" 1>&2
+ echo "$USAGE" 1>&2
+ exit 2
+fi
+
+if [ \( "$FSType" = "cachefs" -o "$FSType" = "nfs" \) -a "$LFLAG" = "l" ]
+then
+ echo "mountall: option -l and FSType are incompatible" 1>&2
+ echo "$USAGE" 1>&2
+ exit 2
+fi
+if [ "$FSType" -a "$FSType" != "nfs" -a "$RFLAG" = "r" ]
+then
+ echo "mountall: option -r and FSType are incompatible" 1>&2
+ echo "$USAGE" 1>&2
+ exit 2
+fi
+
+# file-system-table format:
+#
+# column 1: special- block special device or resource name
+# column 2: fsckdev- char special device for fsck
+# column 3: mountp- mount point
+# column 4: fstype- File system type
+# column 5: fsckpass- number if to be checked automatically
+# column 6: automnt- yes/no for automatic mount
+# column 7: mntopts- -o specific mount options
+
+# White-space separates columns.
+# Lines beginning with \"#\" are comments. Empty lines are ignored.
+# a '-' in any field is a no-op.
+
+#
+# Read FSTAB, fsck'ing appropriate filesystems:
+#
+exec < $FSTAB
+while read special fsckdev mountp fstype fsckpass automnt mntopts
+do
+ case $special in
+ '#'* | '') # Ignore comments, empty lines
+ continue ;;
+ '-') # Ignore no-action lines
+ continue
+ esac
+
+ if [ "$automnt" != "yes" ]; then
+ continue
+ fi
+ if [ "$FSType" -a "$FSType" != "$fstype" ]; then
+ # ignore different fstypes
+ continue
+ fi
+
+ if [ "$LFLAG" ]; then
+ # Skip entries that have the "global" option.
+ g=`/usr/bin/grep '\<global\>' << EOF
+ $mntopts
+ EOF`
+ if [ "$fstype" = "cachefs" -o "$fstype" = "nfs" -o "$g" ]; then
+ continue
+ fi
+ elif [ "$RFLAG" -a "$fstype" != "nfs" ]; then
+ continue
+ elif [ "$GFLAG" ]; then
+ # Skip entries that have don't the "global" option.
+ g=`/usr/bin/grep '\<global\>' << EOF
+ $mntopts
+ EOF`
+ if [ "$fstype" = "cachefs" -o "$fstype" = "nfs" -o -z "$g" ]
+ then
+ continue
+ fi
+ fi
+
+ if [ "$fstype" = "-" ]; then
+ echo "mountall: FSType of $special cannot be identified" 1>&2
+ continue
+ fi
+
+ if [ "$ALTM" -a "$mntopts" != "-" ]; then
+ OPTIONS="-o $mntopts" # Use mount options if any
+ else
+ OPTIONS=""
+ fi
+
+ #
+ # Ignore entries already mounted
+ #
+ /usr/bin/grep " $mountp " /etc/mnttab >/dev/null 2>&1 && continue
+
+ #
+ # Can't fsck if no fsckdev is specified
+ #
+ if [ "$fsckdev" = "-" ]; then
+ saveentry $fstype "$OPTIONS" $special $mountp
+ continue
+ fi
+ #
+ # For fsck purposes, we make a distinction between file systems
+ # that have a /usr/lib/fs/<fstyp>/fsckall script and those
+ # that don't. For those that do, just keep a list of them
+ # and pass the list to the fsckall script for that file
+ # file system type.
+ #
+ if [ -x /usr/lib/fs/$fstype/fsckall ]; then
+
+ #
+ # add fstype to the list of fstypes for which
+ # fsckall should be called, if it's not already
+ # in the list.
+ #
+ found=no
+ if [ "$fsckall_fstypes" != "" ] ; then
+ for fst in $fsckall_fstypes; do
+ if [ "$fst" = "$fstype" ] ; then
+ found=yes
+ break
+ fi
+ done
+ fi
+ if [ $found = no ] ; then
+ fsckall_fstypes="$fsckall_fstypes ${fstype}"
+ fi
+
+ #
+ # add the device to the name of devices to be passed
+ # to the fsckall program for this file system type
+ #
+ cmd="${fstype}_fscklist=\"\$${fstype}_fscklist $fsckdev\""
+ eval $cmd
+ saveentry $fstype "$OPTIONS" $special $mountp
+ continue
+ fi
+ #
+ # fsck everything else:
+ #
+ # fsck -m simply returns true if the filesystem is suitable for
+ # mounting.
+ #
+ /usr/sbin/fsck -m -F $fstype $fsckdev >/dev/null 2>&1
+ case $? in
+ 0|40) saveentry $fstype "$OPTIONS" $special $mountp
+ continue
+ ;;
+ 32) checkfs $fsckdev $fstype $mountp
+ saveentry $fstype "$OPTIONS" $special $mountp
+ continue
+ ;;
+ 33) # already mounted
+ echo "$special already mounted"
+ ;;
+ 34) # bogus special device
+ echo "Cannot stat $fsckdev - ignoring"
+ err=1
+ ;;
+ *) # uncorrectable errors
+ echo "$fsckdev uncorrectable error"
+ err=1
+ ;;
+ esac
+done
+
+#
+# Call the fsckall programs
+#
+for fst in $fsckall_fstypes
+do
+ cmd="/usr/lib/fs/$fst/fsckall \$${fst}_fscklist"
+ eval $cmd
+
+ case $? in
+ 0) # file systems OK
+ ;;
+
+ *) # couldn't fix some of the filesystems
+ echo "fsckall failed with exit code "$?"."
+ checkmessage
+ ;;
+ esac
+done
+
+if [ "$ALTM" ]; then
+ if [ ! -f "$ALTM" ]; then
+ exit
+ fi
+ /sbin/sh $ALTM # run the saved mount commands
+ /usr/bin/rm -f $ALTM
+ exit
+fi
+
+if [ -n "$FSType" ]; then
+ /sbin/mount -a -F $FSType
+ exit
+fi
+
+if [ "$RFLAG" ]; then
+ /sbin/mount -a -F nfs
+ exit
+fi
+
+if [ "$LFLAG" -o "$GFLAG" -o $err != 0 ]; then
+ [ -z "$mntlist" ] || /sbin/mount -a $mntlist
+ exit
+fi
+
+# else mount them all
+
+/sbin/mount -a
diff --git a/usr/src/cmd/initpkg/nscd.conf b/usr/src/cmd/initpkg/nscd.conf
new file mode 100644
index 0000000000..9152f40cb4
--- /dev/null
+++ b/usr/src/cmd/initpkg/nscd.conf
@@ -0,0 +1,86 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 1994-2001 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#ident "%Z%%M% %I% %E% SMI"
+#
+
+#
+# Currently supported cache names: passwd, group, hosts, ipnodes
+# exec_attr, prof_attr, user_attr
+#
+
+# logfile /var/adm/nscd.log
+# enable-cache hosts no
+
+ debug-level 0
+
+ positive-time-to-live passwd 600
+ negative-time-to-live passwd 5
+ suggested-size passwd 211
+ keep-hot-count passwd 20
+ old-data-ok passwd no
+ check-files passwd yes
+
+ positive-time-to-live group 3600
+ negative-time-to-live group 5
+ suggested-size group 211
+ keep-hot-count group 20
+ old-data-ok group no
+ check-files group yes
+
+ positive-time-to-live hosts 3600
+ negative-time-to-live hosts 5
+ suggested-size hosts 211
+ keep-hot-count hosts 20
+ old-data-ok hosts no
+ check-files hosts yes
+
+ positive-time-to-live ipnodes 3600
+ negative-time-to-live ipnodes 5
+ suggested-size ipnodes 211
+ keep-hot-count ipnodes 20
+ old-data-ok ipnodes no
+ check-files ipnodes yes
+
+ positive-time-to-live exec_attr 3600
+ negative-time-to-live exec_attr 300
+ suggested-size exec_attr 211
+ keep-hot-count exec_attr 20
+ old-data-ok exec_attr no
+ check-files exec_attr yes
+
+ positive-time-to-live prof_attr 3600
+ negative-time-to-live prof_attr 5
+ suggested-size prof_attr 211
+ keep-hot-count prof_attr 20
+ old-data-ok prof_attr no
+ check-files prof_attr yes
+
+ positive-time-to-live user_attr 3600
+ negative-time-to-live user_attr 5
+ suggested-size user_attr 211
+ keep-hot-count user_attr 20
+ old-data-ok user_attr no
+ check-files user_attr yes
diff --git a/usr/src/cmd/initpkg/rc0.d/mk.rc0.d.sh b/usr/src/cmd/initpkg/rc0.d/mk.rc0.d.sh
new file mode 100644
index 0000000000..087c557891
--- /dev/null
+++ b/usr/src/cmd/initpkg/rc0.d/mk.rc0.d.sh
@@ -0,0 +1,58 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
+# All Rights Reserved
+
+
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+COMMON_STOPLST="05volmgt 27boot.server"
+
+INIT_STOPLST="07snmpdx 07dmi"
+
+INSDIR=${ROOT}/etc/rc0.d
+
+if [ ! -d ${INSDIR} ]
+then
+ mkdir ${INSDIR}
+ eval ${CH}chmod 755 ${INSDIR}
+ eval ${CH}chgrp sys ${INSDIR}
+ eval ${CH}chown root ${INSDIR}
+fi
+for f in ${COMMON_STOPLST}
+do
+ name=`echo $f | sed -e 's/^..//'`
+ rm -f ${INSDIR}/K$f
+ ln ${ROOT}/etc/init.d/${name} ${INSDIR}/K$f
+done
+for f in ${INIT_STOPLST}
+do
+ name=`echo $f | sed -e 's/^..//'`
+ rm -f ${INSDIR}/K$f
+ ln ${ROOT}/etc/init.d/init.${name} ${INSDIR}/K$f
+done
diff --git a/usr/src/cmd/initpkg/rc0.sh b/usr/src/cmd/initpkg/rc0.sh
new file mode 100644
index 0000000000..741be2290d
--- /dev/null
+++ b/usr/src/cmd/initpkg/rc0.sh
@@ -0,0 +1,91 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
+# All rights reserved.
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+# "Run Commands" for init states 0, 5 and 6.
+
+PATH=/usr/sbin:/usr/bin
+
+if [ -z "$SMF_RESTARTER" ]; then
+ echo "Cannot be run outside smf(5)"
+ exit 1
+fi
+
+# Export boot parameters to rc scripts
+
+set -- `/usr/bin/who -r`
+
+_INIT_RUN_LEVEL="$7" # Current run-level
+_INIT_RUN_NPREV="$8" # Number of times previously at current run-level
+_INIT_PREV_LEVEL="$9" # Previous run-level
+
+set -- `/usr/bin/uname -a`
+
+_INIT_UTS_SYSNAME="$1" # Operating system name (uname -s)
+_INIT_UTS_NODENAME="$2" # Node name (uname -n)
+_INIT_UTS_RELEASE="$3" # Operating system release (uname -r)
+_INIT_UTS_VERSION="$4" # Operating system version (uname -v)
+_INIT_UTS_MACHINE="$5" # Machine class (uname -m)
+_INIT_UTS_ISA="$6" # Instruction set architecture (uname -p)
+_INIT_UTS_PLATFORM="$7" # Platform string (uname -i)
+
+export _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
+ _INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
+ _INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
+
+if [ -d /etc/rc0.d ]; then
+ for f in /etc/rc0.d/K*; do
+ if [ -s $f ]; then
+ case $f in
+ *.sh) /lib/svc/bin/lsvcrun -s $f stop;;
+ *) /lib/svc/bin/lsvcrun $f stop;;
+ esac
+ fi
+ done
+
+ # System cleanup functions ONLY (things that end fast!)
+
+ for f in /etc/rc0.d/S*; do
+ if [ -s $f ]; then
+ case $f in
+ *.sh) /lib/svc/bin/lsvcrun -s $f start;;
+ *) /lib/svc/bin/lsvcrun $f start ;;
+ esac
+ fi
+ done
+fi
+
+[ -f /etc/.dynamic_routing ] && /usr/bin/rm -f /etc/.dynamic_routing
+
+trap "" 15
+
+[ -x /usr/lib/acct/closewtmp ] && /usr/lib/acct/closewtmp
+/sbin/sync; /sbin/sync; /sbin/sync
diff --git a/usr/src/cmd/initpkg/rc1.d/mk.rc1.d.sh b/usr/src/cmd/initpkg/rc1.d/mk.rc1.d.sh
new file mode 100644
index 0000000000..ab916b3526
--- /dev/null
+++ b/usr/src/cmd/initpkg/rc1.d/mk.rc1.d.sh
@@ -0,0 +1,58 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
+# All rights reserved
+
+
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+COMMON_STOPLST="05volmgt 27boot.server"
+
+INIT_STOPLST="07snmpdx 07dmi"
+
+INSDIR=${ROOT}/etc/rc1.d
+
+if [ ! -d ${INSDIR} ]
+then
+ mkdir ${INSDIR}
+ eval ${CH}chmod 755 ${INSDIR}
+ eval ${CH}chgrp sys ${INSDIR}
+ eval ${CH}chown root ${INSDIR}
+fi
+for f in ${COMMON_STOPLST}
+do
+ name=`echo $f | sed -e 's/^..//'`
+ rm -f ${INSDIR}/K$f
+ ln ${ROOT}/etc/init.d/${name} ${INSDIR}/K$f
+done
+for f in ${INIT_STOPLST}
+do
+ name=`echo $f | sed -e 's/^..//'`
+ rm -f ${INSDIR}/K$f
+ ln ${ROOT}/etc/init.d/init.${name} ${INSDIR}/K$f
+done
diff --git a/usr/src/cmd/initpkg/rc1.sh b/usr/src/cmd/initpkg/rc1.sh
new file mode 100644
index 0000000000..edb61f7b9b
--- /dev/null
+++ b/usr/src/cmd/initpkg/rc1.sh
@@ -0,0 +1,116 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
+# All rights reserved.
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+# "Run Commands" executed when the system is changing to init state 1
+
+if [ -z "$SMF_RESTARTER" ]; then
+ echo "Cannot be run outside smf(5)"
+ exit 1
+fi
+
+. /lib/svc/share/smf_include.sh
+
+PATH=/usr/sbin:/usr/bin
+
+action=$1
+
+# Export boot parameters to rc scripts
+
+set -- `/usr/bin/who -r`
+
+_INIT_RUN_LEVEL="$7" # Current run-level
+_INIT_RUN_NPREV="$8" # Number of times previously at current run-level
+_INIT_PREV_LEVEL="$9" # Previous run-level
+
+set -- `/usr/bin/uname -a`
+
+_INIT_UTS_SYSNAME="$1" # Operating system name (uname -s)
+_INIT_UTS_NODENAME="$2" # Node name (uname -n)
+_INIT_UTS_RELEASE="$3" # Operating system release (uname -r)
+_INIT_UTS_VERSION="$4" # Operating system version (uname -v)
+_INIT_UTS_MACHINE="$5" # Machine class (uname -m)
+_INIT_UTS_ISA="$6" # Instruction set architecture (uname -p)
+_INIT_UTS_PLATFORM="$7" # Platform string (uname -i)
+
+export _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
+ _INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
+ _INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
+
+. /lib/svc/share/fs_include.sh
+
+case $action in
+ stop)
+ >/etc/nologin
+
+ # All remote filesystem services must be explicitly disabled
+ # at init run level 1, and at the single-user milestone.
+
+ if [ -d /etc/rc1.d ]; then
+ for f in /etc/rc1.d/K*; do
+ if [ ! -s $f ]; then
+ continue;
+ fi
+
+ case $f in
+ *.sh) /lib/svc/bin/lsvcrun -s $f stop
+ ;;
+ *) /lib/svc/bin/lsvcrun $f stop ;;
+ esac
+ done
+ fi
+
+ ;;
+
+ start)
+ if [ -d /etc/rc1.d ]; then
+ for f in /etc/rc1.d/S*; do
+ if [ ! -s $f ]; then
+ continue;
+ fi
+
+ case $f in
+ *.sh) /lib/svc/bin/lsvcrun -s $f start
+ ;;
+ *) /lib/svc/bin/lsvcrun $f start ;;
+ esac
+ done
+ fi
+
+ ;;
+
+ *)
+ echo "Usage: $0 { start | stop }"
+ exit $SMF_EXIT_ERR_CONFIG
+ ;;
+esac
+
+exit $SMF_EXIT_OK
diff --git a/usr/src/cmd/initpkg/rc2.d/mk.rc2.d.sh b/usr/src/cmd/initpkg/rc2.d/mk.rc2.d.sh
new file mode 100644
index 0000000000..e0a5b56d03
--- /dev/null
+++ b/usr/src/cmd/initpkg/rc2.d/mk.rc2.d.sh
@@ -0,0 +1,71 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
+# All Rights Reserved
+
+
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+COMMON_STARTLST="\
+20sysetup \
+70uucp \
+73cachefs.daemon \
+82mkdtab \
+98deallocate"
+
+STOPLST="05volmgt 27boot.server"
+
+INIT_STOPLST="07snmpdx 07dmi"
+
+INSDIR=${ROOT}/etc/rc2.d
+
+if [ ! -d ${INSDIR} ]
+then
+ mkdir ${INSDIR}
+ eval ${CH}chmod 755 ${INSDIR}
+ eval ${CH}chgrp sys ${INSDIR}
+ eval ${CH}chown root ${INSDIR}
+fi
+for f in ${STOPLST}
+do
+ name=`echo $f | sed -e 's/^..//'`
+ rm -f ${INSDIR}/K$f
+ ln ${ROOT}/etc/init.d/${name} ${INSDIR}/K$f
+done
+for f in ${INIT_STOPLST}
+do
+ name=`echo $f | sed -e 's/^..//'`
+ rm -f ${INSDIR}/K$f
+ ln ${ROOT}/etc/init.d/init.${name} ${INSDIR}/K$f
+done
+for f in ${COMMON_STARTLST}
+do
+ name=`echo $f | sed -e 's/^..//'`
+ rm -f ${INSDIR}/S$f
+ ln ${ROOT}/etc/init.d/${name} ${INSDIR}/S$f
+done
diff --git a/usr/src/cmd/initpkg/rc2.sh b/usr/src/cmd/initpkg/rc2.sh
new file mode 100644
index 0000000000..979890592f
--- /dev/null
+++ b/usr/src/cmd/initpkg/rc2.sh
@@ -0,0 +1,120 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
+# All rights reserved.
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+# Run Commands executed when the system is changing to init state 2,
+# traditionally called "multi-user". Pick up start-up packages for mounts,
+# daemons, services, etc.
+
+PATH=/usr/sbin:/usr/bin
+
+if [ -z "$SMF_RESTARTER" ]; then
+ echo "Cannot be run outside smf(5)"
+ exit 1
+fi
+
+action=$1
+
+# Export boot parameters to rc scripts
+
+set -- `/usr/bin/who -r`
+
+_INIT_RUN_LEVEL="$7" # Current run-level
+_INIT_RUN_NPREV="$8" # Number of times previously at current run-level
+_INIT_PREV_LEVEL="$9" # Previous run-level
+
+set -- `/usr/bin/uname -a`
+
+_INIT_UTS_SYSNAME="$1" # Operating system name (uname -s)
+_INIT_UTS_NODENAME="$2" # Node name (uname -n)
+_INIT_UTS_RELEASE="$3" # Operating system release (uname -r)
+_INIT_UTS_VERSION="$4" # Operating system version (uname -v)
+_INIT_UTS_MACHINE="$5" # Machine class (uname -m)
+_INIT_UTS_ISA="$6" # Instruction set architecture (uname -p)
+_INIT_UTS_PLATFORM="$7" # Platform string (uname -i)
+
+export _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
+ _INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
+ _INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
+
+_INIT_ZONENAME=`/sbin/zonename`
+
+export _INIT_ZONENAME
+
+if [ "$_INIT_ZONENAME" = "global" ]; then
+ # Export net boot configuration strategy. _INIT_NET_IF is set to the
+ # interface name of the netbooted interface if this is a net boot.
+ # _INIT_NET_STRATEGY is set to the network configuration strategy.
+ set -- `/sbin/netstrategy`
+ if [ $? -eq 0 ]; then
+ if [ "$1" = "nfs" -o "$1" = "cachefs" ]; then
+ _INIT_NET_IF="$2"
+ fi
+ _INIT_NET_STRATEGY="$3"
+ export _INIT_NET_IF _INIT_NET_STRATEGY
+ fi
+fi
+
+case $action in
+ stop)
+ if [ -d /etc/rc2.d ]; then
+ for f in /etc/rc2.d/K*; do
+ if [ ! -s $f ]; then
+ continue
+ fi
+
+ case $f in
+ *.sh) /lib/svc/bin/lsvcrun -s $f \
+ stop ;;
+ *) /lib/svc/bin/lsvcrun $f stop ;;
+ esac
+ done
+ fi
+ ;;
+
+ start)
+ for f in /etc/rc2.d/S*; do
+ if [ -s $f ]; then
+ case $f in
+ *.sh) /lib/svc/bin/lsvcrun -s $f \
+ start ;;
+ *) /lib/svc/bin/lsvcrun $f start ;;
+ esac
+ fi
+ done
+ ;;
+
+ *)
+ echo "Invalid argument"
+ exit 1
+esac
+
+exit 0
diff --git a/usr/src/cmd/initpkg/rc3.d/mk.rc3.d.sh b/usr/src/cmd/initpkg/rc3.d/mk.rc3.d.sh
new file mode 100644
index 0000000000..df7461f960
--- /dev/null
+++ b/usr/src/cmd/initpkg/rc3.d/mk.rc3.d.sh
@@ -0,0 +1,57 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
+# All Rights Reserved
+
+
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+STARTLST="16boot.server 81volmgt"
+
+INIT_STARTLST="76snmpdx 77dmi"
+
+INSDIR=${ROOT}/etc/rc3.d
+
+if [ ! -d ${INSDIR} ]
+then
+ mkdir ${INSDIR}
+ eval ${CH}chmod 755 ${INSDIR}
+ eval ${CH}chgrp sys ${INSDIR}
+ eval ${CH}chown root ${INSDIR}
+fi
+for f in ${STARTLST}
+do
+ name=`echo $f | sed -e 's/^..//'`
+ rm -f ${INSDIR}/S$f
+ ln ${ROOT}/etc/init.d/${name} ${INSDIR}/S$f
+done
+for f in ${INIT_STARTLST}
+do
+ name=`echo $f | sed -e 's/^..//'`
+ rm -f ${INSDIR}/S$f
+ ln ${ROOT}/etc/init.d/init.${name} ${INSDIR}/S$f
+done
diff --git a/usr/src/cmd/initpkg/rc3.sh b/usr/src/cmd/initpkg/rc3.sh
new file mode 100644
index 0000000000..bdaa047e9f
--- /dev/null
+++ b/usr/src/cmd/initpkg/rc3.sh
@@ -0,0 +1,108 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
+# All rights reserved.
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+# Run Commands executed when the system is changing to init state 3,
+# same as state 2 (multi-user) but with remote file sharing.
+
+PATH=/usr/sbin:/usr/bin
+
+if [ -z "$SMF_RESTARTER" ]; then
+ echo "This script cannot be run outside smf(5)."
+ exit 1
+fi
+
+# Export boot parameters to rc scripts
+
+set -- `/usr/bin/who -r`
+
+_INIT_RUN_LEVEL="$7" # Current run-level
+_INIT_RUN_NPREV="$8" # Number of times previously at current run-level
+_INIT_PREV_LEVEL="$9" # Previous run-level
+
+set -- `/usr/bin/uname -a`
+
+_INIT_UTS_SYSNAME="$1" # Operating system name (uname -s)
+_INIT_UTS_NODENAME="$2" # Node name (uname -n)
+_INIT_UTS_RELEASE="$3" # Operating system release (uname -r)
+_INIT_UTS_VERSION="$4" # Operating system version (uname -v)
+_INIT_UTS_MACHINE="$5" # Machine class (uname -m)
+_INIT_UTS_ISA="$6" # Instruction set architecture (uname -p)
+_INIT_UTS_PLATFORM="$7" # Platform string (uname -i)
+
+export _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
+ _INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
+ _INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
+
+_INIT_ZONENAME=`/sbin/zonename`
+
+export _INIT_ZONENAME
+
+if [ "$_INIT_ZONENAME" = "global" ]; then
+ # Export net boot configuration strategy. _INIT_NET_IF is set to the
+ # interface name of the netbooted interface if this is a net boot.
+ # _INIT_NET_STRATEGY is set to the network configuration strategy.
+ set -- `/sbin/netstrategy`
+ if [ $? -eq 0 ]; then
+ if [ "$1" = "nfs" -o "$1" = "cachefs" ]; then
+ _INIT_NET_IF="$2"
+ fi
+ _INIT_NET_STRATEGY="$3"
+ export _INIT_NET_IF _INIT_NET_STRATEGY
+ fi
+fi
+
+if [ -d /etc/rc3.d ]; then
+ for f in /etc/rc3.d/K*; do
+ if [ -s $f ]; then
+ case $f in
+ *.sh) /lib/svc/bin/lsvcrun -s $f stop ;;
+ *) /lib/svc/bin/lsvcrun $f stop ;;
+ esac
+ fi
+ done
+
+ for f in /etc/rc3.d/S*; do
+ if [ -s $f ]; then
+ case $f in
+ *.sh) /lib/svc/bin/lsvcrun -s $f start ;;
+ *) /lib/svc/bin/lsvcrun $f start ;;
+ esac
+ fi
+ done
+fi
+
+if [ "$_INIT_ZONENAME" = "global" ]; then
+ # Unload all the loadable modules brought in during boot
+ # Delay a few seconds to allow dtlogin to open console first.
+
+ (sleep 5; modunload -i 0) & >/dev/null 2>&1
+fi
diff --git a/usr/src/cmd/initpkg/rcS.d/mk.rcS.d.sh b/usr/src/cmd/initpkg/rcS.d/mk.rcS.d.sh
new file mode 100644
index 0000000000..fd75f1d3ff
--- /dev/null
+++ b/usr/src/cmd/initpkg/rcS.d/mk.rcS.d.sh
@@ -0,0 +1,67 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
+# All rights reserved.
+#
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+COMMON_STARTLST=""
+
+COMMON_STOPLST="\
+05volmgt \
+27boot.server"
+
+INIT_STOPLST="07snmpdx 07dmi"
+
+INSDIR=${ROOT}/etc/rcS.d
+
+if [ ! -d ${INSDIR} ]
+then
+ mkdir ${INSDIR}
+ eval ${CH}chmod 755 ${INSDIR}
+ eval ${CH}chgrp sys ${INSDIR}
+ eval ${CH}chown root ${INSDIR}
+fi
+for f in ${COMMON_STOPLST}
+do
+ name=`echo $f | sed -e 's/^..//' | sed -e 's/\.sh$//'`
+ rm -f ${INSDIR}/K$f
+ ln ${ROOT}/etc/init.d/${name} ${INSDIR}/K$f
+done
+for f in ${INIT_STOPLST}
+do
+ name=`echo $f | sed -e 's/^..//' | sed -e 's/\.sh$//'`
+ rm -f ${INSDIR}/K$f
+ ln ${ROOT}/etc/init.d/init.${name} ${INSDIR}/K$f
+done
+for f in ${COMMON_STARTLST}
+do
+ name=`echo $f | sed -e 's/^..//' | sed -e 's/\.sh$//`
+ rm -f ${INSDIR}/S$f
+ ln ${ROOT}/etc/init.d/${name} ${INSDIR}/S$f
+done
diff --git a/usr/src/cmd/initpkg/rcS.sh b/usr/src/cmd/initpkg/rcS.sh
new file mode 100644
index 0000000000..962035549e
--- /dev/null
+++ b/usr/src/cmd/initpkg/rcS.sh
@@ -0,0 +1,224 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
+# All rights reserved.
+#
+#
+
+# This file executes the commands in the rcS.d directory, which are necessary
+# to get the system to single user mode:
+#
+# establish minimal network plumbing (for diskless and dataless)
+# mount /usr (if a separate file system)
+# set the system name
+# check the root (/) and /usr file systems
+# check and mount /var and /var/adm (if a separate file system)
+# mount pseudo file systems (/dev/fd)
+# if this is a reconfiguration boot, [re]build the device entries
+# check and mount other file systems to be mounted in single user mode
+
+if [ -z "$SMF_RESTARTER" ]; then
+ echo "Cannot be run outside smf(5)"
+ exit 1
+fi
+
+. /lib/svc/share/smf_include.sh
+
+#
+# Default definitions:
+#
+PATH=/usr/sbin:/usr/bin:/sbin
+vfstab=/etc/vfstab
+mnttab=/etc/mnttab
+mntlist=
+option=
+otherops=
+
+action=$1
+
+# Export boot parameters to rc scripts
+
+if [ "x$1" != xsysinit -a -d /usr/bin ]; then
+ set -- `/usr/bin/who -r`
+
+ _INIT_RUN_LEVEL=${7:-S} # Current run-level
+ _INIT_RUN_NPREV=${8:-0} # Number of times previously at current level
+ _INIT_PREV_LEVEL=${9:-0} # Previous run-level
+else
+ _INIT_RUN_LEVEL=S
+ _INIT_RUN_NPREV=0
+ _INIT_PREV_LEVEL=0
+fi
+
+set -- `/sbin/uname -a`
+
+#
+# If we're booting, uname -a will produce one fewer token than usual because
+# the hostname has not yet been configured. Leave NODENAME empty in this case.
+#
+if [ $# -eq 7 ]; then
+ _INIT_UTS_SYSNAME="$1" # Operating system name (uname -s)
+ _INIT_UTS_NODENAME="$2" # Node name (uname -n)
+ shift 2
+else
+ _INIT_UTS_SYSNAME="$1" # Operating system name (uname -s)
+ _INIT_UTS_NODENAME= # Node name is not yet configured
+ shift 1
+fi
+
+_INIT_UTS_RELEASE="$1" # Operating system release (uname -r)
+_INIT_UTS_VERSION="$2" # Operating system version (uname -v)
+_INIT_UTS_MACHINE="$3" # Machine class (uname -m)
+_INIT_UTS_ISA="$4" # Instruction set architecture (uname -p)
+_INIT_UTS_PLATFORM="$5" # Platform string (uname -i)
+
+export _INIT_RUN_LEVEL _INIT_RUN_NPREV _INIT_PREV_LEVEL \
+ _INIT_UTS_SYSNAME _INIT_UTS_NODENAME _INIT_UTS_RELEASE _INIT_UTS_VERSION \
+ _INIT_UTS_MACHINE _INIT_UTS_ISA _INIT_UTS_PLATFORM
+
+_INIT_ZONENAME=`/sbin/zonename`
+
+export _INIT_ZONENAME
+
+if [ "$_INIT_ZONENAME" = "global" ]; then
+ # Export net boot configuration strategy. _INIT_NET_IF is set to the
+ # interface name of the netbooted interface if this is a net boot.
+ # _INIT_NET_STRATEGY is set to the network configuration strategy.
+ set -- `/sbin/netstrategy`
+ if [ $? -eq 0 ]; then
+ if [ "$1" = "nfs" -o "$1" = "cachefs" ]; then
+ _INIT_NET_IF="$2"
+ export _INIT_NET_IF
+ fi
+ _INIT_NET_STRATEGY="$3"
+ fi
+else
+ # Special case for zones since netstrategy needs /dev/ip which does
+ # not exist in a non-global zone. Also, the _IF variable is only
+ # consumed in the global zone.
+ _INIT_NET_STRATEGY="none"
+fi
+export _INIT_NET_STRATEGY
+
+#
+# Useful shell functions:
+#
+
+#
+# shcat file
+#
+# Simulates cat in sh so it doesn't need to be on the root filesystem.
+#
+shcat() {
+ while [ $# -ge 1 ]; do
+ while read i; do
+ echo "$i"
+ done < $1
+ shift
+ done
+}
+
+. /lib/svc/share/fs_include.sh
+
+#
+# Make the old, deprecated environment variable (_DVFS_RECONFIG) and the new
+# supported environment variable (_INIT_RECONFIG) to be synonyms. Set both
+# if the svc.startd reconfigure property is set. Note that for complete
+# backwards compatibility the value "YES" is significant with _DVFS_RECONFIG.
+# The # value associated with _INIT_RECONFIG is insignificant. What is
+# significant is only that the environment variable is defined.
+#
+
+svcprop -q -p system/reconfigure system/svc/restarter:default
+if [ $? -eq 0 ]
+then
+ echo "Setting _INIT_RECONFIG."
+ _DVFS_RECONFIG=YES; export _DVFS_RECONFIG
+ _INIT_RECONFIG=set; export _INIT_RECONFIG
+fi
+
+
+case $action in
+ stop)
+ >/etc/nologin
+
+ # All remote filesystem services must be explicitly disabled
+ # at the single-user milestone. There's no need to unmount
+ # remote filesystems here.
+
+ if [ -d /etc/rcS.d ]; then
+ for f in /etc/rcS.d/K*; do
+ if [ ! -s $f ]; then
+ continue
+ fi
+
+ case $f in
+ *.sh) /lib/svc/bin/lsvcrun -s $f stop
+ ;;
+ *) /lib/svc/bin/lsvcrun $f stop ;;
+ esac
+ done
+ fi
+
+ ;;
+
+ start)
+ if [ -d /etc/rcS.d ]; then
+ for f in /etc/rcS.d/S*; do
+ if [ ! -s $f ]; then
+ continue
+ fi
+
+ case $f in
+ *.sh) /lib/svc/bin/lsvcrun -s $f start
+ ;;
+ *) /lib/svc/bin/lsvcrun $f start ;;
+ esac
+ done
+ fi
+
+ #
+ # Clean up the /reconfigure file and sync the new entries to
+ # stable media.
+ #
+
+ # GLXXX - svc.startd should do this?
+ if [ -n "$_INIT_RECONFIG" ]; then
+ [ -f /reconfigure ] && /usr/bin/rm -f /reconfigure
+ /sbin/sync
+ fi
+ ;;
+
+ *)
+ echo "Usage: $0 { start | stop }"
+ exit $SMF_EXIT_ERR_CONFIG
+ ;;
+esac
+
+exit $SMF_EXIT_OK
diff --git a/usr/src/cmd/initpkg/security/crypt.conf b/usr/src/cmd/initpkg/security/crypt.conf
new file mode 100644
index 0000000000..cb51ec38f2
--- /dev/null
+++ b/usr/src/cmd/initpkg/security/crypt.conf
@@ -0,0 +1,32 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+#ident "%Z%%M% %I% %E% SMI"
+#
+# The algorithm name __unix__ is reserved.
+
+1 crypt_bsdmd5.so.1
+2a crypt_bsdbf.so.1
+md5 crypt_sunmd5.so.1
diff --git a/usr/src/cmd/initpkg/shutdown.sh b/usr/src/cmd/initpkg/shutdown.sh
new file mode 100644
index 0000000000..187e8d679d
--- /dev/null
+++ b/usr/src/cmd/initpkg/shutdown.sh
@@ -0,0 +1,238 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
+# All Rights Reserved
+
+
+
+#ident "%Z%%M% %I% %E% SMI"
+
+# Sequence performed to change the init state of a machine. Only allows
+# transitions to states 0,1,5,6,s,S (i.e.: down or administrative states).
+
+# This procedure checks to see if you are permitted and allows an
+# interactive shutdown. The actual change of state, killing of
+# processes and such are performed by the new init state, say 0,
+# and its /sbin/rc0.
+
+usage() {
+ echo "Usage: $0 [ -y ] [ -g<grace> ] [ -i<initstate> ] [ message ]"
+ exit 1
+}
+
+notify() {
+ /usr/sbin/wall -a <<-!
+ $*
+ !
+ if [ -x /usr/sbin/showmount -a -x /usr/sbin/rwall ]
+ then
+ remotes=`/usr/sbin/showmount`
+ if [ "X${remotes}" != "X" ]
+ then
+ /usr/sbin/rwall -q ${remotes} <<-!
+ $*
+ !
+ fi
+ fi
+}
+
+nologin=/etc/nologin
+
+# Set the PATH so that to guarentee behavior of shell built in commands
+# (such as echo).
+
+PATH=/usr/sbin:/usr/bin:/sbin
+
+# Initial sanity checks:
+# Make sure /usr is mounted
+# Check the user id (only root can run shutdown)
+
+if [ ! -d /usr/bin ]
+then
+ echo "$0: /usr is not mounted. Mount /usr or use init to shutdown."
+ exit 1
+fi
+
+if [ -x /usr/bin/id ]
+then
+ eval `/usr/bin/id | /usr/bin/sed 's/[^a-z0-9=].*//'`
+ if [ "${uid:=0}" -ne 0 ]
+ then
+ echo "$0: Only root can run $0"
+ exit 2
+ fi
+else
+ echo "$0: can't check user id."
+ exit 2
+fi
+
+# Get options (defaults immediately below):
+
+grace=60
+askconfirmation=yes
+initstate=s
+
+while getopts g:i:y? c
+do
+ case $c in
+ g)
+ case $OPTARG in
+ *[!0-9]* )
+ echo "$0: -g requires a numeric option"
+ usage
+ ;;
+ [0-9]* )
+ grace=$OPTARG
+ ;;
+ esac
+ ;;
+ i)
+ case $OPTARG in
+ [Ss0156])
+ initstate=$OPTARG
+ ;;
+ [234abcqQ])
+ echo "$0: Initstate $OPTARG is not for system shutdown"
+ exit 1
+ ;;
+ *)
+ echo "$0: $OPTARG is not a valid initstate"
+ usage
+ ;;
+ esac
+ ;;
+ y)
+ askconfirmation=
+ ;;
+ \?) usage
+ ;;
+ esac
+done
+shift `expr $OPTIND - 1`
+
+echo '\nShutdown started. \c'
+/usr/bin/date
+echo
+
+NODENAME=`uname -n`
+
+/sbin/sync
+cd /
+
+trap "rm $nologin >/dev/null 2>&1 ;exit 1" 1 2 15
+
+# If other users are on the system (and any grace period is given), warn them.
+
+for i in 7200 3600 1800 1200 600 300 120 60 30 10; do
+ if [ ${grace} -gt $i ]
+ then
+ hours=`/usr/bin/expr ${grace} / 3600`
+ minutes=`/usr/bin/expr ${grace} % 3600 / 60`
+ seconds=`/usr/bin/expr ${grace} % 60`
+ time=""
+ if [ ${hours} -gt 1 ]
+ then
+ time="${hours} hours "
+ elif [ ${hours} -eq 1 ]
+ then
+ time="1 hour "
+ fi
+ if [ ${minutes} -gt 1 ]
+ then
+ time="${time}${minutes} minutes "
+ elif [ ${minutes} -eq 1 ]
+ then
+ time="${time}1 minute "
+ fi
+ if [ ${hours} -eq 0 -a ${seconds} -gt 0 ]
+ then
+ if [ ${seconds} -eq 1 ]
+ then
+ time="${time}${seconds} second"
+ else
+ time="${time}${seconds} seconds"
+ fi
+ fi
+
+ (notify \
+"The system ${NODENAME} will be shut down in ${time}
+$*") &
+
+pid1=$!
+
+ rm $nologin >/dev/null 2>&1
+ cat > $nologin <<-!
+
+ NO LOGINS: System going down in ${time}
+ $*
+
+ !
+
+ /usr/bin/sleep `/usr/bin/expr ${grace} - $i`
+ grace=$i
+ fi
+done
+
+# Confirm that we really want to shutdown.
+
+if [ ${askconfirmation} ]
+then
+ echo "Do you want to continue? (y or n): \c"
+ read b
+ if [ "$b" != "y" ]
+ then
+ notify "False Alarm: The system ${NODENAME} will not be brought down."
+ echo 'Shutdown aborted.'
+ rm $nologin >/dev/null 2>&1
+ exit 1
+ fi
+fi
+
+# Final shutdown message, and sleep away the final 10 seconds (or less).
+
+(notify \
+"THE SYSTEM ${NODENAME} IS BEING SHUT DOWN NOW ! ! !
+Log off now or risk your files being damaged
+$*") &
+
+pid2=$!
+
+if [ ${grace} -gt 0 ]
+then
+ /usr/bin/sleep ${grace}
+fi
+
+# Go to the requested initstate.
+
+
+echo "Changing to init state $initstate - please wait"
+
+if [ "$pid1" ] || [ "$pid2" ]
+then
+ /usr/bin/kill $pid1 $pid2 > /dev/null 2>&1
+fi
+
+/sbin/init ${initstate}
diff --git a/usr/src/cmd/initpkg/swapadd.sh b/usr/src/cmd/initpkg/swapadd.sh
new file mode 100644
index 0000000000..f1bbe14602
--- /dev/null
+++ b/usr/src/cmd/initpkg/swapadd.sh
@@ -0,0 +1,146 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 1991, 1998-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
+# All rights reserved.
+#
+#
+#ident "%Z%%M% %I% %E% SMI"
+
+PATH=/usr/sbin:/usr/bin; export PATH
+USAGE="Usage: swapadd [-12] [file_system_table]"
+
+VFSTAB=/etc/vfstab # Default file system table
+PASS=2 # Default to checking for existing swap
+
+#
+# Check to see if there is an entry in the fstab for a specified file and
+# mount it. This allows swap files (e.g. nfs files) to be mounted before
+# being added for swap.
+#
+checkmount()
+{
+ while read rspecial rfsckdev rmountp rfstype rfsckpass rautomnt rmntopts
+ do
+ #
+ # Ignore comments, empty lines, and no-action lines
+ #
+ case "$rspecial" in
+ '#'* | '' | '-') continue ;;
+ esac
+
+ if [ "x$rmountp" = "x$1" ]; then
+ #
+ # If mount options are '-', default to 'rw'
+ #
+ [ "x$rmntopts" = x- ] && rmntopts=rw
+
+ if /sbin/mount -m -o $rmntopts $rspecial \
+ >/dev/null 2>&1; then
+ echo "Mounting $rmountp for swap"
+ else
+ echo "Mount of $rmountp for swap failed"
+ fi
+ return
+ fi
+ done <$VFSTAB
+}
+
+die()
+{
+ echo "$*" >& 2
+ exit 1
+}
+
+while getopts 12 opt; do
+ case "$opt" in
+ 1|2) PASS=$opt ;;
+ \?) die "$USAGE" ;;
+ esac
+done
+shift `expr $OPTIND - 1`
+
+[ $# -gt 1 ] && die "$USAGE"
+[ $# -gt 0 ] && VFSTAB="$1"
+
+#
+# If $VFSTAB is not "-" (stdin), re-open stdin as the specified file
+#
+if [ "x$VFSTAB" != x- ]; then
+ [ -s "$VFSTAB" ] || die "swapadd: file system table ($VFSTAB) not found"
+ exec <$VFSTAB
+fi
+
+#
+# Read the file system table to find entries of file system type "swap".
+# Add the swap device or file specified in the first column.
+#
+while read special t1 t2 fstype t3 t4 t5; do
+ #
+ # Ignore comments, empty lines, and no-action lines
+ #
+ case "$special" in
+ '#'* | '' | '-') continue ;;
+ esac
+
+ #
+ # Ignore non-swap fstypes
+ #
+ [ "$fstype" != swap ] && continue
+
+ if [ $PASS = 1 ]; then
+ #
+ # Pass 1 should handle adding the swap files that
+ # are accessable immediately; block devices, files
+ # in / and /usr, and direct nfs mounted files.
+ #
+ if [ ! -b $special ]; then
+ #
+ # Read the file system table searching for mountpoints
+ # matching the swap file about to be added.
+ #
+ # NB: This won't work correctly if the file to added
+ # for swapping is a sub-directory of the mountpoint.
+ # e.g. swapfile-> servername:/export/swap/clientname
+ # mountpoint-> servername:/export/swap
+ #
+ checkmount $special
+ fi
+ if [ -f $special -a -w $special -o -b $special ]; then
+ swap -$PASS -a $special >/dev/null
+ fi
+ else
+ #
+ # Pass 2 should skip all the swap already added. If something
+ # added earlier uses the same name as something to be added
+ # later, the following test won't work. This should only happen
+ # if parts of a particular swap file are added or deleted by
+ # hand between invocations.
+ #
+ swap -l 2>/dev/null | grep '\<'${special}'\>' >/dev/null 2>&1 \
+ || swap -$PASS -a $special >/dev/null
+ fi
+done
diff --git a/usr/src/cmd/initpkg/umountall.sh b/usr/src/cmd/initpkg/umountall.sh
new file mode 100644
index 0000000000..fadc3af2a6
--- /dev/null
+++ b/usr/src/cmd/initpkg/umountall.sh
@@ -0,0 +1,331 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
+# All Rights Reserved
+#
+#
+
+usage () {
+ if [ -n "$1" ]; then
+ echo "umountall: $1" 1>&2
+ fi
+ echo "Usage:\n\tumountall [-k] [-s] [-F FSType] [-l|-r] [-n]" 1>&2
+ echo "\tumountall [-k] [-s] [-h host] [-n]" 1>&2
+ exit 2
+}
+
+MNTTAB=/etc/mnttab
+
+# This script is installed as both /sbin/umountall (as used in some
+# /sbin/rc? and /etc/init.d scripts) _and_ as /usr/sbin/umountall (typically
+# PATHed from the command line). As such it should not depend on /usr
+# being mounted (if /usr is a separate filesystem).
+#
+# /sbin/sh Bourne shell builtins we use:
+# echo
+# exit
+# getopts
+# test, [ ]
+# exec
+# read
+#
+# /sbin commands we use:
+# /sbin/uname
+# /sbin/umount
+#
+# The following /usr based commands may be used by this script (depending on
+# command line options). We will set our PATH to find them, but where they
+# are not present (eg, if /usr is not mounted) we will catch references to
+# them via shell functions conditionally defined after option processing
+# (don't use any of these commands before then).
+#
+# Command Command line option and use
+# /usr/bin/sleep -k, to sleep after an fuser -c -k on the mountpoint
+# /usr/sbin/fuser -k, to kill processes keeping a mount point busy
+#
+# In addition, we use /usr/bin/tail if it is available; if not we use
+# slower shell constructs to reverse a file.
+
+PATH=/sbin:/usr/sbin:/usr/bin
+
+# Clear these in case they were already set in our inherited environment.
+FSType=
+FFLAG=
+HOST=
+HFLAG=
+RFLAG=
+LFLAG=
+SFLAG=
+KFLAG=
+NFLAG=
+LOCALNAME=
+UMOUNTFLAG=
+
+
+while getopts ?rslkF:h:n c
+do
+ case $c in
+ r) RFLAG="r";;
+ l) LFLAG="l";;
+ s) SFLAG="s";;
+ k) KFLAG="k";;
+ h) if [ -n "$HFLAG" ]; then
+ usage "more than one host specified"
+ fi
+ HOST=$OPTARG
+ HFLAG="h"
+ LOCALNAME=`uname -n`
+ ;;
+ F) if [ -n "$FFLAG" ]; then
+ usage "more than one FStype specified"
+ fi
+ FSType=$OPTARG
+ FFLAG="f"
+ case $FSType in
+ ?????????*)
+ usage "FSType ${FSType} exceeds 8 characters"
+ esac;
+ ;;
+ n) NFLAG="n"
+ # Alias any commands that would perform real actions to
+ # something that tells what action would have been performed
+ UMOUNTFLAG="-V"
+ fuser () {
+ echo "fuser $*" 1>&2
+ }
+ sleep () {
+ : # No need to show where we'd sleep
+ }
+ ;;
+ \?) usage ""
+ ;;
+ esac
+done
+
+# Sanity checking:
+# 1) arguments beyond those supported
+# 2) can't specify both remote and local
+# 3) can't specify a host with -r or -l
+# 4) can't specify a fstype with -h
+# 5) can't specify this host with -h (checks only uname -n)
+# 6) can't be fstype nfs and local
+# 7) only fstype nfs is remote
+
+if [ $# -ge $OPTIND ]; then # 1
+ usage "additional arguments not supported"
+fi
+
+if [ -n "$RFLAG" -a -n "$LFLAG" ]; then # 2
+ usage "options -r and -l are incompatible"
+fi
+
+if [ \( -n "$RFLAG" -o -n "$LFLAG" \) -a "$HFLAG" = "h" ]; then # 3
+ usage "option -${RFLAG}${LFLAG} incompatible with -h option"
+fi
+
+if [ -n "$FFLAG" -a "$HFLAG" = "h" ]; then # 4
+ usage "Specifying FStype incompatible with -h option"
+fi
+
+if [ -n "$HFLAG" -a "$HOST" = "$LOCALNAME" ]; then # 5
+ usage "Specifying local host illegal for -h option"
+fi
+
+if [ "$FSType" = "nfs" -a "$LFLAG" = "l" ]; then # 6
+ usage "option -l and FSType nfs are incompatible"
+fi
+
+if [ -n "$FFLAG" -a "$FSType" != "nfs" -a -n "$RFLAG" ]; then # 7
+ usage "option -r and FSType ${FSType} are incompatible"
+fi
+
+ZONENAME=`zonename`
+
+#
+# Take advantage of parallel unmounting at this point if we have no
+# criteria to match and we are in the global zone
+#
+if [ -z "${SFLAG}${LFLAG}${RFLAG}${HFLAG}${KFLAG}${FFLAG}" -a \
+ "$ZONENAME" = "global" ]; then
+ umount -a ${UMOUNTFLAG}
+ exit # with return code of the umount -a
+fi
+
+#
+# Catch uses of /usr commands when /usr is not mounted
+if [ -n "$KFLAG" -a -z "$NFLAG" ]; then
+ if [ ! -x /usr/sbin/fuser ]; then
+ fuser () {
+ echo "umountall: fuser -k skipped (no /usr)" 1>&2
+ # continue - not fatal
+ }
+ sleep () {
+ : # no point in sleeping if fuser is doing nothing
+ }
+ else
+ if [ ! -x /usr/bin/sleep ]; then
+ sleep () {
+ echo "umountall: sleep after fuser -k skipped (no /usr)" 1>&2
+ # continue - not fatal
+ }
+ fi
+ fi
+fi
+
+#
+# Shell function to avoid using /usr/bin/cut. Given a dev from a
+# fstype=nfs line in mnttab (eg, "host:/export) extract the host
+# component.
+print_host () {
+ OIFS=$IFS
+ IFS=":"
+ set -- $*
+ echo $1
+ IFS=$OIFS
+}
+
+#
+# doumounts echos its return code to stdout, so commands used within
+# this function should take care to produce no other output to stdout.
+doumounts () {
+ (
+ rc=0
+ fslist=""
+ while read dev mountp fstype mode dummy
+ do
+ case "${mountp}" in
+ / | \
+ /dev | \
+ /dev/fd | \
+ /devices | \
+ /etc/mnttab | \
+ /etc/svc/volatile | \
+ /lib | \
+ /proc | \
+ /sbin | \
+ /system/contract | \
+ /system/object | \
+ /tmp | \
+ /usr | \
+ /var | \
+ /var/adm | \
+ /var/run | \
+ '' )
+ #
+ # file systems possibly mounted in the kernel or
+ # in the methods of some of the file system
+ # services
+ #
+ continue
+ ;;
+ * )
+ if [ -n "$HFLAG" ]; then
+ if [ "$fstype" = "nfs" ]; then
+ thishost=`print_host $dev`
+ if [ "$HOST" != "$thishost" ]; then
+ continue
+ fi
+ else
+ continue
+ fi
+ fi
+ if [ -n "$FFLAG" -a "$FSType" != "$fstype" ]; then
+ continue
+ fi
+ if [ -n "$LFLAG" -a "$fstype" = "nfs" ]; then
+ continue
+ fi
+ if [ -n "$RFLAG" -a "$fstype" != "nfs" ]; then
+ continue
+ fi
+ if [ "$ZONENAME" != "global" ]; then
+ for option in `echo $mode | tr , '\012'`; do
+ #
+ # should not see any zone options
+ # but our own
+ #
+ if [ "$option" = "zone=$ZONENAME" ]; then
+ break
+ fi
+ done
+ if [ "$option" != "zone=$ZONENAME" ]; then
+ continue
+ fi
+ fi
+ if [ -n "${KFLAG}" ]; then
+ fuser -c -k $mountp 1>&2
+ sleep 2
+ fi
+ if [ -n "$SFLAG" ]; then
+ umount ${UMOUNTFLAG} ${mountp} 1>&2
+ trc=$?
+ if [ $trc -ne 0 ]; then
+ rc=$trc
+ fi
+ else
+ # We want to umount in parallel
+ fslist="$fslist $mountp"
+ fi
+ esac
+ done
+
+ if [ -n "$fslist" ]; then
+ umount -a ${UMOUNTFLAG} $fslist 1>&2
+ trc=$?
+ if [ $trc -ne 0 ]; then
+ rc=$trc
+ fi
+ fi
+
+ echo $rc
+ )
+}
+
+#
+# /etc/mnttab has the most recent mounts last. Reverse it so that we
+# may umount in opposite order to the original mounts.
+#
+
+if [ ! -x /usr/bin/tail ]; then
+ exec < $MNTTAB
+ REVERSED=
+ while read line; do
+ if [ -n "$REVERSED" ]; then
+ REVERSED="$line\n$REVERSED"
+ else
+ REVERSED="$line"
+ fi
+ done
+
+ error=`echo $REVERSED | doumounts`
+else
+ error=`tail -r $MNTTAB | doumounts`
+fi
+
+exit $error
diff --git a/usr/src/cmd/initpkg/vfstab.sh b/usr/src/cmd/initpkg/vfstab.sh
new file mode 100644
index 0000000000..af8fc8deca
--- /dev/null
+++ b/usr/src/cmd/initpkg/vfstab.sh
@@ -0,0 +1,43 @@
+#!/sbin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
+# All Rights Reserved
+
+#
+
+echo "#device device mount FS fsck mount mount
+#to mount to fsck point type pass at boot options
+#
+/devices - /devices devfs - no -
+/proc - /proc proc - no -
+ctfs - /system/contract ctfs - no -
+objfs - /system/object objfs - no -
+fd - /dev/fd fd - no -
+swap - /tmp tmpfs - yes -
+">vfstab