575N/A#!/bin/sh
6110N/A#
6110N/A# CDDL HEADER START
6110N/A#
6110N/A# The contents of this file are subject to the terms of the
6110N/A# Common Development and Distribution License, Version 1.0 only
6110N/A# (the "License"). You may not use this file except in compliance
6110N/A# with the License.
6110N/A#
6110N/A# You can obtain a copy of the license at
6110N/A# trunk/opends/resource/legal-notices/CDDLv1_0.txt
6110N/A# or http://forgerock.org/license/CDDLv1.0.html.
6110N/A# See the License for the specific language governing permissions
6110N/A# and limitations under the License.
6110N/A#
6110N/A# When distributing Covered Code, include this CDDL HEADER in each
6110N/A# file and include the License file at
6110N/A# trunk/opends/resource/legal-notices/CDDLv1_0.txt. If applicable,
6110N/A# add the following below this CDDL HEADER, with the fields enclosed
6110N/A# by brackets "[]" replaced with your own identifying information:
6110N/A# Portions Copyright [yyyy] [name of copyright owner]
6110N/A#
6110N/A# CDDL HEADER END
6110N/A#
6110N/A# Portions Copyright 2006-2010 Sun Microsystems Inc.
6110N/A# Copyright 2010-2013 ForgeRock AS
575N/A
575N/A# Determine the location to this script so that we know where we are in the
5612N/A# OpenDJ source tree.
6110N/ALAUNCH_DIR=`dirname "$0"`
6110N/Acd "${LAUNCH_DIR}"
575N/ASCRIPT_DIR=`pwd`
575N/Acd ../..
575N/AROOT_DIR=`pwd`
575N/Acd "${SCRIPT_DIR}"
5250N/Aecho "ROOT_DIR: ${ROOT_DIR}"
575N/A
5250N/Aif test -z "${PRODUCT_FILE}"
5612N/Athen
5250N/A PRODUCT_FILE="${ROOT_DIR}/PRODUCT"
5250N/Afi
5250N/Aecho "PRODUCT_FILE: ${PRODUCT_FILE}"
5250N/A
5250N/Aif test -z "${PRODUCT_NAME}"
5250N/Athen
5907N/A PRODUCT_NAME=`grep SHORT_NAME "${PRODUCT_FILE}" | cut -d= -f2`
5250N/Afi
5250N/Aecho "PRODUCT_NAME: ${PRODUCT_NAME}"
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
5252N/A ADDRESS="www.forgerock.org"
575N/Afi
575N/Aecho "ADDRESS: ${ADDRESS}"
575N/Aecho "PORT: ${PORT}"
575N/A
575N/Aif test -z "${BASE_PATH}"
575N/Athen
5250N/A BASE_PATH="/downloads/opendj/latest/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
5252N/AVENDOR="http://www.forgerock.com/"
5252N/AHOMEPAGE="http://www.forgerock.com/opendj.html"
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
6110N/A JAVA_HOME=`java -cp "${ROOT_DIR}/resource" FindJavaHome 2> /dev/null`
575N/A if test -z "${JAVA_HOME}"
575N/A then
6307N/A echo "Please set JAVA_HOME to the root of a Java 6.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
5612N/A# Make sure that the OpenDJ build directory exists. If not, then create it.
5250N/A
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
5612N/A# Determine what the name should be for the OpenDJ zip file name, but without
575N/A# the ".zip" extension.
6110N/AZIP_FILEPATH=`ls "${BUILD_DIR}"/package/${PRODUCT_NAME}*.zip`
6110N/AZIP_FILENAME=`basename "${ZIP_FILEPATH}"`
6110N/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
5612N/A# Copy the appropriate OpenDJ 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"
6182N/Afor LIBFILE in "${PRODUCT_NAME}.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
6315N/A# Create and sign the licence.jar file if exists.
6315N/Aif [ -d ${BUILD_DIR}/package/${ZIP_FILENAME_BASE}/Legal ]
6315N/Athen
6315N/Aecho "Creating license.jar ..."
6315N/Acp "${BUILD_DIR}/package/${ZIP_FILENAME_BASE}/Legal" "${INSTALL_DIR}/lib"
6315N/Acd "${BUILD_DIR}/package"
6315N/A"${JAR}" -cf "${INSTALL_DIR}/lib/license.jar" -C "${BUILD_DIR}/package/${ZIP_FILENAME_BASE}/" "Legal"
6315N/Acd "${INSTALL_DIR}/lib"
6315N/Aecho "Signing license.jar ..."
6315N/A"${JARSIGNER}" -keystore "${CERT_KEYSTORE}" -keypass "${CERT_KEYSTORE_PIN}" \
6315N/A -storepass "${CERT_KEYSTORE_PIN}" license.jar "${CERT_ALIAS}"
6315N/A# Create the resource line to add to the jnlp script.
6315N/ALICENSEJAR="<jar href=\"lib/license.jar\" download=\"eager\"/>"
6315N/Afi
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"?>
5250N/A<!-- JNLP File for ${PRODUCT_NAME} QuickSetup Application -->
953N/A<jnlp spec="1.5+"
1158N/A codebase="${INSTALLER_URI}" href="${INSTALL_JNLP_FILENAME}">
575N/A <information>
5250N/A <title>${PRODUCT_NAME} QuickSetup Application</title>
5252N/A <vendor>${VENDOR}</vendor>
5252N/A <homepage href="${HOMEPAGE}"/>
5250N/A <description>${PRODUCT_NAME} QuickSetup Application</description>
5250N/A <description kind="short">${PRODUCT_NAME} Web Start Installer</description>
6307N/A <icon href="images/opendjhref.png" height="128" width="128"/>
6307N/A <icon kind="splash" href="images/opendjsplash.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>
5218N/A <j2se version="1.6+" java-vm-args="-client"/>
575N/A <jar href="lib/quicksetup.jar" download="eager" main="true"/>
6315N/A ${LICENSEJAR}
6182N/A <jar href="lib/${PRODUCT_NAME}.jar" download="lazy"/>
6182N/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" />
6265N/A <property name="org.opends.quicksetup.Application.class" value="org.opends.quicksetup.installer.webstart.WebStartInstaller"/>
6182N/A <property name="org.opends.quicksetup.lazyjarurls" value="${INSTALLER_URI}/lib/${PRODUCT_NAME}.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>
5612N/A
579N/A <resources os="AIX">
5218N/A <j2se version="1.6+"/>
579N/A </resources>
5612N/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