Microsoft.Solaris.10.Kit.sparc (DeployableResource)
Element properties:
Source Code:
<DeployableResource ID="Microsoft.Solaris.10.Kit.sparc" Accessibility="Internal" FileName="scx-1.6.3-474.solaris.10.sparc.sh" HasNullStream="false"/>
File Content: scx-1.6.3-474.solaris.10.sparc.sh
#!/bin/sh
#
# Shell Bundle installer package for the SCX project
#
PATH=/usr/bin:/usr/sbin:/bin:/sbin
umask 022
# Can't use something like 'readlink -e $0' because that doesn't work everywhere
# And HP doesn't define $PWD in a sudo environment, so we define our own
case $0 in
/*|~*)
SCRIPT_INDIRECT="`dirname $0`"
;;
*)
PWD="`pwd`"
SCRIPT_INDIRECT="`dirname $PWD/$0`"
;;
esac
SCRIPT_DIR="`(cd \"$SCRIPT_INDIRECT\"; pwd -P)`"
SCRIPT="$SCRIPT_DIR/`basename $0`"
EXTRACT_DIR="`pwd -P`/scxbundle.$$"
# These symbols will get replaced during the bundle creation process.
#
# The OM_PKG symbol should contain something like:
# scx-1.5.1-115.rhel.6.x64 (script adds .rpm or .deb, as appropriate)
# Note that for non-Linux platforms, this symbol should contain full filename.
#
TAR_FILE=scx-1.6.3-474.solaris.10.sparc.pkg.tar
OM_PKG=scx-1.6.3-474.solaris.10.sparc.pkg
OMI_PKG=omi-1.4.1-0.solaris.10.sparc.pkg
SCRIPT_LEN=516
SCRIPT_LEN_PLUS_ONE=517
usage()
{
echo "usage: $1 [OPTIONS]"
echo "Options:"
echo " --extract Extract contents and exit."
echo " --force Force upgrade (override version checks)."
echo " --install Install the package from the system."
echo " --purge Uninstall the package and remove all related data."
echo " --remove Uninstall the package from the system."
echo " --restart-deps Reconfigure and restart dependent service"
echo " --source-references Show source code reference hashes."
echo " --upgrade Upgrade the package in the system."
echo " --enable-opsmgr Enable port 1270 for usage with opsmgr."
echo " --version Version of this shell bundle."
echo " --debug use shell debug mode."
echo " -? | --help shows this usage text."
}
source_references()
{
cat <<EOF
superproject: 688665fdd69244d2593e9a5f9d8ace0fa332e3c3
omi: 1770fbeb6eb52e32781d5efb0918911525134486
omi-kits: b7cca0fb7f2abbfbd76f5ab338bc9f153d72879f
opsmgr: e303c9f71dda2c878b78dae2b4ac9cd4128e5085
opsmgr-kits: 7bedcd2fd0322b39349d429cb530db07a8dad522
pal: 5c56f36f8b87109ba8d606c748bb37f57047082a
EOF
}
cleanup_and_exit()
{
# $1: Exit status
# $2: Non-blank (if we're not to delete bundles), otherwise empty
rm -f scx-admin scx-admin-upgrade
rm -f /tmp/.ai.pkg.zone.lock*
if [ -z "$2" -a -d "$EXTRACT_DIR" ]; then
cd $EXTRACT_DIR/..
rm -rf $EXTRACT_DIR
fi
if [ -n "$1" ]; then
exit $1
else
exit 0
fi
}
check_version_installable() {
# POSIX Semantic Version <= Test
# Exit code 0 is true (i.e. installable).
# Exit code non-zero means existing version is >= version to install.
#
# Parameter:
# Installed: "x.y.z.b" (like "4.2.2.135"), for major.minor.patch.build versions
# Available: "x.y.z.b" (like "4.2.2.135"), for major.minor.patch.build versions
if [ $# -ne 2 ]; then
echo "INTERNAL ERROR: Incorrect number of parameters passed to check_version_installable" >&2
cleanup_and_exit 1
fi
# Current version installed
INS_MAJOR=`echo $1 | cut -d. -f1`
INS_MINOR=`echo $1 | cut -d. -f2`
INS_PATCH=`echo $1 | cut -d. -f3`
INS_BUILD=`echo $1 | cut -d. -f4`
# Available version number
AVA_MAJOR=`echo $2 | cut -d. -f1`
AVA_MINOR=`echo $2 | cut -d. -f2`
AVA_PATCH=`echo $2 | cut -d. -f3`
AVA_BUILD=`echo $2 | cut -d. -f4`
# Check bounds on MAJOR
if [ $INS_MAJOR -lt $AVA_MAJOR ]; then
return 0
elif [ $INS_MAJOR -gt $AVA_MAJOR ]; then
return 1
fi
# MAJOR matched, so check bounds on MINOR
if [ $INS_MINOR -lt $AVA_MINOR ]; then
return 0
elif [ $INS_MINOR -gt $AVA_MINOR ]; then
return 1
fi
# MINOR matched, so check bounds on PATCH
if [ $INS_PATCH -lt $AVA_PATCH ]; then
return 0
elif [ $INS_PATCH -gt $AVA_PATCH ]; then
return 1
fi
# PATCH matched, so check bounds on BUILD
if [ $INS_BUILD -lt $AVA_BUILD ]; then
return 0
elif [ $INS_BUILD -gt $AVA_BUILD ]; then
return 1
fi
# Version available is idential to installed version, so don't install
return 1
}
getVersionNumber()
{
# Parse a version number from a string.
#
# Parameter 1: string to parse version number string from
# (should contain something like mumble-4.2.2.135.universal.x86.tar)
# Parameter 2: prefix to remove ("mumble-" in above example)
if [ $# -ne 2 ]; then
echo "INTERNAL ERROR: Incorrect number of parameters passed to getVersionNumber" >&2
cleanup_and_exit 1
fi
echo $1 | sed -e "s/$2//" -e 's/\.solaris\..*$//' -e 's/-/./'
}
verifyNoInstallationOption()
{
if [ -n "${installMode}" ]; then
echo "$0: Conflicting qualifiers, exiting" >&2
cleanup_and_exit 1
fi
return;
}
# $1 - The name of the package to check as to whether it's installed
check_if_pkg_is_installed() {
/usr/bin/pkginfo MSFT$1 2> /dev/null 1> /dev/null
return $?
}
# $1 - The filename of the package to be installed
# $2 - The package name of the package to be installed
pkg_add() {
pkg_filename=$1
pkg_name=$2
echo "----- Installing package: $pkg_name ($pkg_filename) -----"
/usr/sbin/pkgadd -a scx-admin -n -d $pkg_filename MSFT$pkg_name
}
# $1 - The package name of the package to be uninstalled
# $2 - Optional parameter. Only used when forcibly removing omi on SunOS
pkg_rm() {
echo "----- Removing package: $1 -----"
if [ "$2" = "force" ]; then
/usr/sbin/pkgrm -a scx-admin-upgrade -n MSFT$1 # 1> /dev/null 2> /dev/null
else
/usr/sbin/pkgrm -a scx-admin -n MSFT$1 # 1> /dev/null 2> /dev/null
fi
}
# $1 - The filename of the package to be installed
# $2 - The package name of the package to be installed
# $3 - Okay to upgrade the package? (Optional)
pkg_upd() {
pkg_filename=$1
pkg_name=$2
pkg_allowed=$3
echo "----- Updating package: $pkg_name ($pkg_filename) -----"
if [ -z "${forceFlag}" -a -n "$pkg_allowed" ]; then
if [ $pkg_allowed -ne 0 ]; then
echo "Skipping package since existing version >= version available"
return 0
fi
fi
# No notion of "--force" since Sun package has no notion of update
check_if_pkg_is_installed ${pkg_name}
if [ $? -eq 0 ]; then
pkg_rm $pkg_name force
pkg_add $1 $pkg_name
else
pkg_add $1 $pkg_name
fi
}
getInstalledVersion()
{
# Parameter: Package to check if installed
# Returns: Printable string (version installed or "None")
if check_if_pkg_is_installed $1; then
version="`pkginfo -l MSFT$1 | grep VERSION | awk '{ print $2 }'`"
getVersionNumber $version ${1}-
else
echo "None"
fi
}
shouldInstall_omi()
{
versionInstalled=`getInstalledVersion omi`
[ "$versionInstalled" = "None" ] && return 0
versionAvailable=`getVersionNumber $OMI_PKG omi-`
check_version_installable $versionInstalled $versionAvailable
}
shouldInstall_scx()
{
versionInstalled=`getInstalledVersion scx`
[ "$versionInstalled" = "None" ] && return 0
versionAvailable=`getVersionNumber $OM_PKG scx-`
check_version_installable $versionInstalled $versionAvailable
}
#
# Main script follows
#
set +e
while [ $# -ne 0 ]
do
case "$1" in
--extract-script)
# hidden option, not part of usage
# echo " --extract-script FILE extract the script to FILE."
head -${SCRIPT_LEN} "${SCRIPT}" > "$2"
local shouldexit=true
shift 2
;;
--extract-binary)
# hidden option, not part of usage
# echo " --extract-binary FILE extract the binary to FILE."
tail +${SCRIPT_LEN_PLUS_ONE} "${SCRIPT}" > "$2"
local shouldexit=true
shift 2
;;
--extract)
verifyNoInstallationOption
installMode=E
shift 1
;;
--force)
forceFlag=true
shift 1
;;
--install)
verifyNoInstallationOption
installMode=I
shift 1
;;
--purge)
verifyNoInstallationOption
installMode=P
shouldexit=true
shift 1
;;
--remove)
verifyNoInstallationOption
installMode=R
shouldexit=true
shift 1
;;
--restart-deps)
restartDependencies=--restart-deps
shift 1
;;
--source-references)
source_references
cleanup_and_exit 0
;;
--upgrade)
verifyNoInstallationOption
installMode=U
shift 1
;;
--enable-opsmgr)
if [ ! -f /etc/scxagent-enable-port ]; then
touch /etc/scxagent-enable-port
fi
shift 1
;;
--version)
echo "Version: `getVersionNumber $OM_PKG scx-`"
exit 0
;;
--debug)
echo "Starting shell debug mode." >&2
echo "" >&2
echo "SCRIPT_INDIRECT: $SCRIPT_INDIRECT" >&2
echo "SCRIPT_DIR: $SCRIPT_DIR" >&2
echo "EXTRACT DIR: $EXTRACT_DIR" >&2
echo "SCRIPT: $SCRIPT" >&2
echo >&2
set -x
shift 1
;;
-? | --help)
usage `basename $0` >&2
cleanup_and_exit 0
;;
*)
usage `basename $0` >&2
cleanup_and_exit 1
;;
esac
done
if [ -z "${installMode}" ]; then
echo "$0: No options specified, specify --help for help" >&2
cleanup_and_exit 3
fi
#
# Note: From this point, we're in a temporary directory. This aids in cleanup
# from bundled packages in our package (we just remove the diretory when done).
#
mkdir -p $EXTRACT_DIR
cd $EXTRACT_DIR
# Create installation administrative file for Solaris platform if needed
echo "mail=" > scx-admin
echo "instance=overwrite" >> scx-admin
echo "partial=nocheck" >> scx-admin
echo "idepend=quit" >> scx-admin
echo "rdepend=quit" >> scx-admin
echo "conflict=nocheck" >> scx-admin
echo "action=nocheck" >> scx-admin
echo "basedir=default" >> scx-admin
echo "mail=" > scx-admin-upgrade
echo "instance=overwrite" >> scx-admin-upgrade
echo "partial=nocheck" >> scx-admin-upgrade
echo "idepend=quit" >> scx-admin-upgrade
echo "rdepend=nocheck" >> scx-admin-upgrade
echo "conflict=nocheck" >> scx-admin-upgrade
echo "action=nocheck" >> scx-admin-upgrade
echo "basedir=default" >> scx-admin-upgrade
# Do we need to remove the package?
if [ "$installMode" = "R" -o "$installMode" = "P" ]
then
if [ -f /opt/microsoft/scx/bin/uninstall ]; then
/opt/microsoft/scx/bin/uninstall $installMode
else
pkg_rm scx
pkg_rm omi
fi
if [ "$installMode" = "P" ]
then
echo "Purging all files in cross-platform agent ..."
rm -rf /etc/opt/microsoft/scx /opt/microsoft/scx /var/opt/microsoft/scx
rmdir /etc/opt/microsoft /opt/microsoft /var/opt/microsoft 1>/dev/null 2>/dev/null
# If OMI is not installed, purge its directories as well.
check_if_pkg_is_installed omi
if [ $? -ne 0 ]; then
rm -rf /etc/opt/omi /opt/omi /var/opt/omi
fi
fi
fi
if [ -n "${shouldexit}" ]
then
# when extracting script/tarball don't also install
cleanup_and_exit 0
fi
#
# Do stuff before extracting the binary here, for example test [ `id -u` -eq 0 ],
# validate space, platform, uninstall a previous version, backup config data, etc...
#
#
# Extract the binary here.
#
echo "Extracting..."
tail +${SCRIPT_LEN_PLUS_ONE} "${SCRIPT}" | zcat - | tar xf -
STATUS=$?
if [ ${STATUS} -ne 0 ]
then
echo "Failed: could not extract the install bundle."
cleanup_and_exit ${STATUS}
fi
#
# Do stuff after extracting the binary here, such as actually installing the package.
#
EXIT_STATUS=0
SCX_EXIT_STATUS=0
OMI_EXIT_STATUS=0
case "$installMode" in
E)
# Files are extracted, so just exit
cleanup_and_exit 0 "SAVE"
;;
I)
echo "Installing cross-platform agent ..."
check_if_pkg_is_installed scx
if [ $? -eq 0 ]; then
echo "ERROR: SCX package is already installed"
cleanup_and_exit 2
fi
check_if_pkg_is_installed omi
if [ $? -eq 0 ]; then
shouldInstall_omi
pkg_upd $OMI_PKG omi $?
OMI_EXIT_STATUS=$?
else
pkg_add $OMI_PKG omi
OMI_EXIT_STATUS=$?
fi
pkg_add $OM_PKG scx
SCX_EXIT_STATUS=$?
;;
U)
echo "Updating cross-platform agent ..."
check_if_pkg_is_installed omi
if [ $? -eq 0 ]; then
shouldInstall_omi
pkg_upd $OMI_PKG omi $?
OMI_EXIT_STATUS=$?
else
pkg_add $OMI_PKG omi
OMI_EXIT_STATUS=$?
fi
shouldInstall_scx
pkg_upd $OM_PKG scx $?
SCX_EXIT_STATUS=$?
;;
*)
echo "$0: Invalid setting of variable \$installMode, exiting" >&2
cleanup_and_exit 2
esac
# Remove temporary files (now part of cleanup_and_exit) and exit
if [ "$SCX_EXIT_STATUS" -ne 0 -o "$OMI_EXIT_STATUS" -ne 0 ]; then
cleanup_and_exit 1
else
cleanup_and_exit 0
fi
#####>>- This must be the last line of this script, followed by a single empty line. -<<#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