usr/src/cmd/slim-install/svc/live-fs-root-minimal
author Karen Tung <Karen.Tung@oracle.com>
Thu, 04 Aug 2011 11:23:50 -0700
changeset 1357 c6b82080c0ba
parent 1001 fa5c7a246a82
permissions -rw-r--r--
7068988 The physical:default fails when booting from Auto Install media, unable to get manifest 7074534 Should remove /usr/sbin/install-finish and mkmenu due to slim_source code clean up of 7053542

#!/sbin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (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) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
#
#
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
# All rights reserved.
#

# Make sure that the libraries essential to this stage of booting can be found.
LD_LIBRARY_PATH=/lib; export LD_LIBRARY_PATH

. /lib/svc/share/smf_include.sh
. /lib/svc/share/fs_include.sh

#
# Remount root RW
#
echo "\rRemounting root read/write" > /dev/msglog
ISA_INFO=`/sbin/uname -p`
if [ $ISA_INFO = "sparc" ]
then
	# ramdisk device is different between SPARC and x86
	RAMDISK=/devices/ramdisk-root:a
else
	# x86 label
	RAMDISK=/devices/ramdisk:a
fi
/sbin/mount -o remount,rw $RAMDISK /

# Remove the SMF repository backup as it is not required in installation and
# just chews up ramdisk space.  RFE 6896186 would remove the need to do this.
/usr/bin/rm -f /etc/svc/repository-boot*

#
# Workaround for devfs lazy init. The sd nodes are not
# created till you try to access them.
#
echo "Probing for device nodes ..." > /dev/msglog
ls -lR /devices/* > /dev/null

# 
# Depending upon how we are booted, make sure that either the 'media' instance
# or the 'net' instance of the filesystem/root-assembly service is enabled.
#
# Disabling 'media' instance has to be synchronous, otherwise there is
# a space for race condition - 'media' service could enter online state
# for a while - after filesystem/root-minimal finishes its job
# and before request for 'disable' is processed by smf(5) framework.
#
if [ $ISA_INFO = "sparc" ]; then
	# check if the wanboot device exists
	BOOTFS_DISK="/devices/ramdisk-bootfs:a"
	if [ -b "$BOOTFS_DISK" ]; then
		# booting off of the net
		/usr/sbin/svcadm enable svc:/system/filesystem/root-assembly:net
		/usr/sbin/svcadm disable -s \
		    svc:/system/filesystem/root-assembly:media
        else
        	# enable automatic network configuration for media booted
                # environments
                /usr/sbin/svccfg apply /etc/svc/profile/network_nwam.xml
	fi
else
	MEDIA=`/sbin/devprop -s install_media`
	if [ ! -z "$MEDIA" ]; then
		/usr/sbin/svcadm enable svc:/system/filesystem/root-assembly:net
		/usr/sbin/svcadm disable -s \
		    svc:/system/filesystem/root-assembly:media
        else
        	# enable automatic network configuration for media booted
                # environments
                /usr/sbin/svccfg apply /etc/svc/profile/network_nwam.xml
	fi
fi

exit $SMF_EXIT_OK