#!/bin/sh # # Copyright (c) 2012-2013 Linagora # This program/library is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 2.1 of the License, or (at your # option) any later version. # # This program/library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License # for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program/library; If not, see # for the GNU Lesser General Public License version 2.1. # ############################################################################## # # Petals CLI Bootstrap Script # # Environment variables: # # JAVA_HOME Directory containing the JRE. Use the java executable # found in $PATH if not defined. # # JAVA_OPTS Options for the JVM. Try "java -h" to get informations # about the available options for your environment # ############################################################################# # Set the path to the java executable JAVA="$JAVA_HOME/bin/java" [ -x "$JAVA" ] || JAVA="`which java`" || { echo "ERROR: java executable not found" >&2 exit 1 } # Set the path to bootstrap jar PETALS_CLI_JAR="/usr/share/petals-cli/petals-cli.jar" [ -f "$PETALS_CLI_JAR" ] || { echo "ERROR: petals-cli.jar: the jar archive was not found" >&2 exit 1 } PETALS_CLI_CLASSPATH=$PETALS_CLI_JAR # Add installed Petals CLI extensions to the classpath PETALS_CLI_EXTENSIONS=`ls -1 /usr/share/petals-cli/extensions/*.jar 2>/dev/null` for EXTENSION in $PETALS_CLI_EXTENSIONS do PETALS_CLI_CLASSPATH=$PETALS_CLI_CLASSPATH:$EXTENSION done # Set an potential user preference file USER_PREFS=$HOME/.petals-cli/petals-cli.default if [ -f "$USER_PREFS" ]; then # A user preference file exists, it is used. export PETALS_CLI_PREFS="$USER_PREFS" else # Default preferences export PETALS_CLI_PREFS=/etc/petals-cli/petals-cli.default fi # Start exec "$JAVA" -classpath $PETALS_CLI_CLASSPATH $JAVA_OPTS -Djline.shutdownhook=true org.ow2.petals.cli.Main "$@"