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
# the kernel modules we install and the order of dependencies
MODULES="nskern ncall nsctl sdbc"
DSCFG="/usr/sbin/dscfg -r $PKG_INSTALL_ROOT"
PCONFIG="${PKG_INSTALL_ROOT}/etc/dscfg_format"
DSCFG_LOCAL="${PKG_INSTALL_ROOT}etc/dscfg_local"
# number of KB required for the dscfg database (1024 * 5.5)
DSCFG_SIZE=5632
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."
#
# Functions
#
message()
{
echo ""
echo "$@"
echo ""
}
{
PATTERN="$1"
LINK="$2"
}
{
if [ -s $DSCFG_REF ]; then
DSCFG_LOC=`head -1 $DSCFG_REF`
return $?
fi
return 0
}
# used to test if a valid DS config database exists on machine already
# MAGIC_STRING is the top line in the config used in v3.1 & v3.2
#
{
# dscfg distinct strings, varies on the architecture
then
MAGIC_STRING="MAGI"
then
MAGIC_STRING="IGAM"
fi
# Create a PID unique temporary file
# Write the first or 16th block (skipping over VTOC) to
# the TMP_FILE, then scan for the presence of the "MAGI"
#
do
if [ ! -z "$1" ]; then
return 1
fi
fi
done
return 0
}
# returns 1 if the dscfg is a cluster db, 0 otherwise
{
#
# Check to see if we're in a cluster.
#
# check if there are any cluster tags. Do this by verifying
# that the output with no cluster tags is equivalent to the
# complete output without scm tags
if [ $? != 0 ]
then
return 1
fi
fi
return 0
}
# move the old dscfg to the new standard location
{
#
# First, grab some info from the old db
#
# backup contents of the old dscfg database
# grab all entries without a ctag
> ${TMP_DSCFG}.2
# are we in a cluster?
if [ $? = 0 ]
then
# we're in a non-cluster environment--just reinit the config
# First, just make sure we don't overwrite an existing dscfg
then
fi
else
#
# We're in a cluster.
# reinitialize new database with the contents of the old
# strip out all dscfg entries that have a cluster tag other than
# l.<my_host_name>
#
# grab all entries with a ctag of l.<my_host_name>
# replace "l.$HOST" with "-" in ${TMP_DSCFG}.3
# merge the two, removing duplicate entries
# reinit the local dscfg, with the ctag info stripped out
# First, just make sure we don't overwrite an existing dscfg
if [ $? = 0 ]
then
fi
# init the cluster dscfg
fi
# cleanup
}
#
# 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
}
#
# Installing to an alternate root ensure we can still
# find the libraries.
#
if [ "$PKG_INSTALL_ROOT" != "/" ]
then
if [ -n "$LD_LIBRARY_PATH" ]
then
# append to existing path
else
fi
export LD_LIBRARY_PATH
fi
#
# Set specific command syntax (if needed)
#
# For least privileges add option -P sys_devices,sys_config
if [ "${PKG_INSTALL_ROOT}" = "/" ]; then
REM_DRV="rem_drv"
ADD_DRV="add_drv -P sys_devices,sys_config"
else
REM_DRV="rem_drv -b ${PKG_INSTALL_ROOT}"
ADD_DRV="add_drv -P sys_devices,sys_config -b ${PKG_INSTALL_ROOT}"
fi
#
# the preinstall should have removed the modules therefore,
# if the lowest level module (nskern or sdsi) is loaded (busy) then we need to
# notify the user after the install to reboot or remove the clients and
# re-run pkgadd.
#
# add and load modules
#
do
REMERR="ERROR: The installation cannot be completed due to an error removing \
the ${MODULE} loadable module. The file ${ERRLOG} 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 ${ERRLOG} contains the errors. Exiting...\
Please fix problem and re-run pkgadd."
DEVLINKERR="ERROR: The installation cannot be completed due to an error configuring \
the ${MODULE} loadable module. The file ${ERRLOG} contains the errors. Exiting...\
Please fix problem and re-run pkgadd."
# 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
#
# if module has been previously installed, remove it
#
if [ $? -eq 0 ]; then
exit ${FAILURE}
}
fi
#
# install module
#
esac
exit ${FAILURE}
}
done
#
# Test if we need next boot to start Availability Suite
#
# check if we have a valid configuration database
# if so, copy the old database to new location, setup the service to be enabled
if [ $? = 1 ]
then
fi
if [ $MODBUSY = 1 ]; then
fi
#
# remove keep file from database, and finalize changes to pkg database
#