engine-wrapper revision ada1678a4262b208a7b87391f520a7767d25287c
207N/A#!/bin/sh
207N/A#
207N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
207N/A#
207N/A# Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved.
207N/A#
207N/A# The contents of this file are subject to the terms of either the GNU
207N/A# General Public License Version 2 only ("GPL") or the Common Development
207N/A# and Distribution License("CDDL") (collectively, the "License"). You
207N/A# may not use this file except in compliance with the License. You can
207N/A# obtain a copy of the License at
207N/A# https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
207N/A# or packager/legal/LICENSE.txt. See the License for the specific
207N/A# language governing permissions and limitations under the License.
207N/A#
207N/A# When distributing the software, include this License Header Notice in each
207N/A# file and include the License file at packager/legal/LICENSE.txt.
207N/A#
207N/A# GPL Classpath Exception:
207N/A# Oracle designates this particular file as subject to the "Classpath"
207N/A# exception as provided by Oracle in the GPL Version 2 section of the License
207N/A# file that accompanied this code.
207N/A#
207N/A# Modifications:
207N/A# If applicable, add the following below the License Header, with the fields
207N/A# enclosed by brackets [] replaced by your own identifying information:
207N/A# "Portions Copyright [year] [name of copyright owner]"
207N/A#
207N/A# Contributor(s):
207N/A# If you wish your version of this file to be governed by only the CDDL or
207N/A# only the GPL Version 2, indicate your decision by adding "[Contributor]
207N/A# elects to include this software in this distribution under the [CDDL or GPL
207N/A# Version 2] license." If you don't indicate a single choice of license, a
282N/A# recipient has the option to distribute your version of this file under
207N/A# either the CDDL, the GPL Version 2 or to extend the choice of license to
261N/A# its licensees as provided above. However, if you add GPL Version 2 code
320N/A# and therefore, elected the GPL Version 2 license, then the option applies
312N/A# only if the new code is made subject to such option by the copyright
207N/A# holder.
207N/A#
207N/A
207N/A# Sun Install engine wrapper script
207N/A#
207N/A
207N/A# binaries needed on both Solaris, Linux, etc.
207N/ABASENAME=basename
207N/ACAT=/bin/cat
207N/A#CD=/bin/cd
656N/ACHMOD=/bin/chmod
207N/ACP=/bin/cp
207N/ACUT=/bin/cut
207N/ADIRNAME=/usr/bin/dirname
207N/AECHO=/bin/echo
678N/AEGREP=/bin/egrep
480N/AGETTEXT=/usr/bin/gettext
207N/AID=/usr/bin/id
207N/AMKDIR=/bin/mkdir
207N/APRINTF=/usr/bin/printf
207N/A_PWD=/bin/pwd # "${PWD}" is defined as a built-in variable in some shells
207N/ARM=/bin/rm
207N/ASED=/bin/sed
207N/ASU=/bin/su
207N/ATOUCH=/bin/touch
207N/AUNAME=uname
207N/AXAUTH=/openwin/bin/xauth,/usr/X11R6/bin/xauth
207N/A
207N/APP_FAMILY="Unix"
207N/APP_OSNAME="Solaris"
207N/AOS_ARCH="sparc"
207N/A
207N/A# static constants
207N/ADEF_SUP_JVM_VER=1.5 # default supported jdk version
207N/A
207N/ANAME=`${BASENAME} $0`
207N/AMYDIR=`${DIRNAME} $0`
253N/AMYDIR=`cd ${MYDIR}; ${_PWD}`
359N/A
207N/AINSTALL_HOME=${MYDIR}/..
359N/AINSTALL_HOME=`cd ${INSTALL_HOME}; ${_PWD}`
274N/A
320N/ATEXTDOMAINDIR=${INSTALL_HOME}/lib/resources/templates
656N/A
656N/AINSTALLCONFIG_PROPERTIES="$INSTALL_HOME/install-config.properties" # installer specific properties
207N/A
207N/A# global settings
207N/AJAVAHOME="" # java home path
207N/AJAVA_OPTIONS="-client" # default java options
207N/AADDITIONALCLASSPATHS=""
207N/AINSTALLPROPS="" # install specific properties
207N/A
207N/A# user options
207N/ADRYRUN=
207N/AANSWERFILE=
207N/AALTROOT=
207N/AVERSIONFLAG=
207N/ADEBUGLEVEL="INFO"
207N/AMEDIALOC=
207N/AINSTALLABLES=
207N/ACONFIGSTATE=
207N/A
207N/A
207N/A#-------------------------------------------------------------------------------
207N/A# usage only: define what parameters are available here
207N/A# input(s): exitCode
207N/A#-------------------------------------------------------------------------------
207N/Ausage() {
261N/A ${CAT} <<EOF
459N/AUsage: $NAME [OPTION]
207N/A
459N/AOptions:
261N/A -a <path>, --answerfile=<path>
207N/A Supply a file containing install configuration. Can be used multiple times
207N/A for multiple answer files.
207N/A -n <file>, --dry-run=<file>:
207N/A Dry run mode. Do not install anything. Configuration answers written to <file>
261N/A -R <path>, --altroot=<path>
207N/A Operation with respect to an alternate root
459N/A -h, --help :
207N/A display this help list
312N/A -V, --version :
207N/A display version of install engine.
564N/A -l <level>, --level=<level>
564N/A Debug level. One of FATAL, WARNING, INFO, CONFIG, FINE, FINER, FINEST
207N/A -m <url>, --media-location=<url>
207N/A Specify location of metadata used to drive install. If blank,
564N/A assume no media.
207N/A -s <dir>, --configstate=<dir>
207N/A Directory where the config data is persisted as xcu files.
564N/A -i <path>, --installables=<path>
564N/A Root directory containing installable units for support of install and repair.
564N/A
564N/APrivate options:
564N/A
207N/A -j <javahome>, --javahome=<javahome> :
207N/A use this java vm instead of searching for suitable one
207N/A -J <joptions>, --jvmoptions=<joptions> :
261N/A specify java vm options. For example -J "-verbose -Dhttp.proxy=foo.com:3434"
261N/A -C <classpaths>, --classpaths=<classpaths> :
261N/A specify a colon-separated list of additional classpaths
261N/A -c <file>, --config-file=<file> :
261N/A Specify extra properties in a file
261N/A -p <props>, --properties=<props> :
261N/A specify 1 or more config properties options, separated by comma,
320N/A to the install engine. For example:
261N/A --properties=Logs-Location=/tmp,Platform-Plugin-Path=c:\\Sun\\ppp
261N/A
261N/AEOF
207N/A exit $1
207N/A}
207N/A
668N/A#-------------------------------------------------------------------------------
668N/A# perform actual operation for the script: install/uninstall
668N/A# input(s): none
668N/A# output(s): instCode
668N/A#-------------------------------------------------------------------------------
668N/Aperform() {
668N/A theInstallEngine="${INSTALL_HOME}/lib/engine.jar:${INSTALL_HOME}/lib/sims.jar"
668N/A theInstallEngine="${theInstallEngine}:${INSTALL_HOME}/lib/config.jar"
668N/A theCP="${INSTALL_HOME}/lib/bootstrap.jar:${INSTALL_HOME}/lib/bindings.jar"
668N/A theCP="${theCP}:${INSTALL_HOME}/lib/external/beanshell/bsh.jar"
668N/A theCP="${theCP}:${INSTALL_HOME}/lib/external/chaxml/chaxml.jar"
668N/A theCP="${theCP}:${INSTALL_HOME}/lib/external/charva/charva.jar"
668N/A theCP="${theCP}:${INSTALL_HOME}/lib/external/swixml/swixml.jar"
668N/A theCP="${theCP}:${INSTALL_HOME}/lib/external/swixml/j2h.jar"
668N/A theCP="${theCP}:${INSTALL_HOME}/lib/external/swixml/ui.jar"
668N/A theCP="${theCP}:${INSTALL_HOME}/lib/external/jdom/jdom.jar"
668N/A theCP="${theCP}:${INSTALL_HOME}/lib/external/freemarker/freemarker.jar"
668N/A theCP="${theCP}:${INSTALL_HOME}/lib/external/jaxb/jaxb-impl.jar"
668N/A theCP="${theCP}:${INSTALL_HOME}/lib/external/jaxb/jaxb-jsr173_1.0_api.jar"
668N/A theCP="${theCP}:${INSTALL_HOME}/lib/external/jaxb/jaxb-api.jar"
668N/A theCP="${theCP}:${INSTALL_HOME}/lib/external/jaxb/activation.jar"
668N/A theCP="${theCP}:${INSTALL_HOME}/lib/external/apache/commons-logging.jar"
668N/A if [ -n "${ADDITIONALCLASSPATHS}" ]; then
668N/A theCP="${theCP}:${ADDITIONALCLASSPATHS}"
668N/A fi
668N/A if [ -n "${CLASSPATH}" ]; then
668N/A theCP="${theCP}:${CLASSPATH}"
668N/A fi
668N/A
668N/A theLP="${INSTALL_HOME}/lib/external/charva/${PP_FAMILY}/${PP_OSNAME}/${OS_ARCH}"
668N/A theLP="${theLP}:${INSTALL_HOME}/lib/external/ncurses/${PP_FAMILY}/${PP_OSNAME}/${OS_ARCH}"
668N/A
668N/A JAVA_HOME=${JAVAHOME}
668N/A export JAVA_HOME
668N/A CLASSPATH=${theCP}
668N/A export CLASSPATH
668N/A LD_LIBRARY_PATH=${theLP}
668N/A export LD_LIBRARY_PATH
668N/A
668N/A INSTALLPROPS="${INSTALLPROPS} -p Platform-Plugin-Path=${INSTALL_HOME}/lib/platforms"
668N/A INSTALLPROPS="${INSTALLPROPS} -p Provider-Path=${INSTALL_HOME}/lib/providers"
668N/A
668N/A if [ -n "${DRYRUN}" ]; then
668N/A INSTALLPROPS="${INSTALLPROPS} -p Dry-Run-File=${DRYRUN}"
668N/A fi
668N/A
668N/A if [ -n "${CONFIGSTATE}" ]; then
668N/A INSTALLPROPS="${INSTALLPROPS} -p Config-State=${CONFIGSTATE}"
668N/A fi
668N/A
668N/A if [ -n "${ANSWERFILE}" ]; then
668N/A INSTALLPROPS="${INSTALLPROPS} -p Answer-Files=${ANSWERFILE}"
668N/A fi
668N/A
668N/A if [ -n "${ALTROOT}" ]; then
668N/A INSTALLPROPS="${INSTALLPROPS} -p Alternate-Root=${ALTROOT}"
668N/A fi
668N/A
668N/A if [ -n "${DEBUGLEVEL}" ]; then
460N/A INSTALLPROPS="${INSTALLPROPS} -p Log-Level=${DEBUGLEVEL}"
580N/A fi
580N/A
580N/A if [ -n "${MEDIALOC}" ]; then
580N/A INSTALLPROPS="${INSTALLPROPS} -p Media-Location=${MEDIALOC}"
580N/A fi
580N/A
580N/A if [ -n "${INSTALLABLES}" ]; then
580N/A INSTALLPROPS="${INSTALLPROPS} -p Installable-Unit-Path=${INSTALLABLES}"
580N/A fi
580N/A
580N/A SPLASH_NAME=/tmp/messages.splash.$$
580N/A export SPLASH_NAME
580N/A touch $SPLASH_NAME
580N/A
580N/A # Uninstalls typically remove the files that make up the installer,
580N/A # which can cause problems on unix, so as a precautionary measure,
207N/A # cd to a safe place
580N/A cd /
580N/A
580N/A # start the installer
580N/A ${JAVA_HOME}/bin/java ${JAVA_OPTIONS} -Dinstall.engine=${theInstallEngine} \
580N/A -Dinstaller.resources.url=${MEDIALOC}/ \
580N/A -Ddefault.resources.url=file:${INSTALL_HOME}/lib/resources/ \
580N/A -classpath ${theCP} \
580N/A -Dsims.native-file-dir=${INSTALL_HOME}/lib \
207N/A org.openinstaller.core.EngineBootstrap \
580N/A ${INSTALLPROPS}
580N/A
580N/A instCode=$?
580N/A unset theInstallEngine
580N/A unset theCP
580N/A}
580N/A
580N/A#-------------------------------------------------------------------------------
580N/A# ****************************** MAIN THREAD ***********************************
580N/A#-------------------------------------------------------------------------------
580N/A
359N/ALONGOPT="h(help)V(version)n:(dry-run)s:(configstate)a:(answerfile)R:(altroot)l:(level)m:(media-location)i:(installables)j:(javahome)J:(jvmoptions)C:(classpaths)c:(config-file)p:(properties)"
207N/A
207N/ASHORTOPT="hVn:a:s:R:l:m:i:j:J:C:p:c:"
207N/A
274N/Aexport TEXTDOMAINDIR
274N/A
274N/Aif [ "`${UNAME} -s`" = SunOS ] ; then
274N/A case "`${UNAME} -r`" in
274N/A 2.* | 5.7 | 5.8)
297N/A echo `${GETTEXT} "openInstaller is only supported on Solaris 9 or later"`
274N/A exit 1
464N/A ;;
274N/A 5.9)
439N/A OPTSTRING=${SHORTOPT}
439N/A ;;
439N/A *)
464N/A OPTSTRING=${LONGOPT}
439N/A ;;
297N/A esac
439N/Aelse
460N/A # Linux has no built-in support for long-style getopts so we use the short style only
439N/A OPTSTRING=${SHORTOPT}
274N/Afi
460N/A
460N/A# check arguments
274N/Awhile getopts "${OPTSTRING}" opt ; do
274N/A case "${opt}" in
274N/A
274N/A # The engine knows how to deal with a leading "," so we can use this with no problems:
207N/A a) case ${OPTARG} in
459N/A *:/*|*:[*)
678N/A # Answer file is a URL or contains substitutions, so don't try and parse it
207N/A ANSWERFILE="${ANSWERFILE},${OPTARG}"
678N/A ;;
359N/A *)
359N/A # Answer file is not a URL, so resolve relative paths
459N/A ANSDIR=`dirname ${OPTARG}`
359N/A ANSNAME=`basename ${OPTARG}`
359N/A if [ ! -d "${ANSDIR}" -o ! -w "${ANSDIR}" ]; then
359N/A ${PRINTF} "`${GETTEXT} '%s is not a directory or is not writable'`\n" "${ANSDIR}"
359N/A exit 1
656N/A fi
694N/A ANSDIR=`cd $ANSDIR; pwd`
694N/A ANSWERFILE="${ANSWERFILE},${ANSDIR}/${ANSNAME}"
656N/A ;;
694N/A esac
656N/A ;;
656N/A
656N/A R) ALTROOT=${OPTARG}
656N/A
656N/A if [ ! -d ${ALTROOT} -o ! -r ${ALTROOT} ] ; then
207N/A ${PRINTF} "`${GETTEXT} '%s is not a valid alternate root'`\n" "${ALTROOT}"
816N/A exit 1
816N/A fi
255N/A ;;
207N/A
456N/A n) case ${OPTARG} in
460N/A *:/*|*:[*)
460N/A # Dry-Run file is a URL or contains substitutions, so don't try and parse it
460N/A DRYRUN="${OPTARG}"
274N/A ;;
274N/A *)
207N/A # Dry-Run file is not a URL, so resolve relative paths
651N/A DRYDIR=`dirname ${OPTARG}`
274N/A DRYNAME=`basename ${OPTARG}`
274N/A if [ ! -d "${DRYDIR}" -o ! -w "${DRYDIR}" ]; then
456N/A ${PRINTF} "`${GETTEXT} '%s is not a directory or is not writable'`\n" "${DRYDIR}"
274N/A exit 1
274N/A fi
274N/A DRYDIR=`cd $DRYDIR; pwd`
274N/A DRYRUN="${DRYDIR}/${DRYNAME}"
274N/A ;;
651N/A esac
651N/A ;;
274N/A s) CONFIGSTATE=${OPTARG}
457N/A ;;
457N/A V) VERSIONFLAG=true
457N/A ;;
207N/A l) DEBUGLEVEL=${OPTARG}
457N/A ;;
207N/A m) MEDIALOC=${OPTARG}
457N/A ;;
457N/A i) INSTALLABLES=${OPTARG}
457N/A ;;
457N/A j) JAVAHOME=${OPTARG}
457N/A
457N/A if [ ! -d ${JAVAHOME} -o ! -r ${JAVAHOME} ] ; then
274N/A ${PRINTF} "`${GETTEXT} '%s must be the root directory of a valid JVM installation'`\n" "${JAVAHOME}"
207N/A exit 1
207N/A fi
207N/A ;;
816N/A J) [ -n "${OPTARG}" ] && JAVA_OPTIONS="${OPTARG}"
207N/A ;;
207N/A C) ADDITIONALCLASSPATHS=${OPTARG}
508N/A ;;
207N/A p) INSTALLPROPS="${INSTALLPROPS} -p ${OPTARG}"
207N/A ;;
656N/A c) INSTALLPROPS="${INSTALLPROPS} -c ${OPTARG}"
656N/A ;;
656N/A ?|h) usage
656N/A ;;
656N/A esac
656N/Adone
656N/A
656N/Aif [ -n "${VERSIONFLAG}" ] ; then
656N/A ${ECHO} "openInstaller Install Framework 0.9.5"
359N/A ${ECHO}
359N/A echo `${GETTEXT} "Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved."`
359N/A echo `${GETTEXT} "Use is subject to license terms."`
207N/A ${ECHO}
207N/A ${PRINTF} "`${GETTEXT} 'Version : %s'`\n" "0.9.5"
359N/A ${PRINTF} "`${GETTEXT} 'Release : %s'`\n" "1.1"
253N/A ${PRINTF} "`${GETTEXT} 'Build : %s'`\n" "21feea6cc64b"
253N/A ${PRINTF} "`${GETTEXT} 'Assembled on : %s'`\n" "Fri, Apr 4, 2008 02:24 PM PDT"
253N/A exit 0
207N/Afi
667N/A
667N/A# If its a dry-run and answer file is specified
667N/A# Verify if it already exists. if so, inform the user to choose a different
672N/A# answer file and quit.
672N/Aif [ -n "${DRYRUN}" -a -f "${DRYRUN}" ] ; then
672N/A ${PRINTF} "`${GETTEXT} 'Dry Run File %s already exists. Please choose a non-existing file path'`\n" "${DRYRUN}"
667N/A exit 1
672N/Afi
672N/A
672N/Aif [ -z "${JAVAHOME}" ] ; then
667N/A ${PRINTF} "`${GETTEXT} 'Must specify a java installation using %s'`\n" -j
207N/A exit 1
207N/Afi
207N/A
207N/Aperform
270N/A
270N/Aexit $instCode
459N/A