diff options
-rwxr-xr-x | etherpad/bin/java-version.sh | 72 | ||||
-rwxr-xr-x | etherpad/bin/rebuildjar.sh | 2 | ||||
-rw-r--r-- | etherpad/src/etherpad/control/pro/pro_main_control.js | 2 | ||||
-rw-r--r-- | infrastructure/net.appjet.oui/main.scala | 6 |
4 files changed, 78 insertions, 4 deletions
diff --git a/etherpad/bin/java-version.sh b/etherpad/bin/java-version.sh new file mode 100755 index 0000000..639920b --- /dev/null +++ b/etherpad/bin/java-version.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# This script attempts to find an existing installation of Java that meets a minimum version +# requirement on a Linux machine. If it is successful, it will export a JAVA_HOME environment +# variable that can be used by another calling script. +# +# To specify the required version, set the REQUIRED_VERSION to the major version required, +# e.g. 1.3, but not 1.3.1. +REQUIRED_VERSION=1.6 + +# Transform the required version string into a number that can be used in comparisons +REQUIRED_VERSION=`echo $REQUIRED_VERSION | sed -e 's;\.;0;g'` +# Check JAVA_HOME directory to see if Java version is adequate +if [ $JAVA_HOME ] +then + JAVA_EXE=$JAVA_HOME/bin/java + $JAVA_EXE -version 2> tmp.ver + VERSION=`cat tmp.ver | grep "java version" | awk '{ print substr($3, 2, length($3)-2); }'` + echo $VERSION + rm tmp.ver + VERSION=`echo $VERSION | awk '{ print substr($1, 1, 3); }' | sed -e 's;\.;0;g'` + if [ $VERSION ] + then + if [ $VERSION -ge $REQUIRED_VERSION ] + then + JAVA_HOME=`echo $JAVA_EXE | awk '{ print substr($1, 1, length($1)-9); }'` + else + JAVA_HOME= + fi + else + JAVA_HOME= + fi +fi + +# If the existing JAVA_HOME directory is adequate, then leave it alone +# otherwise, use 'locate' to search for other possible java candidates and +# check their versions. +if [ $JAVA_HOME ] +then + : +else + for JAVA_EXE in `locate bin/java | grep java$ | xargs echo` + do + if [ $JAVA_HOME ] + then + : + else + $JAVA_EXE -version 2> tmp.ver 1> /dev/null + VERSION=`cat tmp.ver | grep "java version" | awk '{ print substr($3, 2, length($3)-2); }'` + rm tmp.ver + VERSION=`echo $VERSION | awk '{ print substr($1, 1, 3); }' | sed -e 's;\.;0;g'` + if [ $VERSION ] + then + if [ $VERSION -ge $REQUIRED_VERSION ] + then + JAVA_HOME=`echo $JAVA_EXE` + else + echo "JAVA Version too old - Please install a new Java version" + fi + fi + fi + done +fi + +# If the correct Java version is detected, then export the JAVA_HOME environment variable +if [ $JAVA_HOME ] +then + `export JAVA_HOME="$JAVA_HOME"` + export JAVA_HOME + #echo $JAVA_HOME +fi + + diff --git a/etherpad/bin/rebuildjar.sh b/etherpad/bin/rebuildjar.sh index 9e802c2..fc05194 100755 --- a/etherpad/bin/rebuildjar.sh +++ b/etherpad/bin/rebuildjar.sh @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +bin/java-version.sh + if [ -z "$JAR" ]; then if [ ! -z `which fastjar` ]; then JAR=fastjar diff --git a/etherpad/src/etherpad/control/pro/pro_main_control.js b/etherpad/src/etherpad/control/pro/pro_main_control.js index 6a04655..f151091 100644 --- a/etherpad/src/etherpad/control/pro/pro_main_control.js +++ b/etherpad/src/etherpad/control/pro/pro_main_control.js @@ -70,7 +70,7 @@ function render_main() { renderFramed('pro/pro_home.ejs', { isEvaluation: licensing.isEvaluation(), - evalExpDate: licensing.getLicense().expiresDate, + // evalExpDate: licensing.getLicense().expiresDate, account: getSessionProAccount(), isPNE: pne_utils.isPNE(), pneVersion: pne_utils.getVersionString(), diff --git a/infrastructure/net.appjet.oui/main.scala b/infrastructure/net.appjet.oui/main.scala index 42cd268..8181fdf 100644 --- a/infrastructure/net.appjet.oui/main.scala +++ b/infrastructure/net.appjet.oui/main.scala @@ -220,9 +220,9 @@ object main { val handler = new Context(server, "/", Context.NO_SESSIONS | Context.NO_SECURITY); handler.addServlet(new ServletHolder(new OuiServlet), "/"); -// val filterHolder = new FilterHolder(new MultipartFilter()); -// filterHolder.setInitParameter("uploadDir", System.getProperty("java.io.tmpdir")); -// handler.addFilter(filterHolder, "/*", 1); + val filterHolder = new FilterHolder(new MultipartFilter()); + filterHolder.setInitParameter("uploadDir", System.getProperty("java.io.tmpdir")); + handler.addFilter(filterHolder, "/*", 1); global.context = handler; |