1*5626Shylee# 2*5626Shylee# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 3*5626Shylee# Use is subject to license terms. 4*5626Shylee# 5*5626Shylee# CDDL HEADER START 6*5626Shylee# 7*5626Shylee# The contents of this file are subject to the terms of the 8*5626Shylee# Common Development and Distribution License (the "License"). 9*5626Shylee# You may not use this file except in compliance with the License. 10*5626Shylee# 11*5626Shylee# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 12*5626Shylee# or http://www.opensolaris.org/os/licensing. 13*5626Shylee# See the License for the specific language governing permissions 14*5626Shylee# and limitations under the License. 15*5626Shylee# 16*5626Shylee# When distributing Covered Code, include this CDDL HEADER in each 17*5626Shylee# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 18*5626Shylee# If applicable, add the following below this CDDL HEADER, with the 19*5626Shylee# fields enclosed by brackets "[]" replaced with your own identifying 20*5626Shylee# information: Portions Copyright [yyyy] [name of copyright owner] 21*5626Shylee# 22*5626Shylee# CDDL HEADER END 23*5626Shylee# 24*5626Shylee# ident "%Z%%M% %I% %E% SMI" 25*5626Shylee# 26*5626Shylee# Removal class action script for "kmfconf" class files. 27*5626Shylee# 28*5626Shylee# This script removes entries belonging to the package from the 29*5626Shylee# /etc/crypto/kmf.conf file. 30*5626Shylee# 31*5626Shylee 32*5626Shyleepkg_start="# Start $PKGINST" 33*5626Shyleepkg_end="# End $PKGINST" 34*5626Shyleetmpfile=/tmp/$$kmfconf 35*5626Shyleeerror=no 36*5626Shylee 37*5626Shyleewhile read dest 38*5626Shyleedo 39*5626Shylee # For multiple input files; exit if error occurred in preious 40*5626Shylee # input file. 41*5626Shylee if [ "$error" = yes ] 42*5626Shylee then 43*5626Shylee echo "$0: failed to update $lastdest for $PKGINST." 44*5626Shylee exit 2 45*5626Shylee fi 46*5626Shylee lastdest=$dest 47*5626Shylee 48*5626Shylee # Strip all entries belonging to this package 49*5626Shylee start=0 50*5626Shylee end=0 51*5626Shylee egrep -s "$pkg_start" $dest && start=1 52*5626Shylee egrep -s "$pkg_end" $dest && end=1 53*5626Shylee 54*5626Shylee if [ $start -ne $end ] ; then 55*5626Shylee echo "$0: missing Start or End delimiters for $PKGINST in \ 56*5626Shylee $dest." 57*5626Shylee echo "$0: $dest may be corrupted and was not updated." 58*5626Shylee error=yes 59*5626Shylee continue 60*5626Shylee fi 61*5626Shylee 62*5626Shylee if [ $start -eq 1 ] 63*5626Shylee then 64*5626Shylee sed -e "/$pkg_start/,/$pkg_end/d" $dest > $tmpfile || error=yes 65*5626Shylee if [ "$error" = no ] 66*5626Shylee then 67*5626Shylee mv $tmpfile $dest || error=yes 68*5626Shylee fi 69*5626Shylee rm -f $tmpfile 70*5626Shylee else 71*5626Shylee echo "$0: WARNING - no entries found in $dest for $PKGINST." 72*5626Shylee exit 0 73*5626Shylee fi 74*5626Shyleedone 75*5626Shylee 76*5626Shyleeif [ "$error" = yes ] 77*5626Shyleethen 78*5626Shylee echo "$0: ERROR - failed to update $lastdest for $PKGINST." 79*5626Shylee exit 2 80*5626Shyleefi 81*5626Shyleeexit 0 82