88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico#
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico# Use is subject to license terms.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico#
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico# CDDL HEADER START
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico#
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico# The contents of this file are subject to the terms of the
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico# Common Development and Distribution License (the "License").
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico# You may not use this file except in compliance with the License.
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico#
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico# or http://www.opensolaris.org/os/licensing.
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico# See the License for the specific language governing permissions
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico# and limitations under the License.
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico#
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico# When distributing Covered Code, include this CDDL HEADER in each
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico# If applicable, add the following below this CDDL HEADER, with the
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico# fields enclosed by brackets "[]" replaced with your own identifying
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico# information: Portions Copyright [yyyy] [name of copyright owner]
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico#
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico# CDDL HEADER END
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico#
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico# ident "%Z%%M% %I% %E% SMI"
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico#
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico# Removal class action script for "kmfconf" class files.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico#
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico# This script removes entries belonging to the package from the
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico# /etc/crypto/kmf.conf file.
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico#
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNicopkg_start="# Start $PKGINST"
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNicopkg_end="# End $PKGINST"
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNicotmpfile=/tmp/$$kmfconf
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNicoerror=no
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNicowhile read dest
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNicodo
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico # For multiple input files; exit if error occurred in preious
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico # input file.
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico if [ "$error" = yes ]
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico then
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico echo "$0: failed to update $lastdest for $PKGINST."
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico exit 2
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico fi
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico lastdest=$dest
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico # Strip all entries belonging to this package
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico start=0
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico end=0
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico egrep -s "$pkg_start" $dest && start=1
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico egrep -s "$pkg_end" $dest && end=1
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico if [ $start -ne $end ] ; then
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico echo "$0: missing Start or End delimiters for $PKGINST in \
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico $dest."
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico echo "$0: $dest may be corrupted and was not updated."
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico error=yes
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico continue
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico fi
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico if [ $start -eq 1 ]
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico then
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico sed -e "/$pkg_start/,/$pkg_end/d" $dest > $tmpfile || error=yes
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico if [ "$error" = no ]
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico then
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico mv $tmpfile $dest || error=yes
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico fi
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico rm -f $tmpfile
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico else
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico echo "$0: WARNING - no entries found in $dest for $PKGINST."
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico exit 0
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico fi
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNicodone
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNicoif [ "$error" = yes ]
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNicothen
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico echo "$0: ERROR - failed to update $lastdest for $PKGINST."
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico exit 2
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNicofi
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNicoexit 0
09d8c881485db7f6fa367e8f60da0f0a12f83ff8JazzyNico