postremove revision 6029a2d88c01674debfd7c2e16c941a97302b739
#
# 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
# 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 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
# Function : deletemegasastargets
# This function is responsible for cleaning up the
# mega_sas related lines from
{
HEADER2="# WARNING : LINES ADDED WITHIN THIS MEGA CONF SECTION"
HEADER3="# WOULD GET DELETED WHEN THE MEGA_SAS DRIVER PACKAGE IS REMOVED"
LINEENDPATTERN="parent=\"mega_sas\""
# Check if $SDCONF file exists
if [ ! -f $SDCONF ]
then
echo "ERROR : $SDCONF File does not exist"
exit 0
fi
slstatus=$?
elstatus=$?
lestatus=$?
# If no startline, endline and no lines that
# match LINEENDPATTERN, return
# If only start or endline or LINEENDPATTERN is
# missing then its corrupted. That time we remove
# all lines which have parent="mega_sas", along with
# start and end lines. The commented lines
# that appear after the start line should also
# be removed
then
echo "mega_sas related lines in $SDCONF file not found"
return 0
then
# Shouldn't come to this section
# In case user corrupts $SDCONF, do a dirty remove
echo "$SDCONF file seems to be corrupted"
echo "Removing lines in $SDCONF relevant to mega_sas"
if [ $? -eq 0 ]
then
else
echo "ERROR while removing mega_sas related lines from $SDCONF"
exit 0
fi
return 0
fi
# Remove the MEGA section from $SDCONF
if ($0 ~ /# MEGA AUTOGENERATED CONFIGURATION : START/) {
start=1;
}
if ( start == 0 ) {
print $0;
}
if ($0 ~ /# MEGA AUTOGENERATED CONFIGURATION : END/) {
start=0;
}
if [ $? -ne 0 ]
then
echo "ERROR : while removing mega_sas related section"
echo " from $SDCONF file."
exit 0
fi
}
then
fi