postinstall.tmpl revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
#
# Function: getKeyValue
#
# Try to get key value pair from the given line.
# The line to be parsed should conform to the format loadable
# by the Java Properties object.
#
# The variables "key" and "value" will be set if successful.
# 1 will be returned otherwise.
#
key=""
value=""
if [ $# != 1 ] ; then
#no argument to be parsed
return 1
fi
if [ "XX$1" = "XX" ] ; then
#empty line, nothing to be parsed
return 1
fi
#first, remove any leading and trailing blank spaces in the line
#Check to see if it is a comment line. Lines starting
#with '#' or '!' are comment lines
if [ "XX$?" = "XX0" ] ; then
#It's a comment line
return 1
fi
#Check to make sure the line have some kind of delimiter
if [ "XX$?" != "XX0" ] ; then
#No delimiter in line, return error
return 1
fi
's/^\([^ =:]*\)[ =:].*$/\1/'`
's/^[^ =:]*[ ]*[=:]\{0,1\}[ ]*\(.*\)$/\1/'`
return 0
fi
#Should never get here, but just in case.
return 1
}
#
# If desktop properties are found in opencard.properties
# because this is an upgrade, move the properties from
#
if [ ! -f $OP ] ; then
exit 1
fi
if [ ! -f $DP ] ; then
exit 1
fi
if [ ! -d /tmp ] ; then
exit 1
fi
#
# First, join all the lines that have the '\' continuation character
#
nawk '{ \
while (match($0, /^([^\\]|\\.)*\\$/ )) { \
getline line \
sub(/.$/, line, $0) \
} \
print $0 \
#
# Get list of desktop properties to be processed
#
if [ "XX$?" != "XX0" ] ; then
#can't continue if failed to copy original desktop.properties file.
exit 1
fi
if [ "XX$?" != "XX0" ] ; then
#can't continue if failed to copy original opencard.properties file.
exit 1
fi
while read opval ; do
if [ "XX$?" = "XX1" ] ; then
#Something is wrong with line. Don't put it in new file
continue
fi
#Successful in finding key-value pair.
#construct the new key. Replace "ocf.client.dtsession.root" with the
#word "desktop"
#check if key is in desktop.properties, if so, remove it before adding
if [ "XX$?" = "XX0" ] ; then
#line exists in file, need to remove
if [ "XX$?" = "XX0" ] ; then
fi
fi
# Remove opencard.properties entry that are
# moved to desktop.properties file
if [ "XX$?" = "XX0" ] ; then
fi
done
#Only copy the files if they have been modified. Having the temp
#desktop.properties file means something has been modified.
if [ -f ${TMP_DP} ] ; then
#Remove any dtlogin entries from opencard.properties
egrep -v "^[ ]*ocf\.client\.dtlogin\.root" \
if [ "XX$?" = "XX0" ] ; then
fi
if [ "${PKG_INSTALL_ROOT:-/}" = "/" ] ; then
# Note "svcadm restart" cannot be used due to 5079309.
fi
fi
# cleanup
##
## Update opencard.properties with IFD handler for internal reader
##
if [ $? -ne 0 ]; then
## Failed to create a temporary file.
exit 1
fi
# Join the lines that have the '\' continuation character
nawk '{ \
while (match($0, /^([^\\]|\\.)*\\$/ )) { \
getline line \
sub(/.$/, line, $0) \
} \
print $0 \
if [ $? -ne 0 ]; then
exit 1
fi
# Check if there is an entry to be updated.
if [ $? -ne 0 ]; then
# Entry does not exist. Do nothing.
exit 0
fi
# Copy to create a new file with the same file attributes as original.
if [ $? -ne 0 ]; then
exit 1
fi
# Replace the card terminal factory and
# append the IFD handler name to the entry
if [ $? -ne 0 ]; then
exit 1
fi
# We are done with this temporary file.
# Replace the configuration file with the new one.
if [ $? -ne 0 ]; then
exit 1
fi
if [ "${PKG_INSTALL_ROOT:-/}" = "/" ]; then
# Note "svcadm restart" cannot be used due to 5079309.
fi
exit 0