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 "kcfconf" class files.
29 # This script appends the input file from the package to the
30 # /etc/crypto/kcf.conf file.
32 # The syntax of the input file for a kernel software provider package is
33 # <provider_name>:supportedlist=<mechlist>
35 # <provider_name> ::= the kernel software module base name
36 # <mechlist> ::= <mechanism>{,<mechanism>}*
37 # <mechanism> ::= a mechanism name as specified by the RSA PKCS#11 spec.
39 # The syntax of the input file for a cryptographic provider device driver(s)
41 # driver_names=<driver_name_list>
43 # <driver_name_list> ::= <name>{,<name>}*
44 # <name> ::= a device driver name
46 pkg_start="# Start $PKGINST"
47 pkg_end="# End $PKGINST"
48 tmpfile=/tmp/$$kcfconf
53 [ "$src" = /dev/null ] && continue
57 # For multiple input files; exit if error occurred in previous
61 echo "$0: failed to update $lastdest for $PKGINST."
67 # If the package has been already installed, remove old entries
71 egrep -s "$pkg_start" $dest && start=1
72 egrep -s "$pkg_end" $dest && end=1
74 if [ $start -ne $end ]
76 echo "$0: missing Start or End delimiters for \
78 echo "$0: $dest may be corrupted and was not updated."
85 sed -e "/$pkg_start/,/$pkg_end/d" $dest > $tmpfile \
88 cp $dest $tmpfile || error=yes
92 # Check the input file syntax and append the input entries
93 # with the package delimiters.
95 line_count=`wc -l $src | awk '{ print $1}'`
97 grep "driver_names" $src > /dev/null
101 # This is a device driver package.
102 # - $src should contain only one line.
103 # - If syntax of $src is correct, append the package
104 # start delimiter with the driver_names string.
106 if [ $line_count -ne 1 ]; then
107 echo "$0: Syntax Error - $src for $PKGINST."
111 echo "$pkg_start `cat $src`" >> $tmpfile \
116 # This is a kernel software provider package.
117 # - Each line in $src should contain "supportedlist".
118 # - If syntax of $src is correct, append the package
119 # start delimiter and the $src file.
121 supported_count=`grep supportedlist $src |wc -l`
122 if [ $line_count -ne $supported_count ]
124 echo "$0: Syntax Error - $src for $PKGINST."
128 echo "$pkg_start" >> $tmpfile || error=yes
129 cat $src >> $tmpfile || error=yes
132 echo "$pkg_end" >> $tmpfile || error=yes
134 # Install the updated config file and clean up the tmp file
137 mv $tmpfile $dest || error=yes
141 echo "$0: ERROR - $dest doesn't exist for $PKGINST."
146 if [ "$error" = yes ]
148 echo "$0: ERROR - failed to update $lastdest for $PKGINST."