#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
#
# The contents of this file are subject to the terms of either the GNU
# General Public License Version 2 only ("GPL") or the Common Development
# and Distribution License("CDDL") (collectively, the "License"). You
# may not use this file except in compliance with the License. You can
# obtain a copy of the License at
# or packager/legal/LICENSE.txt. See the License for the specific
# language governing permissions and limitations under the License.
#
# When distributing the software, include this License Header Notice in each
# file and include the License file at packager/legal/LICENSE.txt.
#
# GPL Classpath Exception:
# Oracle designates this particular file as subject to the "Classpath"
# exception as provided by Oracle in the GPL Version 2 section of the License
# file that accompanied this code.
#
# Modifications:
# If applicable, add the following below the License Header, with the fields
# enclosed by brackets [] replaced by your own identifying information:
# "Portions Copyright [year] [name of copyright owner]"
#
# Contributor(s):
# If you wish your version of this file to be governed by only the CDDL or
# only the GPL Version 2, indicate your decision by adding "[Contributor]
# elects to include this software in this distribution under the [CDDL or GPL
# Version 2] license." If you don't indicate a single choice of license, a
# recipient has the option to distribute your version of this file under
# either the CDDL, the GPL Version 2 or to extend the choice of license to
# its licensees as provided above. However, if you add GPL Version 2 code
# and therefore, elected the GPL Version 2 license, then the option applies
# only if the new code is made subject to such option by the copyright
# holder.
#
# Sample fake product.
PRODUCTNAME="Domain"
ORIG_ARGS=$@
# binaries needed on both Solaris, Linux, etc.
TEXTDOMAINDIR="@LOCALEDIR@"
# global settings
JAVAOPTIONS="-Dorg.openinstaller.provider.configurator.class=org.openinstaller.provider.conf.InstallationConfigurator"
# user options
DEBUGLEVEL="INFO"
#-------------------------------------------------------------------------------
# usage only: define what parameters are available here
# input(s): exitCode
#-------------------------------------------------------------------------------
${CAT} <<EOF
Usage: <GlassFish installation program.> [-options]
where options include:
-a <answerfile>
run this program in silent mode using the answerfile provided, should be used with -s option.
-l <Complete path to Log Directory>
log information goes to this directory
-q Logging level set to WARNING
-v Logging level set to FINEST
-s run this application silent mode
-j <javahome>
JRE installation directory to be used by this program.
-n <savefile>
run the program in dry-run mode and generate savefile to be used for silent mode
-h
-help
print this help message
EOF
exit $1
}
#-------------------------------------------------------------------------------
# input(s): none
# output(s): instCode
#-------------------------------------------------------------------------------
ENGINE_OPS="-m file://${MYDIR}/install/metadata/"
ENGINE_OPS="${ENGINE_OPS} -a file://${MYDIR}/install.properties"
ENGINE_OPS="${ENGINE_OPS} -i file://${MYDIR}/Product/"
ENGINE_OPS="${ENGINE_OPS} -p Default-Product-ID=${PRODUCTNAME}"
ENGINE_OPS="${ENGINE_OPS} -p Pkg-Format=zip"
ENGINE_OPS="${ENGINE_OPS} -C ${MYDIR}/pkg-bootstrap.jar:${MYDIR}/pkg-client.jar:${MYDIR}/registration-api.jar:${MYDIR}/registration-impl.jar:${MYDIR}/common-util.jar"
# add ubi-enabled packaging tool location to environment so that it
# is picked up by PH engine.
#
export INSTALL_OSTOOLS
if [ -n "${DRYRUN}" ] ; then
ENGINE_OPS="${ENGINE_OPS} -n ${DRYRUN}"
fi
if [ -n "${ANSWERFILE}" ] ; then
ENGINE_OPS="${ENGINE_OPS} -a ${ANSWERFILE}"
fi
if [ -n "${ALTROOT}" ] ; then
ENGINE_OPS="${ENGINE_OPS} -R ${ALTROOT}"
fi
if [ -n "${LOGLEVEL}" ] ; then
ENGINE_OPS="${ENGINE_OPS} -l ${LOGLEVEL}"
fi
if [ -n "${LOGDIR}" ] ; then
ENGINE_OPS="${ENGINE_OPS} -p Logs-Location=${LOGDIR}"
fi
if [ -n "${JAVA_HOME}" ] ; then
ENGINE_OPS="${ENGINE_OPS} -j ${JAVA_HOME}"
fi
if [ -n "${INSTALLPROPS}" ] ; then
ENGINE_OPS="${ENGINE_OPS} ${INSTALLPROPS}"
fi
if [ -n "${INSTALLABLES}" ] ; then
ENGINE_OPS="${ENGINE_OPS} -i ${INSTALLABLES}"
fi
instCode=$?
}
#-------------------------------------------------------------------------------
# cleanup temporary files
#-------------------------------------------------------------------------------
if [ ! -d ${INST_DIR} ] ; then
return
fi
# Preventative measure to not nuke entire system
cd ${INST_DIR}
_pwd=`pwd`
cd /
echo "Cleaning up temporary environment."
fi
}
#-------------------------------------------------------------------------------
# retrieve bundled JVM from Media based on os and platfo${RM}
# input(s): none
# output(s): JAVAMEDIAPATH
#-------------------------------------------------------------------------------
"SunOS")
"sparc")
;;
"i386")
;;
*)
echo "Unknown platform, exiting"
exit 1
;;
esac
;;
"Linux")
;;
"HP-UX")
JAVAMEDIAPATH="HP-UX"
;;
"AIX")
JAVAMEDIAPATH="AIX"
;;
*)
exit 1
;;
esac
}
#-------------------------------------------------------------------------------
# login the user as root user
# use the 'su' command to ask for password and run the installer
#-------------------------------------------------------------------------------
${ECHO}
echo "To use this installer, you will need to be the system's root user. \n"
fi
status=1;
retry=3;
echo "Please enter this system's root user password \n"
status=$?
${ECHO} " "
done
echo "Administrative privilege is req'd to perform this operation. Exiting.\n"
exit 1
fi
exit
fi
unset userId
unset status
unset retry
}
if [ ! -d ${JAVA_HOME} ] ; then
echo "${JAVA_HOME} must be the root directory of a valid JVM installation"
echo "Please provide JAVA_HOME as argument with -j option and proceed."
exit 1
fi
}
#-------------------------------------------------------------------------------
# ****************************** MAIN THREAD ***********************************
#-------------------------------------------------------------------------------
# Linux has no built-in support for long-style getopts so we use the short style only
LONGOPT="h(help)l:(logdir)q(quiet)v(verbose)t(text)n:(dry-run)a:(answerfile)j:(javahome)R:(altroot)J:(jvmoptions)p:(properties)"
SHORTOPT="hl:n:qvta:R:j:J:p:"
export TEXTDOMAINDIR
if [ "${OS1}" = SunOS ] ; then
case "${OS2}" in
2.* | 5.7 | 5.8)
echo "openInstaller is only supported on Solaris 9 or later"
exit 1
;;
esac
fi
# Long opt doesnt work on Open Solaris also, so have shortopt for all of OS.
# check arguments
while getopts "${OPTSTRING}" opt ; do
case "${opt}" in
a) ANSWERFILE=${OPTARG}
;;
echo "${LOGDIR} is not a directory or is not writable"
exit 1
fi
;;
;;
;;
;;
echo "${JAVA_HOME} must be the root directory of a valid JVM installation"
exit 1
fi
;;
J) JAVAOPTIONS=${OPTARG}
;;
p) INSTALLPROPS="${INSTALLPROPS} -p ${OPTARG}"
;;
?|h) usage
;;
esac
done
${ECHO}
echo "Welcome to GlassFish installer"
${ECHO}
# check user for access privileges
#loginAsRoot
trap 'cleanup; exit' 1 2 13 15
# overwrite check if user specify javahome to use
if [ -z "$JAVA_HOME" ]; then
echo "Creating temporary environment..."
else
echo "Using the user defined JAVA_HOME : ${JAVA_HOME}"
fi
echo "Entering setup..."
exit $instCode