postinstall revision 4496171313bed39e96f21bc2f9faf2868e267ae3
70N/A#! /bin/sh
70N/A#
286N/A# CDDL HEADER START
70N/A#
70N/A# The contents of this file are subject to the terms of the
70N/A# Common Development and Distribution License (the "License").
70N/A# You may not use this file except in compliance with the License.
70N/A#
70N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
70N/A# or http://www.opensolaris.org/os/licensing.
70N/A# See the License for the specific language governing permissions
70N/A# and limitations under the License.
70N/A#
70N/A# When distributing Covered Code, include this CDDL HEADER in each
70N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
70N/A# If applicable, add the following below this CDDL HEADER, with the
70N/A# fields enclosed by brackets "[]" replaced with your own identifying
70N/A# information: Portions Copyright [yyyy] [name of copyright owner]
70N/A#
70N/A# CDDL HEADER END
70N/A#
70N/A
70N/A#
70N/A# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
70N/A# Use is subject to license terms.
70N/A#
70N/A# ident "%Z%%M% %I% %E% SMI"
70N/A#
70N/A
70N/A#
359N/A# install the UltraSPARC-T2 Crypto Provider device driver
70N/A#
70N/A
70N/APATH="/usr/bin:/usr/sbin:${PATH}"
359N/Aexport PATH
359N/A
359N/A# Add hardware provider section for the n2cp driver
98N/A# to /etc/crypto/kcf.conf
321N/A
321N/Apkg_start="# Start $PKGINST"
213N/Apkg_end="# End $PKGINST"
304N/Akcfconf=${BASEDIR}/etc/crypto/kcf.conf
325N/Atmpfile=/tmp/$$kcfconf
320N/Aerror=no
332N/A
231N/A#
98N/A# If /etc/crypto/kcf.conf doesn't exist, bail immediately
347N/A#
346N/Aif [ ! -f "$kcfconf" ]
324N/Athen
347N/A echo "$0: ERROR - $kcfconf doesn't exist"
310N/A exit 2
316N/Afi
290N/A
332N/A#
332N/A# If the package has been already installed, remove old entries
332N/A#
210N/Astart=0
128N/Aend=0
326N/Aegrep -s "$pkg_start" $kcfconf && start=1
335N/Aegrep -s "$pkg_end" $kcfconf && end=1
70N/A
294N/Aif [ $start -ne $end ] ; then
98N/A echo "$0: missing Start or End delimiters for $PKGINST in $kcfconf."
277N/A echo "$0: $kcfconf may be corrupted and was not updated."
356N/A error=yes
289N/A exit 2
326N/Afi
290N/A
286N/Aif [ $start -eq 1 ]
90N/Athen
295N/A cp -p $kcfconf $tmpfile || error=yes
70N/A sed -e "/$pkg_start/,/$pkg_end/d" $kcfconf > $tmpfile || error=yes
299N/Aelse
262N/A cp -p $kcfconf $tmpfile || error=yes
277N/Afi
332N/A
332N/A#
70N/A# Append the delimiters for this package
70N/A#
319N/Aecho "$pkg_start driver_names=n2cp" >> $tmpfile || error=yes
280N/Aecho "$pkg_end" >> $tmpfile || error=yes
319N/A
359N/A#
359N/A# Install the updated config file and clean up the tmp file
70N/A#
98N/Aif [ "$error" = no ]
98N/Athen
231N/A mv $tmpfile $kcfconf || error=yes
98N/Afi
156N/Arm -f $tmpfile
156N/A
98N/A#
70N/A# All done, if any of the steps above fail, report the error
70N/A#
70N/Aif [ "$error" = yes ]
70N/Athen
70N/A echo "$0: ERROR - failed to update $kcfconf."
70N/A exit 2
70N/Afi
70N/A
70N/ANAMEMAJOR="${BASEDIR}/etc/name_to_major"
70N/A
70N/Aif [ "${BASEDIR:=/}" = "/" ]
70N/Athen
70N/A ADD_DRV="/usr/sbin/add_drv"
70N/Aelse
70N/A ADD_DRV="/usr/sbin/add_drv -b ${BASEDIR}"
70N/Afi
70N/A
70N/Agrep -w n2cp ${NAMEMAJOR} > /dev/null 2>&1
253N/Aif [ $? -ne 0 ]
70N/Athen
70N/A $ADD_DRV -i "SUNW,n2-cwq" n2cp || exit 1
fi
exit 0