2 # Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 # Use is subject to license terms.
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
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.
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]
25 # ident "%Z%%M% %I% %E% SMI"
27 # Class action script for "pkcs11conf" class files.
29 # This script appends the input file from the package to the
30 # /etc/crypto/pkcs11.conf file.
32 # The syntax of the input file is <file_name>
34 # The file name should contain the full path.
35 # One entry per file name.
37 pkg_start="# Start $PKGINST"
38 pkg_end="# End $PKGINST"
39 tmpfile=/tmp/$$pkcs11conf
44 [ "$src" = /dev/null ] && continue
48 # For multiple input files; exit if error occurred in previous
52 echo "$0: failed to update $lastdest for $PKGINST."
58 # If the package has been already installed, remove old entries
62 egrep -s "$pkg_start" $dest && start=1
63 egrep -s "$pkg_end" $dest && end=1
65 if [ $start -ne $end ]
67 echo "$0: missing Start or End delimiters for \
69 echo "$0: $dest may be corrupted and was not updated."
76 sed -e "/$pkg_start/,/$pkg_end/d" $dest > $tmpfile \
79 cp $dest $tmpfile || error=yes
83 # Check the input file syntax (each line should start with /)
84 # and append the input entries with the package delimiters.
86 line_count=`wc -l $src | awk '{ print $1}'`
87 file_count=`grep "^/" $src | wc -l`
89 if [ $line_count -ne $file_count ]
91 echo "$0: Syntax Error - $src for $PKGINST."
95 echo "$pkg_start" >> $tmpfile || error=yes
96 cat $src >> $tmpfile || error=yes
97 echo "$pkg_end" >> $tmpfile || error=yes
100 # Install the updated config file and clean up the tmp file
103 mv $tmpfile $dest || error=yes
107 echo "$0: ERROR - $dest doesn't exist for $PKGINST."
112 if [ "$error" = yes ]
114 echo "$0: ERROR - failed to update $lastdest for $PKGINST."