using java_opts env var
@@ -25,7 +25,14 @@ DETECT_USE_SNAPSHOT=${DETECT_USE_SNAPSHOT:-0}
DETECT_JAR_PATH=${DETECT_JAR_PATH:-/tmp}
-JAVAOPTS="$@"
+# If you want to pass any java options to the
+# invocation, specify DETECT_JAVA_OPTS in your
+# environment. For example, to specify a 6 gigabyte
+# heap size, you would set DETECT_JAVA_OPTS=-Xmx6G.
+
+DETECT_JAVA_OPTS=${DETECT_JAVA_OPTS:-}
+
+SCRIPT_ARGS="$@"
run() {
get_detect
@@ -70,12 +77,12 @@ get_detect() {
}
run_detect() {
- JAVACMD="java -jar ${DETECT_DESTINATION}"
- echo "running detect: ${JAVACMD} ${JAVAOPTS}"
+ JAVACMD="java ${DETECT_JAVA_OPTS} -jar ${DETECT_DESTINATION}"
+ echo "running detect: ${JAVACMD} ${SCRIPT_ARGS}"
rm $DETECT_JAR_PATH/hub-detect-java.sh
echo "#!/bin/sh" >> $DETECT_JAR_PATH/hub-detect-java.sh
echo "" >> $DETECT_JAR_PATH/hub-detect-java.sh
- echo $JAVACMD $JAVAOPTS >> $DETECT_JAR_PATH/hub-detect-java.sh
+ echo $JAVACMD $SCRIPT_ARGS >> $DETECT_JAR_PATH/hub-detect-java.sh
source $DETECT_JAR_PATH/hub-detect-java.sh
RESULT=$?
echo "Result code of ${RESULT}, exiting"
