svm.cleanup.sh revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# 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 2004 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}
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
# 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