From 033be8f064bc856c55a37574c36600edca1277da Mon Sep 17 00:00:00 2001 From: Chris Ball Date: Mon, 5 Apr 2010 13:05:31 -0400 Subject: If fastjar 0.97/0.98 is installed, use jar instead. Otherwise the build will crash, due to: http://lists.gnu.org/archive/html/fastjar-dev/2009-12/msg00000.html --- etherpad/bin/rebuildjar.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/etherpad/bin/rebuildjar.sh b/etherpad/bin/rebuildjar.sh index fc05194..e733d6f 100755 --- a/etherpad/bin/rebuildjar.sh +++ b/etherpad/bin/rebuildjar.sh @@ -17,8 +17,15 @@ bin/java-version.sh if [ -z "$JAR" ]; then - if [ ! -z `which fastjar` ]; then - JAR=fastjar + if [ ! -z $(which fastjar 2>/dev/null) ]; then + # http://lists.gnu.org/archive/html/fastjar-dev/2009-12/msg00000.html + version=`fastjar --version | grep fastjar | sed 's/.* //g'` + if [[ "$version" = "0.97" || "$version" = "0.98" ]]; then + echo "fastjar version $version can't build etherpad. Falling back to standard jar." + JAR=jar + else + JAR=fastjar + fi else JAR=jar fi -- cgit v1.2.3 From d9cdda6e130c30020028c1da2c31c6f4cd72dfd4 Mon Sep 17 00:00:00 2001 From: Chris Ball Date: Wed, 23 Dec 2009 19:50:42 -0500 Subject: Silence `which growlnotify` output --- etherpad/bin/rebuildjar.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etherpad/bin/rebuildjar.sh b/etherpad/bin/rebuildjar.sh index e733d6f..61f180f 100755 --- a/etherpad/bin/rebuildjar.sh +++ b/etherpad/bin/rebuildjar.sh @@ -32,7 +32,7 @@ if [ -z "$JAR" ]; then fi function notify { - if [ ! -z `which growlnotify` ]; then + if [ ! -z $(which growlnotify 2>/dev/null) ]; then echo $0 finished | growlnotify fi } -- cgit v1.2.3 From 04669dd33b624a9827e335dff15d99f703ca49f8 Mon Sep 17 00:00:00 2001 From: Chris Ball Date: Wed, 23 Dec 2009 20:20:50 -0500 Subject: Add depschecking; check environment variables are pointing at existing files --- etherpad/bin/rebuildjar.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/etherpad/bin/rebuildjar.sh b/etherpad/bin/rebuildjar.sh index 61f180f..3238163 100755 --- a/etherpad/bin/rebuildjar.sh +++ b/etherpad/bin/rebuildjar.sh @@ -31,6 +31,32 @@ if [ -z "$JAR" ]; then fi fi +function depscheck { + if [ ! -d "$JAVA_HOME" ]; then + echo "\$JAVA_HOME does not point to an existing dir; should be e.g. /usr/java/latest" + exit 1 + fi + if [ ! -d "$SCALA_HOME" ]; then + echo "\$SCALA_HOME does not point to an existing dir; should be e.g. /usr/share/scala" + exit 1 + fi + if [ ! -e "$SCALA" ]; then + echo "\$SCALA does not point to an existing file; should be e.g. /usr/bin/scala" + exit 1 + fi + if [ ! -e "$JAVA" ]; then + echo "\$JAVA does not point to an existing file; should be e.g. /usr/bin/java" + exit 1 + fi + if [ ! -e "$MYSQL_CONNECTOR_JAR" ]; then + echo "\$MYSQL_CONNECTOR_JAR does not point to an existing file; should be e.g. /usr/share/java/mysql-connector-java.jar" + exit 1 + fi + +} + +depscheck + function notify { if [ ! -z $(which growlnotify 2>/dev/null) ]; then echo $0 finished | growlnotify -- cgit v1.2.3 From 6d5f97d67df88ba77cb38f62c08dcba9fe306f87 Mon Sep 17 00:00:00 2001 From: Chris Ball Date: Thu, 24 Dec 2009 01:53:41 -0500 Subject: Attempt to check for Sun javac, and warn the user if we don't find it. --- etherpad/bin/rebuildjar.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/etherpad/bin/rebuildjar.sh b/etherpad/bin/rebuildjar.sh index 3238163..a63cc0c 100755 --- a/etherpad/bin/rebuildjar.sh +++ b/etherpad/bin/rebuildjar.sh @@ -53,6 +53,22 @@ function depscheck { exit 1 fi + # Check for javac version. Unfortunately, javac doesn't tell you whether + # it's Sun Java or OpenJDK, but the "java" binary that's in the same + # directory will. + if [ -e "$JAVA_HOME/bin/java" ]; then + ($JAVA_HOME/bin/java -version 2>&1) | { + while read file; do + javaver=$file + done + for word in $javaver; do + if [ $word != "Java" ]; then + echo "$JAVA_HOME/bin/java is from a non-Sun compiler, and may not be able to compile etherpad. If you get syntax errors, you should point \$JAVA_HOME at a Sun Java JDK installation instead." + fi + break + done + } + fi } depscheck -- cgit v1.2.3 From dc553ec9c0a172c51a69ce2fe9599c1123d493ba Mon Sep 17 00:00:00 2001 From: Chris Ball Date: Mon, 5 Apr 2010 13:09:29 -0400 Subject: Make config parsing more robust Previously, config booleans like etherpad.isProduction accepted only "true", and not "true " or " true" or "True" or "TRUE". Fix that. --- etherpad/src/etherpad/globals.js | 4 +++- etherpad/src/etherpad/pne/pne_utils.js | 3 ++- etherpad/src/main.js | 3 ++- infrastructure/net.appjet.oui/config.scala | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/etherpad/src/etherpad/globals.js b/etherpad/src/etherpad/globals.js index 343a989..8087337 100644 --- a/etherpad/src/etherpad/globals.js +++ b/etherpad/src/etherpad/globals.js @@ -22,8 +22,10 @@ var COMETPATH = "/comet"; var COLOR_PALETTE = ['#ffc7c7','#fff1c7','#e3ffc7','#c7ffd5','#c7ffff','#c7d5ff','#e3c7ff','#ffc7f1','#ff8f8f','#ffe38f','#c7ff8f','#8fffab','#8fffff','#8fabff','#c78fff','#ff8fe3','#d97979','#d9c179','#a9d979','#79d991','#79d9d9','#7991d9','#a979d9','#d979c1','#d9a9a9','#d9cda9','#c1d9a9','#a9d9b5','#a9d9d9','#a9b5d9','#c1a9d9','#d9a9cd']; +var trueRegex = /\s*true\s*/i; + function isProduction() { - return (appjet.config['etherpad.isProduction'] == "true"); + return (trueRegex.test(appjet.config['etherpad.isProduction'])); } var SUPERDOMAINS = { diff --git a/etherpad/src/etherpad/pne/pne_utils.js b/etherpad/src/etherpad/pne/pne_utils.js index 3169407..bc105bd 100644 --- a/etherpad/src/etherpad/pne/pne_utils.js +++ b/etherpad/src/etherpad/pne/pne_utils.js @@ -72,7 +72,8 @@ function checkDbVersionUpgrade() { var dbVersion = parseVersionString(dbVersionString); var runningVersion = getVersionNumbers(); - var force = (appjet.config['etherpad.forceDbUpgrade'] == "true"); + var trueRegex = /\s*true\s*/i; + var force = trueRegex.test(appjet.config['etherpad.forceDbUpgrade']); if (!force && (runningVersion.major != dbVersion.major)) { println("Error: you are attempting to update an EtherPad["+dbVersionString+ diff --git a/etherpad/src/main.js b/etherpad/src/main.js index 745f5fa..c881223 100644 --- a/etherpad/src/main.js +++ b/etherpad/src/main.js @@ -259,7 +259,8 @@ function checkRequestIsWellFormed() { // checkHost() //---------------------------------------------------------------- function checkHost() { - if (appjet.config['etherpad.skipHostnameCheck'] == "true") { + var trueRegex = /\s*true\s*/i; + if (trueRegex.test(appjet.config['etherpad.skipHostnameCheck'])) { return; } diff --git a/infrastructure/net.appjet.oui/config.scala b/infrastructure/net.appjet.oui/config.scala index 46e73cf..6201816 100644 --- a/infrastructure/net.appjet.oui/config.scala +++ b/infrastructure/net.appjet.oui/config.scala @@ -41,7 +41,7 @@ object config { null; } } - def boolOrElse(name: String, default: Boolean) = values.get(name).map(_.equals("true")).getOrElse(default); + def boolOrElse(name: String, default: Boolean) = values.get(name).map(_.matches("(?i)\\s*true\\s*")).getOrElse(default); def intOrElse(name: String, default: Int) = values.get(name).map(Integer.parseInt(_)).getOrElse(default); def longOrElse(name: String, default: Long) = values.get(name).map(java.lang.Long.parseLong(_)).getOrElse(default); -- cgit v1.2.3 From ec9fcd7b971f2cab81050679f662c2a21ce87626 Mon Sep 17 00:00:00 2001 From: Jeppe Toustrup Date: Tue, 5 Jan 2010 23:21:39 +0100 Subject: Made check to see if we are on Solaris, and if we are, then don't use '-u' on the cp command. Also, convertion of spaces to tabs. --- infrastructure/bin/compilecache.sh | 84 +++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/infrastructure/bin/compilecache.sh b/infrastructure/bin/compilecache.sh index a2b6220..6e42a50 100644 --- a/infrastructure/bin/compilecache.sh +++ b/infrastructure/bin/compilecache.sh @@ -16,49 +16,51 @@ CP_CMD="cp -R -u" if [ `uname` == "Darwin" ]; then - CP_CMD="/bin/cp -R -n" + CP_CMD="/bin/cp -R -n" +elif [ `uname` == "SunOS" ]; then + CP_CMD="cp -R" #Solaris cp does not have '-u' fi function cacheonfiles { - NAME=$1; FILES=$2; FUNC=$3; NOCOPY=1; - if [ -z "$4" ]; then - NOCOPY=0 - fi - REBUILD=0 - BPATH=buildcache/$NAME - FILETEST=$BPATH/t - if [ ! -f $FILETEST ]; then - REBUILD=1 - else - for a in $FILES; do - if [ $FILETEST -ot $a ]; then - echo $a has changed, rebuilding $NAME + NAME=$1; FILES=$2; FUNC=$3; NOCOPY=1; + if [ -z "$4" ]; then + NOCOPY=0 + fi + REBUILD=0 + BPATH=buildcache/$NAME + FILETEST=$BPATH/t + if [ ! -f $FILETEST ]; then REBUILD=1 - fi - done - fi - if [ $REBUILD -eq 1 ]; then - if [ -d $BPATH ]; then - rm -rf $BPATH + else + for a in $FILES; do + if [ $FILETEST -ot $a ]; then + echo $a has changed, rebuilding $NAME + REBUILD=1 + fi + done + fi + if [ $REBUILD -eq 1 ]; then + if [ -d $BPATH ]; then + rm -rf $BPATH + fi + mkdir -p $BPATH + $FUNC $BPATH + pushd $BPATH >> /dev/null + touch t + popd >> /dev/null + else + echo using cached $NAME... + fi + if [ $NOCOPY -ne 1 ]; then + for a in $BPATH/*; do + if [ -d $a ]; then + $CP_CMD $a build/ + elif [ -f $a ]; then + cp $a build/ + else + echo unknown file type $a + exit 1 + fi + done fi - mkdir -p $BPATH - $FUNC $BPATH - pushd $BPATH >> /dev/null - touch t - popd >> /dev/null - else - echo using cached $NAME... - fi - if [ $NOCOPY -ne 1 ]; then - for a in $BPATH/*; do - if [ -d $a ]; then - $CP_CMD $a build/ - elif [ -f $a ]; then - cp $a build/ - else - echo unknown file type $a - exit 1 - fi - done - fi -} +} -- cgit v1.2.3 From 13bf676f0ce8201de185c83fedda0a16564eb53e Mon Sep 17 00:00:00 2001 From: Jeppe Toustrup Date: Tue, 5 Jan 2010 23:57:38 +0100 Subject: Changed the default setup to a production setup, use 'dev' as a parameter if you want a development setup. --- etherpad/bin/rebuildjar.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/etherpad/bin/rebuildjar.sh b/etherpad/bin/rebuildjar.sh index a63cc0c..40f6a10 100755 --- a/etherpad/bin/rebuildjar.sh +++ b/etherpad/bin/rebuildjar.sh @@ -82,10 +82,9 @@ trap notify EXIT source ../infrastructure/bin/compilecache.sh -suffix="-dev"; -if [ "$1" == "prod" ]; then - suffix=""; - shift; +if [ "$1" == "dev" ]; then + suffix="-dev"; + shift fi OWD=`pwd` -- cgit v1.2.3 From a057a37ce3ec2621fbfaadaea083aef0bd5180cc Mon Sep 17 00:00:00 2001 From: Jeppe Toustrup Date: Wed, 6 Jan 2010 00:16:02 +0100 Subject: Revamped the environment variable testing section, which now asks for values of variables not entered, and tries to guess paths to 'java' and 'scala' binaries. --- etherpad/bin/rebuildjar.sh | 111 +++++++++++++++++++++++++++++---------------- 1 file changed, 73 insertions(+), 38 deletions(-) diff --git a/etherpad/bin/rebuildjar.sh b/etherpad/bin/rebuildjar.sh index 40f6a10..acd57d2 100755 --- a/etherpad/bin/rebuildjar.sh +++ b/etherpad/bin/rebuildjar.sh @@ -21,7 +21,7 @@ if [ -z "$JAR" ]; then # http://lists.gnu.org/archive/html/fastjar-dev/2009-12/msg00000.html version=`fastjar --version | grep fastjar | sed 's/.* //g'` if [[ "$version" = "0.97" || "$version" = "0.98" ]]; then - echo "fastjar version $version can't build etherpad. Falling back to standard jar." + echo "fastjar version $version can't build EtherPad. Falling back to standard jar." JAR=jar else JAR=fastjar @@ -31,47 +31,82 @@ if [ -z "$JAR" ]; then fi fi -function depscheck { - if [ ! -d "$JAVA_HOME" ]; then - echo "\$JAVA_HOME does not point to an existing dir; should be e.g. /usr/java/latest" - exit 1 - fi - if [ ! -d "$SCALA_HOME" ]; then - echo "\$SCALA_HOME does not point to an existing dir; should be e.g. /usr/share/scala" - exit 1 - fi - if [ ! -e "$SCALA" ]; then - echo "\$SCALA does not point to an existing file; should be e.g. /usr/bin/scala" - exit 1 - fi - if [ ! -e "$JAVA" ]; then - echo "\$JAVA does not point to an existing file; should be e.g. /usr/bin/java" - exit 1 - fi - if [ ! -e "$MYSQL_CONNECTOR_JAR" ]; then - echo "\$MYSQL_CONNECTOR_JAR does not point to an existing file; should be e.g. /usr/share/java/mysql-connector-java.jar" - exit 1 +[ -z "$JAVA_HOME" ] && read -p "\$JAVA_HOME is not set, please enter the path to your Java installation: " JAVA_HOME +if [ ! -e "$JAVA_HOME" ]; then + echo "The path to \$JAVA_HOME ($JAVA_HOME) does not exist, please check and try again." + exit 1 +else + export JAVA_HOME +fi + +[ -z "$SCALA_HOME" ] && read -p "\$SCALA_HOME is not set, please enter the path to your Scala installation: " SCALA_HOME +if [ ! -e "$SCALA_HOME" ]; then + echo "The path to \$SCALA_HOME ($SCALA_HOME) does not exist, please check and try again." + exit 1 +else + export SCALA_HOME +fi + +if [ -z "$SCALA" ]; then + if [ `which scala 2>/dev/null 1>/dev/null` ]; then + SCALA=`which scala` + echo "Using 'scala' binary found at $SCALA. Set \$SCALA to use another one." + elif [ -x "$SCALA_HOME/bin/scala" ]; then + SCALA="$SCALA_HOME/bin/scala" + echo "Using 'scala' binary found at $SCALA. Set \$SCALA to use another one." + else + read -p "\$SCALA is not set and the 'scala' binary could not be found, please enter the path to the file: " SCALA fi +fi +if [ ! -x "$SCALA" ]; then + echo "The path to \$SCALA ($SCALA) is not an executable file, please check and try again." + exit 1 +else + export SCALA +fi - # Check for javac version. Unfortunately, javac doesn't tell you whether - # it's Sun Java or OpenJDK, but the "java" binary that's in the same - # directory will. - if [ -e "$JAVA_HOME/bin/java" ]; then - ($JAVA_HOME/bin/java -version 2>&1) | { - while read file; do - javaver=$file - done - for word in $javaver; do - if [ $word != "Java" ]; then - echo "$JAVA_HOME/bin/java is from a non-Sun compiler, and may not be able to compile etherpad. If you get syntax errors, you should point \$JAVA_HOME at a Sun Java JDK installation instead." - fi - break - done - } +if [ -z "$JAVA" ]; then + if [ `which java 2>/dev/null 1>/dev/null` ]; then + JAVA=`which java` + echo "Using 'java' binary found at $JAVA. Set \$JAVA to use another one." + elif [ -x "$JAVA_HOME/bin/java" ]; then + JAVA="$JAVA_HOME/bin/java" + echo "Using 'java' binary found at $JAVA. Set \$JAVA to use another one." + else + read -p "\$JAVA is not set and the 'java' binary could not be found, please enter the path to the file: " JAVA fi -} +fi +if [ ! -x "$JAVA" ]; then + echo "The path to \$JAVA ($JAVA) is not an executeable file, please check and try again." + exit 1 +else + export JAVA +fi + +[ -z "$MYSQL_CONNECTOR_JAR" ] && read -p "\$MYSQL_CONNECTOR_JAR is not set, please enter the path to the MySQL JDBC driver .jar file: " MYSQL_CONNECTOR_JAR +if [ ! -e "$MYSQL_CONNECTOR_JAR" ]; then + echo "The path to \$MYSQL_CONNECTOR_JAR ($MYSQL_CONNECTOR_JAR) does not exist, please check and try again." + exit 1 +else + export MYSQL_CONNECTOR_JAR +fi -depscheck +# Check for javac version. Unfortunately, javac doesn't tell you whether +# it's Sun Java or OpenJDK, but the "java" binary that's in the same +# directory will. +if [ -e "$JAVA_HOME/bin/java" ]; then + ($JAVA_HOME/bin/java -version 2>&1) | { + while read file; do + javaver=$file + done + for word in $javaver; do + if [ $word != "Java" ]; then + echo "$JAVA_HOME/bin/java is from a non-Sun compiler, and may not be able to compile EtherPad. If you get syntax errors, you should point \$JAVA_HOME at a Sun Java JDK installation instead." + fi + break + done + } +fi function notify { if [ ! -z $(which growlnotify 2>/dev/null) ]; then -- cgit v1.2.3