xref: /titanic_52/usr/src/cmd/cmd-inet/usr.sadm/scripts/r.ipsecalgs (revision 0eb822a1c0c2bea495647510b75f77f0e57633eb)
1#
2# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3# Use is subject to license terms.
4#
5# CDDL HEADER START
6#
7# The contents of this file are subject to the terms of the
8# Common Development and Distribution License, Version 1.0 only
9# (the "License").  You may not use this file except in compliance
10# with the License.
11#
12# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13# or http://www.opensolaris.org/os/licensing.
14# See the License for the specific language governing permissions
15# and limitations under the License.
16#
17# When distributing Covered Code, include this CDDL HEADER in each
18# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19# If applicable, add the following below this CDDL HEADER, with the
20# fields enclosed by brackets "[]" replaced with your own identifying
21# information: Portions Copyright [yyyy] [name of copyright owner]
22#
23# CDDL HEADER END
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27# Removal class action script for ipsecalgs class files.
28#
29# This script removes entries belonging to the package from the
30# /etc/inet/ipsecalgs file.
31#
32
33pkg_start="# Start $PKGINST"
34pkg_end="# End $PKGINST"
35confile=/etc/inet/ipsecalgs
36tmpfile=/tmp/$$ipsecalgs
37error=no
38
39while read dest
40do
41	# Strip all entries belonging to this package
42	grep "$pkg_start" $dest > /dev/null
43	if [ $? -eq 0 ]
44    	then
45		sed -e "/$pkg_start/,/$pkg_end/d" $dest > $tmpfile || error=yes
46		if [ "$error" = no ]
47                then
48			mv $tmpfile $dest || error=yes
49		fi
50		rm -f $tmpfile
51	else
52		echo "$0: WARNING - no entries to be removed from the $confile  file"
53		exit 0
54	fi
55done
56
57if [ "$error" = yes ]
58then
59	echo "$0: ERROR - failed to update the $confile file."
60	exit 2
61fi
62exit 0
63