Issue 891: ubuntu and centos now work with openjdk

This commit is contained in:
Adrian Cole 2012-03-30 18:34:52 -07:00
parent f7de4b9df4
commit f241483913
7 changed files with 36 additions and 26 deletions

View File

@ -65,7 +65,7 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live") @Test(groups = "live", testName="StubComputeServiceIntegrationTest")
public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTest { public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTest {
private static final ExecResponse EXEC_GOOD = new ExecResponse("", "", 0); private static final ExecResponse EXEC_GOOD = new ExecResponse("", "", 0);

View File

@ -96,7 +96,7 @@ function ensure_cmd_or_install_package_apt(){
function ensure_cmd_or_install_package_yum(){ function ensure_cmd_or_install_package_yum(){
local cmd=$1 local cmd=$1
local pkg=$2 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() { function ensure_netutils_apt() {
@ -152,18 +152,20 @@ END_OF_JCLOUDS_FILE
END_OF_JCLOUDS_FILE END_OF_JCLOUDS_FILE
} }
function installJDK() { function installOpenJDK() {
if hash apt-get 2>/dev/null; then if hash apt-get 2>/dev/null; then
export pkg=openjdk-7-jdk export pkg=openjdk-7-jdk
apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) 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 elif hash yum 2>/dev/null; then
export pkg=java-1.7.0-openjdk #TODO: find a jdk7 yum repo
yum --nogpgcheck -y ensure $pkg 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 else
abort "we only support apt-get and yum right now... please contribute!" abort "we only support apt-get and yum right now... please contribute!"
return 1 return 1
fi fi
JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common`
ln -Fs $JAVA_HOME /usr/local/jdk ln -Fs $JAVA_HOME /usr/local/jdk
/usr/local/jdk/bin/java -version || abort "cannot run java" /usr/local/jdk/bin/java -version || abort "cannot run java"
setupJavaHomeInProfile setupJavaHomeInProfile

View File

@ -96,7 +96,7 @@ function ensure_cmd_or_install_package_apt(){
function ensure_cmd_or_install_package_yum(){ function ensure_cmd_or_install_package_yum(){
local cmd=$1 local cmd=$1
local pkg=$2 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() { function ensure_netutils_apt() {
@ -152,18 +152,20 @@ END_OF_JCLOUDS_FILE
END_OF_JCLOUDS_FILE END_OF_JCLOUDS_FILE
} }
function installJDK() { function installOpenJDK() {
if hash apt-get 2>/dev/null; then if hash apt-get 2>/dev/null; then
export pkg=openjdk-7-jdk export pkg=openjdk-7-jdk
apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) 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 elif hash yum 2>/dev/null; then
export pkg=java-1.7.0-openjdk #TODO: find a jdk7 yum repo
yum --nogpgcheck -y ensure $pkg 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 else
abort "we only support apt-get and yum right now... please contribute!" abort "we only support apt-get and yum right now... please contribute!"
return 1 return 1
fi fi
JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common`
ln -Fs $JAVA_HOME /usr/local/jdk ln -Fs $JAVA_HOME /usr/local/jdk
/usr/local/jdk/bin/java -version || abort "cannot run java" /usr/local/jdk/bin/java -version || abort "cannot run java"
setupJavaHomeInProfile setupJavaHomeInProfile

View File

@ -96,7 +96,7 @@ function ensure_cmd_or_install_package_apt(){
function ensure_cmd_or_install_package_yum(){ function ensure_cmd_or_install_package_yum(){
local cmd=$1 local cmd=$1
local pkg=$2 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() { function ensure_netutils_apt() {
@ -152,18 +152,20 @@ END_OF_JCLOUDS_FILE
END_OF_JCLOUDS_FILE END_OF_JCLOUDS_FILE
} }
function installJDK() { function installOpenJDK() {
if hash apt-get 2>/dev/null; then if hash apt-get 2>/dev/null; then
export pkg=openjdk-7-jdk export pkg=openjdk-7-jdk
apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) 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 elif hash yum 2>/dev/null; then
export pkg=java-1.7.0-openjdk #TODO: find a jdk7 yum repo
yum --nogpgcheck -y ensure $pkg 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 else
abort "we only support apt-get and yum right now... please contribute!" abort "we only support apt-get and yum right now... please contribute!"
return 1 return 1
fi fi
JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common`
ln -Fs $JAVA_HOME /usr/local/jdk ln -Fs $JAVA_HOME /usr/local/jdk
/usr/local/jdk/bin/java -version || abort "cannot run java" /usr/local/jdk/bin/java -version || abort "cannot run java"
setupJavaHomeInProfile setupJavaHomeInProfile

View File

@ -17,18 +17,20 @@ END_OF_JCLOUDS_FILE
END_OF_JCLOUDS_FILE END_OF_JCLOUDS_FILE
} }
function installJDK() { function installOpenJDK() {
if hash apt-get 2>/dev/null; then if hash apt-get 2>/dev/null; then
export pkg=openjdk-7-jdk export pkg=openjdk-7-jdk
apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) 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 elif hash yum 2>/dev/null; then
export pkg=java-1.7.0-openjdk #TODO: find a jdk7 yum repo
yum --nogpgcheck -y ensure $pkg 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 else
abort "we only support apt-get and yum right now... please contribute!" abort "we only support apt-get and yum right now... please contribute!"
return 1 return 1
fi fi
JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common`
ln -Fs $JAVA_HOME /usr/local/jdk ln -Fs $JAVA_HOME /usr/local/jdk
/usr/local/jdk/bin/java -version || abort "cannot run java" /usr/local/jdk/bin/java -version || abort "cannot run java"
setupJavaHomeInProfile setupJavaHomeInProfile

View File

@ -11,7 +11,7 @@ function ensure_cmd_or_install_package_apt(){
function ensure_cmd_or_install_package_yum(){ function ensure_cmd_or_install_package_yum(){
local cmd=$1 local cmd=$1
local pkg=$2 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() { function ensure_netutils_apt() {

View File

@ -96,7 +96,7 @@ function ensure_cmd_or_install_package_apt(){
function ensure_cmd_or_install_package_yum(){ function ensure_cmd_or_install_package_yum(){
local cmd=$1 local cmd=$1
local pkg=$2 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() { function ensure_netutils_apt() {
@ -152,18 +152,20 @@ END_OF_JCLOUDS_FILE
END_OF_JCLOUDS_FILE END_OF_JCLOUDS_FILE
} }
function installJDK() { function installOpenJDK() {
if hash apt-get 2>/dev/null; then if hash apt-get 2>/dev/null; then
export pkg=openjdk-7-jdk export pkg=openjdk-7-jdk
apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) 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 elif hash yum 2>/dev/null; then
export pkg=java-1.7.0-openjdk #TODO: find a jdk7 yum repo
yum --nogpgcheck -y ensure $pkg 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 else
abort "we only support apt-get and yum right now... please contribute!" abort "we only support apt-get and yum right now... please contribute!"
return 1 return 1
fi fi
JAVA_HOME=`ls -d /usr/lib/jvm/java-7-openjdk-*|grep -v common`
ln -Fs $JAVA_HOME /usr/local/jdk ln -Fs $JAVA_HOME /usr/local/jdk
/usr/local/jdk/bin/java -version || abort "cannot run java" /usr/local/jdk/bin/java -version || abort "cannot run java"
setupJavaHomeInProfile setupJavaHomeInProfile