2 # Copyright 2007 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 (the "License").
9 # You may not use this file except in compliance with the License.
11 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
12 # or http://www.opensolaris.org/os/licensing.
13 # See the License for the specific language governing permissions
14 # and limitations under the License.
16 # When distributing Covered Code, include this CDDL HEADER in each
17 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
18 # If applicable, add the following below this CDDL HEADER, with the
19 # fields enclosed by brackets "[]" replaced with your own identifying
20 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # ident "%Z%%M% %I% %E% SMI"
26 # Class action script for "kmfconf" class files.
28 # This script appends the input file from the package to the
29 # /etc/crypto/kmf.conf file.
31 # The syntax of the input file is
32 # keystore:modulepath=path[;option=option_str]
35 pkg_start="# Start $PKGINST"
36 pkg_end="# End $PKGINST"
37 tmpfile=/tmp/$$kmfconf
42 [ "$src" = /dev/null ] && continue
46 # For multiple input files; exit if error occurred in previous
50 echo "$0: failed to update $lastdest for $PKGINST."
56 # If the package has been already installed, remove old entries
60 egrep -s "$pkg_start" $dest && start=1
61 egrep -s "$pkg_end" $dest && end=1
63 if [ $start -ne $end ]
65 echo "$0: missing Start or End delimiters for \
67 echo "$0: $dest may be corrupted and was not updated."
74 sed -e "/$pkg_start/,/$pkg_end/d" $dest > $tmpfile \
77 cp $dest $tmpfile || error=yes
81 # Check the input file syntax (should at least contain
82 # ":module_path="). Then append the input entries with the
83 #scc package delimiters.
85 line_count=`wc -l $src | awk '{ print $1}'`
86 file_count=`grep ":modulepath=" $src | wc -l`
87 if [ $line_count -ne $file_count ]
89 echo "$0: Syntax Error - $src for $PKGINST."
93 echo "$pkg_start" >> $tmpfile || error=yes
94 cat $src >> $tmpfile || error=yes
95 echo "$pkg_end" >> $tmpfile || error=yes
98 # Install the updated config file and clean up the tmp file
101 mv $tmpfile $dest || error=yes
105 echo "$0: ERROR - $dest doesn't exist for $PKGINST."
110 if [ "$error" = yes ]
112 echo "$0: ERROR - failed to update $lastdest for $PKGINST."