postinstall revision 4496171313bed39e96f21bc2f9faf2868e267ae3
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews#! /bin/sh
205c10066a0acfeac52d1a135671f41d207b8557Automatic Updater#
205c10066a0acfeac52d1a135671f41d207b8557Automatic Updater# CDDL HEADER START
1167fc7904c5f0a472f8df207ac46dd52c7f1ec8Automatic Updater#
0c39b3ed9409ecb277d5e32fa763a4e4d6598df8Automatic Updater# The contents of this file are subject to the terms of the
46da3117812814a29432a8d9a9ccf8acdbfdadceAutomatic Updater# Common Development and Distribution License (the "License").
2bb3422dc683c013db7042f5736240de6b86f182Automatic Updater# You may not use this file except in compliance with the License.
cd0aa2d941d1438fabb5337f1f38c49478edf71dAutomatic Updater#
2ec4ab21838e218863d052ebfa3e106e04f50820Evan Hunt# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
ea854b585041ad19f70f7af15e08144ef2c2bd1bMark Andrews# or http://www.opensolaris.org/os/licensing.
78cb74fab4665da2e2641ba909c6f59f74cc4193Automatic Updater# See the License for the specific language governing permissions
cd0aa2d941d1438fabb5337f1f38c49478edf71dAutomatic Updater# and limitations under the License.
90ff38a0d8deaf5f9c2aa5916d99b2e572d28738Automatic Updater#
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# When distributing Covered Code, include this CDDL HEADER in each
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
6c6a121295b30772cbf3dd75a51fb9d883051a0eAutomatic Updater# If applicable, add the following below this CDDL HEADER, with the
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# fields enclosed by brackets "[]" replaced with your own identifying
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updater# information: Portions Copyright [yyyy] [name of copyright owner]
bc0a53583d92309bebcf93c408e2f3247ebd3d3cAutomatic Updater#
56874aef380a64a2c183b7c282c3e7a361d67fa1Automatic Updater# CDDL HEADER END
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews#
58be84825d7f5de30e50eb7206b37227ecd8055bAutomatic Updater
3cc98b8ecedcbc8465f1cf2740b966b315662430Automatic Updater#
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Use is subject to license terms.
96713299d08c0735c18ebe8772dd2cc1ecd4356aAutomatic Updater#
831f79c4310a7d38fc3475ccfff531b2b2535641Automatic Updater# ident "%Z%%M% %I% %E% SMI"
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews#
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews#
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater# install the UltraSPARC-T2 Crypto Provider device driver
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson#
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic UpdaterPATH="/usr/bin:/usr/sbin:${PATH}"
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafssonexport PATH
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# Add hardware provider section for the n2cp driver
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# to /etc/crypto/kcf.conf
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterpkg_start="# Start $PKGINST"
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterpkg_end="# End $PKGINST"
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Huntkcfconf=${BASEDIR}/etc/crypto/kcf.conf
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updatertmpfile=/tmp/$$kcfconf
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updatererror=no
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt#
2d2dc37599979c83495510f8af8d1756753aa2c5Automatic Updater# If /etc/crypto/kcf.conf doesn't exist, bail immediately
2d2dc37599979c83495510f8af8d1756753aa2c5Automatic Updater#
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Huntif [ ! -f "$kcfconf" ]
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterthen
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater echo "$0: ERROR - $kcfconf doesn't exist"
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater exit 2
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterfi
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater#
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater# If the package has been already installed, remove old entries
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater#
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterstart=0
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterend=0
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updateregrep -s "$pkg_start" $kcfconf && start=1
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrewsegrep -s "$pkg_end" $kcfconf && end=1
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrews
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrewsif [ $start -ne $end ] ; then
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington echo "$0: missing Start or End delimiters for $PKGINST in $kcfconf."
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updater echo "$0: $kcfconf may be corrupted and was not updated."
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews error=yes
129090f0f6f91753b4a085ab635e28549fd018adAutomatic Updater exit 2
129090f0f6f91753b4a085ab635e28549fd018adAutomatic Updaterfi
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updaterif [ $start -eq 1 ]
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsthen
db5b7e2cdf150c46e8242d3e2e3ad3f5c7300258Automatic Updater cp -p $kcfconf $tmpfile || error=yes
80faf1588895fd26490f82f95a7a1b771df1c324Automatic Updater sed -e "/$pkg_start/,/$pkg_end/d" $kcfconf > $tmpfile || error=yes
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewselse
1a06700908f5a1d9f4a8d51285a0fd971e2f9117Automatic Updater cp -p $kcfconf $tmpfile || error=yes
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsfi
db5b7e2cdf150c46e8242d3e2e3ad3f5c7300258Automatic Updater
693c4232dfdffaff672197d4b9fea944c64cf80aAutomatic Updater#
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Append the delimiters for this package
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater#
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafssonecho "$pkg_start driver_names=n2cp" >> $tmpfile || error=yes
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updaterecho "$pkg_end" >> $tmpfile || error=yes
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews#
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater# Install the updated config file and clean up the tmp file
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson#
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updaterif [ "$error" = no ]
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updaterthen
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson mv $tmpfile $kcfconf || error=yes
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updaterfi
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updaterrm -f $tmpfile
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updater#
b1265b5a06df36d490d4bdf54284fb133a1f5a84Automatic Updater# All done, if any of the steps above fail, report the error
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updater#
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updaterif [ "$error" = yes ]
2a31bd531072824ef252c18303859d6af7451b00Francis Dupontthen
0c39b3ed9409ecb277d5e32fa763a4e4d6598df8Automatic Updater echo "$0: ERROR - failed to update $kcfconf."
0c39b3ed9409ecb277d5e32fa763a4e4d6598df8Automatic Updater exit 2
2a31bd531072824ef252c18303859d6af7451b00Francis Dupontfi
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews
f9119ad8f6114b2255e7545bf5cd187f4db0a89bAutomatic UpdaterNAMEMAJOR="${BASEDIR}/etc/name_to_major"
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updater
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsif [ "${BASEDIR:=/}" = "/" ]
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updaterthen
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater ADD_DRV="/usr/sbin/add_drv"
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updaterelse
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater ADD_DRV="/usr/sbin/add_drv -b ${BASEDIR}"
995eaa289ba9709c64ef89b3776e53c36adc0010Automatic Updaterfi
b29e5c56eb74a6de1a84c29879afc90ffc6b1436Automatic Updater
418cc932318b1d67f88a36904d88d8a5a0a2ba09Automatic Updatergrep -w n2cp ${NAMEMAJOR} > /dev/null 2>&1
995eaa289ba9709c64ef89b3776e53c36adc0010Automatic Updaterif [ $? -ne 0 ]
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsthen
0977f3f39ef6728516be7976452b9122c8f5607aAutomatic Updater $ADD_DRV -i "SUNW,n2-cwq" n2cp || exit 1
ae7e54b14c946e0984c191554db9abb4893f9349Automatic Updaterfi
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews
0c39b3ed9409ecb277d5e32fa763a4e4d6598df8Automatic Updaterexit 0
0c39b3ed9409ecb277d5e32fa763a4e4d6598df8Automatic Updater