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
#
FAILURE=1
MODULE="ii"
DEVLINKTB="${PKG_INSTALL_ROOT}/etc/devlink.tab"
DSCFG_UPGRADE="${PKG_INSTALL_ROOT}/etc/opt/SUNWesm/dscfg.cf.upgrade"
FS_LOCAL_SVC="svc:/system/filesystem/local"
EXIT=0
MODBUSY=0
#### NOTICE #####\n
The previous version of this software cannot be unloaded (busy).\n
To load the new modules you must reboot the system."
#
# Set specific command syntax (if needed)
#
# 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
# workaround for 6221374--let local-fs know that 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
if [ $? -ne 0 ]
then
message "Warning: Unable to set dependency for $1 service"
fi
if [ $? -ne 0 ]
then
message "Warning: Unable to refresh $1 service"
fi
}
# if the main 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 / "
fi
fi
#
# Error messages
#
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."
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, unload it and remove it...
#
if [ $? -eq 0 ]
then
message "${REMERR}"
exit ${FAILURE}
}
fi
#
# Install the module
#
message "${ADDERR}"
exit ${FAILURE}
}
# 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
#
# Finalization of pkg database updates
#