#!/bin/ksh93 # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License") # (see http://www.opensource.org/licenses/CDDL-1.0). # # Copyright (c) 2011-2012 Jens Elkner. All rights reserved. # Use is subject to license terms. SDIR=${.sh.file} && SDIR=${SDIR%/*} && [[ $SDIR == ${.sh.file} ]] && SDIR=$PWD # + is a link to pfexec if the Primary Administrator profile is available, # otherwise it should be a link to sudo #INSTDIR=/opt/glassfish/v3 #INSTDIR=/opt/glassfish/v3.1 INSTDIR=/opt/glassfish/v3.1.2 #ARCHIVE=/net/isis/export/downloads/sun/GF-ESv3/sges-v3-unix.sh #ARCHIVE=/net/isis/export/downloads/sun/GF-ESv3/glassfish-v3-unix.sh #ARCHIVE=/net/isis/export/downloads/sun/GF-ESv3.1/glassfish-3.1-unix-ml.sh ARCHIVE=/net/isis/export/downloads/java/glassfish-3.1.2-web-b20-unix-ml.sh export LC_CTYPE=en_US.UTF-8 # pkg install runtime/java/jre-{6|7} #JDK_TO_USE="/usr/jdk/instances/jdk1.6.0" JDK_TO_USE="/usr/jdk/instances/jdk1.7.0" # defaults changable by command line options HTTP_PORT="8080" ADMIN_PORT="4848" PASSWORD="12345678" ACCOUNT="admin" UPDATE="true" ANSWERFILE=/tmp/answer.$$ export PATH=${JDK_TO_USE}/bin:$PATH Usage() { printf ' Usage: %s [-p httpPort] [-P adminPort] [-A user] [-a password] [-u] [-d destdir] [-f file] Installs glassfish v3 software in command line mode. Options: -p port .. default HTTP to use. Default: 8080 -P port .. default HTTP port for the Admin GUI. Default: 4848 -a password .. admin password to use. Default: 12345678 -A name .. default admin user name to use. Default: admin NOTE: This is a web account, which gets created, i.e. it has nothing to do with any account on the OS. -u .. disable update check/update tool. Default: enable -h .. Print this help and exit. -d dir .. Install directory. Default: %s -f file .. Use the archive file instead of the default one: %s ' ${0##*/} "$INSTDIR" "$ARCHIVE" } while getopts "p:(httpPort)P:(adminPort)A:(user)a:(password)h(help)d:(destdir)f:(archive)" option ; do case "$option" in h) Usage ; exit 0 ;; u) UPDATE="false" ;; a) PASSWORD="$OPTARG" ;; A) ACCOUNT="$OPTARG" ;; P) ADMIN_PORT="$OPTARG" ;; p) HTTP_PORT="$OPTARG" ;; d) INSTDIR="$OPTARG" ;; f) ARCHIVE="$OPTARG" ;; *) Usage ; exit 3 esac done if [[ ! -r $ARCHIVE ]]; then print -u2 "Unable to read archive $ARCHIVE - exiting." exit 1 fi # Install Glassfish v3 (GF)/Sun GlassFish Enterprise Server v3 (GF-ES) + mkdir -p "$INSTDIR" && + chown "$(id -u):$(id -g)" "$INSTDIR" (( $? != 0)) && exit 2 printf 'License.license.ACCEPT_LICENSE=0 InstallHome.directory.INSTALL_HOME=%s glassfish.Administration.HTTP_PORT=%s glassfish.Administration.ADMIN_PORT=%s glassfish.Administration.ADMIN_USER=%s glassfish.Administration.ADMIN_PASSWORD=%s updatetool.Configuration.ALLOW_UPDATE_CHECK=%s updatetool.Configuration.BOOTSTRAP_UPDATETOOL=%s JDKSelection.directory.JDK_TYPED_IN_CHOICE=true JDKSelection.directory.JDK_TYPE_IN=%s ' "$INSTDIR" "$HTTP_PORT" "$ADMIN_PORT" "$ACCOUNT" "$PASSWORD" \ "$UPDATE" "$UPDATE" "$JDK_TO_USE" >$ANSWERFILE if [[ ! -x $JAVA_HOME/jar ]]; then [[ ! -d $HOME/bin ]] && mkdir $HOME/bin cat >$HOME/bin/jar<