#
# 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
# 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 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# SVM Flash cleanup
# Remove existing master SVM configuration on clone after full flash install.
# Restore existing clone SVM configuation after differential flash install.
#
# Directory where original clone config is saved.
if [ "${FLASH_TYPE}" = "FULL" ]; then
# Full flash install, remove master's SVM configuration from clone.
nawk '
BEGIN {delroot=0}
/^\* Begin MDD root info \(do not edit\)$/ {delroot=1}
/^\* End MDD root info \(do not edit\)$/ {delroot=0; next}
{if (delroot == 0) print $0}
# Check if we are on the mini-root. If we are, we need to clean up the
# mddb configuration since this implies we are doing a full flash onto
# a fresh system.
#
# If we are not on the mini-root that must mean we are installing
# the full flash via live-upgrade. In that case we share the
# SVM configuration with the currently running system so we
# need to copy the md.conf file from the current root onto the
# newly installed root. Note that the flash archive might not have
# been created from the currently running system.
nawk '
BEGIN {delmddb=0}
/^# Begin MDD database info \(do not edit\)$/ {delmddb=1}
/^# End MDD database info \(do not edit\)$/ {delmddb=0; next}
{if (delmddb == 0) print $0}
nawk '
/^#/ {print $0}
else
# copy SVM config from current root to new root
fi
# We may need to enable the SVM services in SMF. This could happen
# if we used jumpstart or live-upgrade to create SVM volumes as
# part of the flash install.
#
# It doesn't matter if we are doing a flash install via a jumpstart
# on the mini-root or via a live-upgrade. In both cases we check
# the md.conf on the currently running root to see if SVM is
# configured. For the jumpstart case it will have setup the
# volumes already so the mini-root md.conf has the mddb info. For
# the live-upgade case both roots will be sharing the same md.conf
# and have the same view of the SVM configuration.
#
# Check if there are mddb entries in md.conf to determine if SVM is
# configured.
MDDB_STATUS=$?
fi
else
# Differential flash install, restore clone SVM configuration.
#
# master clone clone after differential flash
#
# yes yes same as clone prior to diff. flash
# yes no no
# no yes same as clone prior to diff. flash
# no no no
#
# restore saved config files
# Now process the various permutations for the master and clone
# There is no difference so leave it alone.
exit 0;
fi
BEGIN {inroot=0}
/^\* Begin MDD root info \(do not edit\)$/ {inroot=1; next}
/^\* End MDD root info \(do not edit\)$/ {inroot=0}
{if (inroot == 1) print $0}
' ${IN_SYS}`
BEGIN {inroot=0}
/^\* Begin MDD root info \(do not edit\)$/ {inroot=1; next}
/^\* End MDD root info \(do not edit\)$/ {inroot=0}
{if (inroot == 1) print $0}
if [ "${MASTER_ROOT}" ]; then
if [ "${CLONE_ROOT}" ]; then
BEGIN {newroot=0}
/^\* Begin MDD root info \(do not edit\)$/ {
newroot=1
print $0
print clone_root
}
/^\* End MDD root info \(do not edit\)$/ {newroot=0}
{if (newroot == 0) print $0}
else
# There is no SVM root entry in the clone so remove the entry
nawk '
BEGIN {delroot=0}
/^\* Begin MDD root info \(do not edit\)$/ {delroot=1}
/^\* End MDD root info \(do not edit\)$/ {delroot=0; next }
{if (delroot == 0) print $0}
fi
else
if [ "${CLONE_ROOT}" ]; then
# But clone does have one so we need to add it back in.
echo "* Begin MDD root info (do not edit)" >> ${IN_SYS}
echo "${CLONE_ROOT}" >> ${IN_SYS}
echo "* End MDD root info (do not edit)" >> ${IN_SYS}
fi
# If neither master nor clone has SVM root entry then
# we just leave the system file alone.
fi
fi
exit 0