postinstall revision 4496171313bed39e96f21bc2f9faf2868e267ae3
649N/A#
649N/A# CDDL HEADER START
649N/A#
649N/A# The contents of this file are subject to the terms of the
649N/A# Common Development and Distribution License (the "License").
649N/A# You may not use this file except in compliance with the License.
649N/A#
649N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
649N/A# or http://www.opensolaris.org/os/licensing.
649N/A# See the License for the specific language governing permissions
649N/A# and limitations under the License.
649N/A#
649N/A# When distributing Covered Code, include this CDDL HEADER in each
649N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
649N/A# If applicable, add the following below this CDDL HEADER, with the
649N/A# fields enclosed by brackets "[]" replaced with your own identifying
649N/A# information: Portions Copyright [yyyy] [name of copyright owner]
649N/A#
649N/A# CDDL HEADER END
649N/A#
649N/A#
649N/A# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
649N/A# Use is subject to license terms.
649N/A#
649N/A# ident "%Z%%M% %I% %E% SMI"
919N/A#
1459N/A# Postinstall script for SUNWcryptoint.
919N/A#
919N/A# This script appends a hardware provider section for the dprov
919N/A# test driver to /etc/crypto/kcf.conf
919N/A#
919N/A
919N/Apkg_start="# Start $PKGINST"
919N/Apkg_end="# End $PKGINST"
919N/Akcfconf=${BASEDIR}/etc/crypto/kcf.conf
919N/Atmpfile=/tmp/$$kcfconf
919N/Aerror=no
919N/A
919N/A#
919N/A# If /etc/crypto/kcf.conf doesn't exist, bail immediately
919N/A#
919N/Aif [ ! -f "$kcfconf" ]
919N/Athen
919N/A echo "$0: ERROR - $kcfconf doesn't exist"
919N/A exit 2
919N/Afi
919N/A
919N/A#
919N/A# If the package has been already installed, remove old entries
649N/A#
649N/Astart=0
649N/Aend=0
649N/Aegrep -s "$pkg_start" $kcfconf && start=1
649N/Aegrep -s "$pkg_end" $kcfconf && end=1
649N/A
649N/Aif [ $start -ne $end ] ; then
649N/A echo "$0: missing Start or End delimiters for $PKGINST in $kcfconf."
649N/A echo "$0: $kcfconf may be corrupted and was not updated."
649N/A error=yes
649N/A exit 2
649N/Afi
649N/A
649N/Aif [ $start -eq 1 ]
649N/Athen
649N/A cp -p $kcfconf $tmpfile || error=yes
649N/A sed -e "/$pkg_start/,/$pkg_end/d" $kcfconf > $tmpfile || error=yes
765N/Aelse
649N/A cp -p $kcfconf $tmpfile || error=yes
649N/Afi
649N/A
649N/A#
649N/A# Append the delimiters for this package
649N/A#
649N/Aecho "$pkg_start driver_names=dprov" >> $tmpfile || error=yes
649N/Aecho "$pkg_end" >> $tmpfile || error=yes
649N/A
649N/A#
649N/A# Install the updated config file and clean up the tmp file
649N/A#
1323N/Aif [ "$error" = no ]
649N/Athen
649N/A mv $tmpfile $kcfconf || error=yes
649N/Afi
649N/Arm -f $tmpfile
649N/A
649N/A#
765N/A# All done, if any of the steps above fail, report the error
765N/A#
649N/Aif [ "$error" = yes ]
649N/Athen
649N/A echo "$0: ERROR - failed to update $kcfconf."
649N/A exit 2
649N/Afi
649N/Aexit 0
649N/A