postinstall revision fcf3ce441efd61da9bb2884968af01cb7c1452cc
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Set path
#
export PATH
#
# Set variables
#
EXIT=0
FAILURE=1
INS_MSG="${INS_DATE} Remote Dual Copy module installed"
MODBUSY=0
FS_LOCAL_SVC="svc:/system/filesystem/local"
#### NOTICE #####\n
The previous version of this software cannot be unloaded (busy).\n
To load the new modules you must reboot the system."
MODULES="rdcsrv rdc"
DEVLINKTB="${PKG_INSTALL_ROOT}/etc/devlink.tab"
DSCFG_UPGRADE="${PKG_INSTALL_ROOT}/etc/opt/SUNWesm/dscfg.cf.upgrade"
# For least privileges add option -P sys_devices,sys_config
if [ "${PKG_INSTALL_ROOT}" = "/" ]
then
ADD_DRV="add_drv -P sys_devices,sys_config"
REM_DRV="rem_drv"
else
ADD_DRV="add_drv -P sys_devices,sys_config -b ${PKG_INSTALL_ROOT}"
REM_DRV="rem_drv -b ${PKG_INSTALL_ROOT}"
fi
#
# Functions
#
message()
{
echo ""
echo "$@"
echo ""
}
{
PATTERN="$1"
LINK="$2"
}
#
# Setup the service to enable. This is necessary to deal
# with upgrade situations. It also sets the proper dependency type for the
# local filesystems service
# $1: name of service to enable
#
{
# enable the service
if [ $? -ne 0 ]
then
message "Warning: Unable to enable $1 service"
fi
if [ $1 = nws_rdc ]
then
# workaround for 6221374--let local-fs know it depends on us
if [ $? -ne 0 ]
then
message "Warning: Unable to refresh $1 service"
fi
# make sure the local filesystems service waits for us
svccfg -s $FS_LOCAL_SVC setprop \
${1}-local-fs/grouping=require_all
if [ $? -ne 0 ]
then
message "Warning: Unable to set dependency for ${1}."
fi
if [ $? -ne 0 ]
then
message "Warning: Unable to refresh $1 service"
fi
fi
}
# if the main rdc module is still loaded then it has refused to unload
# and we have to force a reboot.
#
if [ "${PKG_INSTALL_ROOT:-/}" = "/" ]; then
if [ $? -eq 0 ]; then
# still loaded
MODBUSY=1
NOPT="-b / "
EXIT=10
fi
fi
#
# if module has been previously installed, unload it and remove it...
#
do
REMERR="
ERROR: The installation cannot be completed due to an error removing the
${MODULE} loadable module. The file ${ERROR_LOG} contains the errors.
Exiting...Please fix problem and re-run pkgadd."
ADDERR="
ERROR: The installation cannot be completed due to an error adding the
${MODULE} loadable module. The file ${ERROR_LOG} contains the errors.
Exiting...Please fix problem and re-run pkgadd."
devlinks -r ${PKG_INSTALL_ROOT} -t ${DEVLINKTB} > ${ERROR_LOG} 2>&1
ERROR: The installation cannot be completed due to an error configuring the
${MODULE} loadable module. The file ${ERROR_LOG} contains the errors.
Exiting...Please fix problem and re-run pkgadd."
#
# if module has been previously installed, remove it
#
if [ $? -eq 0 ]
then
message "${REMERR}"
exit ${FAILURE}
}
fi
if [ "$MODULE" = "rdcsrv" ]
then
else
fi
if [ "$MODULE" != "rdcsrv" ]
then
message "${ADDERR}"
exit ${FAILURE}
}
fi
done
# deal with upgrades from AVS 3.2
if [ -f $DSCFG_UPGRADE ]
then
if [ $? = 1 ]
then
echo "$PKGINST" >> $DSCFG_UPGRADE
fi
fi
if [ $MODBUSY = 1 ]; then
fi
#
# remove keep file from database, and finalize pkg database
#
#
# Add rdc to services file
#
if [ $? -eq 1 ]
then
fi
exit $EXIT