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