diff --git a/compute/src/test/resources/initscript_with_java.sh b/compute/src/test/resources/initscript_with_java.sh index 9ad7659941..e7fc3c0191 100644 --- a/compute/src/test/resources/initscript_with_java.sh +++ b/compute/src/test/resources/initscript_with_java.sh @@ -154,18 +154,22 @@ END_OF_JCLOUDS_FILE function installOpenJDK() { if hash apt-get 2>/dev/null; then - export pkg=openjdk-7-jdk - apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) - export JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common` + pkg=openjdk-7-jdk + (apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg )) && + export JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk*|grep -v common` + # ex. lucid where jdk 7 is not present + export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} + test -d $JAVA_HOME || apt-get-install openjdk-6-jdk elif hash yum 2>/dev/null; then #TODO: find a jdk7 yum repo export pkg=java-1.6.0-openjdk-devel - yum --nogpgcheck -y install $pkg + yum --nogpgcheck -y install $pkg && export JAVA_HOME=`ls -d /usr/lib/jvm/java-1.6.0-openjdk-*` else abort "we only support apt-get and yum right now... please contribute!" return 1 fi + test -n "$JAVA_HOME" || abort "JDK installation failed!" ln -Fs $JAVA_HOME /usr/local/jdk /usr/local/jdk/bin/java -version || abort "cannot run java" setupJavaHomeInProfile diff --git a/compute/src/test/resources/initscript_with_jboss.sh b/compute/src/test/resources/initscript_with_jboss.sh index b745f96667..4186f24f62 100644 --- a/compute/src/test/resources/initscript_with_jboss.sh +++ b/compute/src/test/resources/initscript_with_jboss.sh @@ -154,18 +154,22 @@ END_OF_JCLOUDS_FILE function installOpenJDK() { if hash apt-get 2>/dev/null; then - export pkg=openjdk-7-jdk - apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) - export JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common` + pkg=openjdk-7-jdk + (apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg )) && + export JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk*|grep -v common` + # ex. lucid where jdk 7 is not present + export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} + test -d $JAVA_HOME || apt-get-install openjdk-6-jdk elif hash yum 2>/dev/null; then #TODO: find a jdk7 yum repo export pkg=java-1.6.0-openjdk-devel - yum --nogpgcheck -y install $pkg + yum --nogpgcheck -y install $pkg && export JAVA_HOME=`ls -d /usr/lib/jvm/java-1.6.0-openjdk-*` else abort "we only support apt-get and yum right now... please contribute!" return 1 fi + test -n "$JAVA_HOME" || abort "JDK installation failed!" ln -Fs $JAVA_HOME /usr/local/jdk /usr/local/jdk/bin/java -version || abort "cannot run java" setupJavaHomeInProfile diff --git a/compute/src/test/resources/runscript.sh b/compute/src/test/resources/runscript.sh index ea2874ccd0..6d10394a79 100644 --- a/compute/src/test/resources/runscript.sh +++ b/compute/src/test/resources/runscript.sh @@ -154,18 +154,22 @@ END_OF_JCLOUDS_FILE function installOpenJDK() { if hash apt-get 2>/dev/null; then - export pkg=openjdk-7-jdk - apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) - export JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common` + pkg=openjdk-7-jdk + (apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg )) && + export JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk*|grep -v common` + # ex. lucid where jdk 7 is not present + export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} + test -d $JAVA_HOME || apt-get-install openjdk-6-jdk elif hash yum 2>/dev/null; then #TODO: find a jdk7 yum repo export pkg=java-1.6.0-openjdk-devel - yum --nogpgcheck -y install $pkg + yum --nogpgcheck -y install $pkg && export JAVA_HOME=`ls -d /usr/lib/jvm/java-1.6.0-openjdk-*` else abort "we only support apt-get and yum right now... please contribute!" return 1 fi + test -n "$JAVA_HOME" || abort "JDK installation failed!" ln -Fs $JAVA_HOME /usr/local/jdk /usr/local/jdk/bin/java -version || abort "cannot run java" setupJavaHomeInProfile diff --git a/scriptbuilder/src/main/resources/functions/installOpenJDK.sh b/scriptbuilder/src/main/resources/functions/installOpenJDK.sh index 0ac3b2f2ca..8f24fec87c 100644 --- a/scriptbuilder/src/main/resources/functions/installOpenJDK.sh +++ b/scriptbuilder/src/main/resources/functions/installOpenJDK.sh @@ -19,18 +19,22 @@ END_OF_JCLOUDS_FILE function installOpenJDK() { if hash apt-get 2>/dev/null; then - export pkg=openjdk-7-jdk - apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) - export JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common` + pkg=openjdk-7-jdk + (apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg )) && + export JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk*|grep -v common` + # ex. lucid where jdk 7 is not present + export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} + test -d $JAVA_HOME || apt-get-install openjdk-6-jdk elif hash yum 2>/dev/null; then #TODO: find a jdk7 yum repo export pkg=java-1.6.0-openjdk-devel - yum --nogpgcheck -y install $pkg + yum --nogpgcheck -y install $pkg && export JAVA_HOME=`ls -d /usr/lib/jvm/java-1.6.0-openjdk-*` else abort "we only support apt-get and yum right now... please contribute!" return 1 fi + test -n "$JAVA_HOME" || abort "JDK installation failed!" ln -Fs $JAVA_HOME /usr/local/jdk /usr/local/jdk/bin/java -version || abort "cannot run java" setupJavaHomeInProfile diff --git a/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh b/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh index d35c30b1d7..f88f8fcdc5 100644 --- a/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh +++ b/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh @@ -154,18 +154,22 @@ END_OF_JCLOUDS_FILE function installOpenJDK() { if hash apt-get 2>/dev/null; then - export pkg=openjdk-7-jdk - apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) - export JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common` + pkg=openjdk-7-jdk + (apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg )) && + export JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk*|grep -v common` + # ex. lucid where jdk 7 is not present + export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} + test -d $JAVA_HOME || apt-get-install openjdk-6-jdk elif hash yum 2>/dev/null; then #TODO: find a jdk7 yum repo export pkg=java-1.6.0-openjdk-devel - yum --nogpgcheck -y install $pkg + yum --nogpgcheck -y install $pkg && export JAVA_HOME=`ls -d /usr/lib/jvm/java-1.6.0-openjdk-*` else abort "we only support apt-get and yum right now... please contribute!" return 1 fi + test -n "$JAVA_HOME" || abort "JDK installation failed!" ln -Fs $JAVA_HOME /usr/local/jdk /usr/local/jdk/bin/java -version || abort "cannot run java" setupJavaHomeInProfile