From 7e6b4190687ff4a215fb201e9e0ac871cf95c9a0 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Fri, 30 Mar 2012 18:34:52 -0700 Subject: [PATCH] Issue 891: ubuntu and centos now work with openjdk --- .../compute/StubComputeServiceIntegrationTest.java | 2 +- compute/src/test/resources/initscript_with_java.sh | 12 +++++++----- compute/src/test/resources/initscript_with_jboss.sh | 12 +++++++----- compute/src/test/resources/runscript.sh | 12 +++++++----- .../src/main/resources/functions/installOpenJDK.sh | 10 ++++++---- .../src/main/resources/functions/setupPublicCurl.sh | 2 +- .../test/resources/test_install_jdk_scriptbuilder.sh | 12 +++++++----- 7 files changed, 36 insertions(+), 26 deletions(-) diff --git a/compute/src/test/java/org/jclouds/compute/StubComputeServiceIntegrationTest.java b/compute/src/test/java/org/jclouds/compute/StubComputeServiceIntegrationTest.java index 551e37510d..cccd9f735f 100644 --- a/compute/src/test/java/org/jclouds/compute/StubComputeServiceIntegrationTest.java +++ b/compute/src/test/java/org/jclouds/compute/StubComputeServiceIntegrationTest.java @@ -65,7 +65,7 @@ import com.google.inject.Module; * * @author Adrian Cole */ -@Test(groups = "live") +@Test(groups = "live", testName="StubComputeServiceIntegrationTest") public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTest { private static final ExecResponse EXEC_GOOD = new ExecResponse("", "", 0); diff --git a/compute/src/test/resources/initscript_with_java.sh b/compute/src/test/resources/initscript_with_java.sh index 927da887cf..9ad7659941 100644 --- a/compute/src/test/resources/initscript_with_java.sh +++ b/compute/src/test/resources/initscript_with_java.sh @@ -96,7 +96,7 @@ function ensure_cmd_or_install_package_apt(){ function ensure_cmd_or_install_package_yum(){ local cmd=$1 local pkg=$2 - hash $cmd 2>/dev/null || yum --nogpgcheck -y ensure $pkg + hash $cmd 2>/dev/null || yum --nogpgcheck -y install $pkg } function ensure_netutils_apt() { @@ -152,18 +152,20 @@ END_OF_JCLOUDS_FILE END_OF_JCLOUDS_FILE } -function installJDK() { +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` elif hash yum 2>/dev/null; then - export pkg=java-1.7.0-openjdk - yum --nogpgcheck -y ensure $pkg + #TODO: find a jdk7 yum repo + export pkg=java-1.6.0-openjdk-devel + 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 - JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common` 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 e848b851b0..b745f96667 100644 --- a/compute/src/test/resources/initscript_with_jboss.sh +++ b/compute/src/test/resources/initscript_with_jboss.sh @@ -96,7 +96,7 @@ function ensure_cmd_or_install_package_apt(){ function ensure_cmd_or_install_package_yum(){ local cmd=$1 local pkg=$2 - hash $cmd 2>/dev/null || yum --nogpgcheck -y ensure $pkg + hash $cmd 2>/dev/null || yum --nogpgcheck -y install $pkg } function ensure_netutils_apt() { @@ -152,18 +152,20 @@ END_OF_JCLOUDS_FILE END_OF_JCLOUDS_FILE } -function installJDK() { +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` elif hash yum 2>/dev/null; then - export pkg=java-1.7.0-openjdk - yum --nogpgcheck -y ensure $pkg + #TODO: find a jdk7 yum repo + export pkg=java-1.6.0-openjdk-devel + 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 - JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common` 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 7f8977c047..ea2874ccd0 100644 --- a/compute/src/test/resources/runscript.sh +++ b/compute/src/test/resources/runscript.sh @@ -96,7 +96,7 @@ function ensure_cmd_or_install_package_apt(){ function ensure_cmd_or_install_package_yum(){ local cmd=$1 local pkg=$2 - hash $cmd 2>/dev/null || yum --nogpgcheck -y ensure $pkg + hash $cmd 2>/dev/null || yum --nogpgcheck -y install $pkg } function ensure_netutils_apt() { @@ -152,18 +152,20 @@ END_OF_JCLOUDS_FILE END_OF_JCLOUDS_FILE } -function installJDK() { +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` elif hash yum 2>/dev/null; then - export pkg=java-1.7.0-openjdk - yum --nogpgcheck -y ensure $pkg + #TODO: find a jdk7 yum repo + export pkg=java-1.6.0-openjdk-devel + 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 - JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common` 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 cf7ef59be2..0ac3b2f2ca 100644 --- a/scriptbuilder/src/main/resources/functions/installOpenJDK.sh +++ b/scriptbuilder/src/main/resources/functions/installOpenJDK.sh @@ -17,18 +17,20 @@ END_OF_JCLOUDS_FILE END_OF_JCLOUDS_FILE } -function installJDK() { +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` elif hash yum 2>/dev/null; then - export pkg=java-1.7.0-openjdk - yum --nogpgcheck -y ensure $pkg + #TODO: find a jdk7 yum repo + export pkg=java-1.6.0-openjdk-devel + 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 - JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common` 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/setupPublicCurl.sh b/scriptbuilder/src/main/resources/functions/setupPublicCurl.sh index 005f891c83..ad72ddb838 100644 --- a/scriptbuilder/src/main/resources/functions/setupPublicCurl.sh +++ b/scriptbuilder/src/main/resources/functions/setupPublicCurl.sh @@ -11,7 +11,7 @@ function ensure_cmd_or_install_package_apt(){ function ensure_cmd_or_install_package_yum(){ local cmd=$1 local pkg=$2 - hash $cmd 2>/dev/null || yum --nogpgcheck -y ensure $pkg + hash $cmd 2>/dev/null || yum --nogpgcheck -y install $pkg } function ensure_netutils_apt() { diff --git a/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh b/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh index 905599a088..d35c30b1d7 100644 --- a/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh +++ b/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh @@ -96,7 +96,7 @@ function ensure_cmd_or_install_package_apt(){ function ensure_cmd_or_install_package_yum(){ local cmd=$1 local pkg=$2 - hash $cmd 2>/dev/null || yum --nogpgcheck -y ensure $pkg + hash $cmd 2>/dev/null || yum --nogpgcheck -y install $pkg } function ensure_netutils_apt() { @@ -152,18 +152,20 @@ END_OF_JCLOUDS_FILE END_OF_JCLOUDS_FILE } -function installJDK() { +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` elif hash yum 2>/dev/null; then - export pkg=java-1.7.0-openjdk - yum --nogpgcheck -y ensure $pkg + #TODO: find a jdk7 yum repo + export pkg=java-1.6.0-openjdk-devel + 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 - JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common` ln -Fs $JAVA_HOME /usr/local/jdk /usr/local/jdk/bin/java -version || abort "cannot run java" setupJavaHomeInProfile