create-webstart-standalone.sh revision 5157
575N/A#!/bin/sh
575N/A
575N/A
575N/A# Determine the location to this script so that we know where we are in the
575N/A# OpenDS source tree.
3488N/Acd "`dirname $0`"
575N/ASCRIPT_DIR=`pwd`
575N/Acd ../..
575N/AROOT_DIR=`pwd`
575N/Acd "${SCRIPT_DIR}"
575N/A
575N/A
575N/A# Make sure that a few constants are defined that will be needed to build the
575N/A# web start archive.
575N/Aif test -z "${PROTOCOL}"
575N/Athen
575N/A PROTOCOL="http"
575N/Afi
575N/Aecho "PROTOCOL: ${PROTOCOL}"
575N/A
575N/Aif test -z "${ADDRESS}"
575N/Athen
3256N/A ADDRESS="www.opends.org"
575N/Afi
575N/Aecho "ADDRESS: ${ADDRESS}"
575N/Aecho "PORT: ${PORT}"
575N/A
575N/Aif test -z "${BASE_PATH}"
575N/Athen
575N/A BASE_PATH="/install"
575N/Afi
575N/Aecho "BASE_PATH: ${BASE_PATH}"
575N/A
1158N/Aif test -z "${INSTALL_JNLP_FILENAME}"
575N/Athen
1158N/A INSTALL_JNLP_FILENAME="QuickSetup.jnlp"
575N/Afi
1158N/Aecho "INSTALL_JNLP_FILENAME: ${INSTALL_JNLP_FILENAME}"
1158N/A
575N/Aif test -z "${PORT}"
575N/Athen
575N/A INSTALLER_URI="${PROTOCOL}://${ADDRESS}${BASE_PATH}"
575N/Aelse
575N/A INSTALLER_URI="${PROTOCOL}://${ADDRESS}:${PORT}${BASE_PATH}"
575N/Afi
575N/A
575N/A
575N/A# See if we can find the location of the dependencies in the Java environment.
575N/A# If not, then fail.
575N/Aif test -z "${JAVA_HOME}"
575N/Athen
575N/A JAVA_HOME=`java -cp ${ROOT_DIR}/resource FindJavaHome 2> /dev/null`
575N/A if test -z "${JAVA_HOME}"
575N/A then
575N/A echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
575N/A exit 1
575N/A else
575N/A export JAVA_HOME
575N/A fi
575N/Afi
575N/A
575N/AJAR="${JAVA_HOME}/bin/jar"
575N/Aif test ! -x "${JAR}"
575N/Athen
575N/A echo "ERROR: Cannot find the ${JAR} utility."
575N/A echo " Is JAVA_HOME set correctly?"
575N/A echo " It should point to the root of a JDK (not a JRE) installation"
575N/A exit 1
575N/Afi
575N/A
575N/AJARSIGNER="${JAVA_HOME}/bin/jarsigner"
575N/Aif test ! -x "${JARSIGNER}"
575N/Athen
575N/A echo "ERROR: Cannot find the ${JARSIGNER} utility."
575N/A echo " Is JAVA_HOME set correctly?"
575N/A echo " It should point to the root of a JDK (not a JRE) installation"
575N/A exit 1
575N/Afi
575N/A
575N/A# Make sure that the OpenDS build directory exists. If not, then create it.
5157N/Aif test -z "${BUILD_DIR}"
5157N/Athen
5157N/A BUILD_DIR="${ROOT_DIR}/build"
5157N/Afi
5157N/Aecho "BUILD_DIR: ${BUILD_DIR}"
5157N/A
575N/Aif test ! -d "${BUILD_DIR}"
575N/Athen
575N/A echo "WARNING: ${BUILD_DIR} does not exist. Building the server ..."
575N/A "${ROOT_DIR}/build.sh"
575N/A EXIT_CODE=$?
575N/A if test "${EXIT_CODE}" -ne 0
575N/A then
575N/A echo "ERROR: Build failed. Aborting creation of web start archive."
575N/A exit ${EXIT_CODE}
575N/A else
575N/A echo "The server was built successfully."
575N/A fi
575N/Afi
575N/A
575N/A
575N/A# Determine what the name should be for the OpenDS zip file name, but without
575N/A# the ".zip" extension.
5157N/AZIP_FILEPATH=`ls ${BUILD_DIR}/package/OpenDS*.zip`
1346N/AZIP_FILENAME=`basename ${ZIP_FILEPATH}`
1346N/AZIP_FILENAME_BASE=`echo ${ZIP_FILENAME} | sed -e 's/\.zip//'`
575N/A
575N/A
575N/A# Create the directory structure into which we will place the archive.
575N/Aecho "Creating the initial directory structure ..."
575N/AWEBSTART_DIR="${BUILD_DIR}/webstart"
575N/AINSTALL_DIR="${WEBSTART_DIR}/install"
575N/Arm -rf "${INSTALL_DIR}"
575N/Amkdir -p "${INSTALL_DIR}/lib"
575N/A
575N/A
575N/A# Copy the static files from the script directory into the appropriate places
575N/A# in the archive.
575N/Aecho "Copying static content into place ..."
575N/Acp -Rp "${SCRIPT_DIR}/images" "${INSTALL_DIR}"
1214N/Afind "${INSTALL_DIR}/images" -type d -name '.svn' -exec rm -rf {} \;
575N/A
575N/A
575N/A# Copy the appropriate OpenDS library files and make sure they are signed.
575N/APKG_LIB_DIR="${BUILD_DIR}/package/${ZIP_FILENAME_BASE}/lib"
575N/ACERT_KEYSTORE="${ROOT_DIR}/tests/unit-tests-testng/resource/server.keystore"
575N/ACERT_KEYSTORE_PIN="password"
575N/ACERT_ALIAS="server-cert"
4764N/Afor LIBFILE in OpenDS.jar je.jar quicksetup.jar
575N/Ado
575N/A echo "Signing ${LIBFILE} ..."
575N/A cp "${PKG_LIB_DIR}/${LIBFILE}" "${INSTALL_DIR}/lib"
575N/A "${JARSIGNER}" -keystore "${CERT_KEYSTORE}" -keypass "${CERT_KEYSTORE_PIN}" \
575N/A -storepass "${CERT_KEYSTORE_PIN}" \
575N/A "${INSTALL_DIR}/lib/${LIBFILE}" "${CERT_ALIAS}"
575N/Adone
575N/A
575N/A
575N/A# Create and sign the zipped.jar file.
575N/Aecho "Creating zipped.jar ..."
575N/Acd "${BUILD_DIR}/package"
575N/A"${JAR}" -cf "${INSTALL_DIR}/lib/zipped.jar" "${ZIP_FILENAME_BASE}.zip"
575N/Acd "${INSTALL_DIR}/lib"
575N/Aecho "Signing zipped.jar ..."
575N/A"${JARSIGNER}" -keystore "${CERT_KEYSTORE}" -keypass "${CERT_KEYSTORE_PIN}" \
575N/A -storepass "${CERT_KEYSTORE_PIN}" zipped.jar "${CERT_ALIAS}"
575N/A
575N/A
1158N/A# Create the Setup JNLP file with the appropriate contents.
1158N/Aecho "Creating Setup JNLP file ${INSTALL_JNLP_FILENAME} ..."
575N/Acd ..
1158N/Acat > "${INSTALL_JNLP_FILENAME}" <<ENDOFINSTALLJNLP
575N/A<?xml version="1.0" encoding="utf-8"?>
1365N/A<!-- JNLP File for OpenDS QuickSetup Application -->
953N/A<jnlp spec="1.5+"
1158N/A codebase="${INSTALLER_URI}" href="${INSTALL_JNLP_FILENAME}">
575N/A <information>
1365N/A <title>OpenDS QuickSetup Application</title>
575N/A <vendor>http://www.opends.org/</vendor>
575N/A <homepage href="http://www.opends.org"/>
1365N/A <description>OpenDS QuickSetup Application</description>
575N/A <description kind="short">OpenDS Web Start Installer</description>
575N/A <icon href="images/opendshref.png" height="128" width="128"/>
575N/A <icon kind="splash" href="images/opendssplash.png" height="114" width="479"/>
575N/A </information>
575N/A
575N/A <security>
575N/A <all-permissions/>
575N/A </security>
575N/A
575N/A <resources>
575N/A <j2se version="1.5+" java-vm-args="-client"/>
575N/A <jar href="lib/quicksetup.jar" download="eager" main="true"/>
575N/A <jar href="lib/OpenDS.jar" download="lazy"/>
575N/A <jar href="lib/je.jar" download="lazy"/>
575N/A <jar href="lib/zipped.jar" download="lazy"/>
575N/A <property name="org.opends.quicksetup.iswebstart" value="true" />
2152N/A <property name="org.opends.quicksetup.Application.class" value="org.opends.quicksetup.installandupgrader.InstallAndUpgrader"/>
4764N/A <property name="org.opends.quicksetup.lazyjarurls" value="${INSTALLER_URI}/lib/OpenDS.jar ${INSTALLER_URI}/lib/zipped.jar ${INSTALLER_URI}/lib/je.jar" />
575N/A <property name="org.opends.quicksetup.zipfilename" value="${ZIP_FILENAME_BASE}.zip"/>
575N/A </resources>
579N/A
579N/A <resources os="AIX">
579N/A <j2se version="1.5+"/>
579N/A </resources>
579N/A
575N/A <application-desc main-class="org.opends.quicksetup.SplashScreen"/>
575N/A</jnlp>
1158N/AENDOFINSTALLJNLP
1158N/A
575N/A
575N/A# Tell the user where the files are.
5157N/Aecho "The deployable content may be found in ${BUILD_DIR}/webstart"
575N/Aecho "It is intended for deployment at ${INSTALLER_URI}"
575N/A