From 98a205b603cc169ccff4a4299add73c5d41d2d0a Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Wed, 18 Apr 2012 15:02:06 -0700 Subject: [PATCH] Issue 891: ensure we run apt update when install jdk fails --- compute/src/test/resources/initscript_with_java.sh | 6 +++--- compute/src/test/resources/initscript_with_jboss.sh | 6 +++--- compute/src/test/resources/runscript.sh | 6 +++--- .../test/resources/test_guest_additions_installer_init.sh | 4 ++-- .../src/main/resources/functions/installOpenJDK.sh | 2 +- .../src/main/resources/functions/setupPublicCurl.sh | 4 ++-- .../src/test/resources/test_install_jdk_scriptbuilder.sh | 6 +++--- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/compute/src/test/resources/initscript_with_java.sh b/compute/src/test/resources/initscript_with_java.sh index e1f991bc8e..d7bbeed3ea 100644 --- a/compute/src/test/resources/initscript_with_java.sh +++ b/compute/src/test/resources/initscript_with_java.sh @@ -84,13 +84,13 @@ END_OF_JCLOUDS_SCRIPT exit 1 } alias apt-get-install="apt-get install -f -y -qq --force-yes" -alias apt-get-upgrade="(apt-get update -qq&&apt-get upgrade -y -qq)" +alias apt-get-update="apt-get update -qq" function ensure_cmd_or_install_package_apt(){ local cmd=$1 local pkg=$2 - hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) + hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-update && apt-get-install $pkg ) } function ensure_cmd_or_install_package_yum(){ @@ -155,7 +155,7 @@ END_OF_JCLOUDS_FILE function installOpenJDK() { if hash apt-get 2>/dev/null; then export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} - test -d $JAVA_HOME || apt-get-install openjdk-6-jdk + test -d $JAVA_HOME || apt-get-install openjdk-6-jdk || ( apt-get-update && apt-get-install openjdk-6-jdk ) elif hash yum 2>/dev/null; then export pkg=java-1.6.0-openjdk-devel yum --nogpgcheck -y install $pkg && diff --git a/compute/src/test/resources/initscript_with_jboss.sh b/compute/src/test/resources/initscript_with_jboss.sh index e700985e58..edec50effd 100644 --- a/compute/src/test/resources/initscript_with_jboss.sh +++ b/compute/src/test/resources/initscript_with_jboss.sh @@ -84,13 +84,13 @@ END_OF_JCLOUDS_SCRIPT exit 1 } alias apt-get-install="apt-get install -f -y -qq --force-yes" -alias apt-get-upgrade="(apt-get update -qq&&apt-get upgrade -y -qq)" +alias apt-get-update="apt-get update -qq" function ensure_cmd_or_install_package_apt(){ local cmd=$1 local pkg=$2 - hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) + hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-update && apt-get-install $pkg ) } function ensure_cmd_or_install_package_yum(){ @@ -155,7 +155,7 @@ END_OF_JCLOUDS_FILE function installOpenJDK() { if hash apt-get 2>/dev/null; then export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} - test -d $JAVA_HOME || apt-get-install openjdk-6-jdk + test -d $JAVA_HOME || apt-get-install openjdk-6-jdk || ( apt-get-update && apt-get-install openjdk-6-jdk ) elif hash yum 2>/dev/null; then export pkg=java-1.6.0-openjdk-devel yum --nogpgcheck -y install $pkg && diff --git a/compute/src/test/resources/runscript.sh b/compute/src/test/resources/runscript.sh index 082c625f42..1c45816838 100644 --- a/compute/src/test/resources/runscript.sh +++ b/compute/src/test/resources/runscript.sh @@ -84,13 +84,13 @@ END_OF_JCLOUDS_SCRIPT exit 1 } alias apt-get-install="apt-get install -f -y -qq --force-yes" -alias apt-get-upgrade="(apt-get update -qq&&apt-get upgrade -y -qq)" +alias apt-get-update="apt-get update -qq" function ensure_cmd_or_install_package_apt(){ local cmd=$1 local pkg=$2 - hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) + hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-update && apt-get-install $pkg ) } function ensure_cmd_or_install_package_yum(){ @@ -155,7 +155,7 @@ END_OF_JCLOUDS_FILE function installOpenJDK() { if hash apt-get 2>/dev/null; then export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} - test -d $JAVA_HOME || apt-get-install openjdk-6-jdk + test -d $JAVA_HOME || apt-get-install openjdk-6-jdk || ( apt-get-update && apt-get-install openjdk-6-jdk ) elif hash yum 2>/dev/null; then export pkg=java-1.6.0-openjdk-devel yum --nogpgcheck -y install $pkg && diff --git a/labs/virtualbox/src/test/resources/test_guest_additions_installer_init.sh b/labs/virtualbox/src/test/resources/test_guest_additions_installer_init.sh index 47c37dbe14..cccddd00ef 100644 --- a/labs/virtualbox/src/test/resources/test_guest_additions_installer_init.sh +++ b/labs/virtualbox/src/test/resources/test_guest_additions_installer_init.sh @@ -84,13 +84,13 @@ END_OF_JCLOUDS_SCRIPT exit 1 } alias apt-get-install="apt-get install -f -y -qq --force-yes" -alias apt-get-upgrade="(apt-get update -qq&&apt-get upgrade -y -qq)" +alias apt-get-update="apt-get update -qq" function ensure_cmd_or_install_package_apt(){ local cmd=$1 local pkg=$2 - hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) + hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-update && apt-get-install $pkg ) } function ensure_cmd_or_install_package_yum(){ diff --git a/scriptbuilder/src/main/resources/functions/installOpenJDK.sh b/scriptbuilder/src/main/resources/functions/installOpenJDK.sh index 20139134f4..71539db08c 100644 --- a/scriptbuilder/src/main/resources/functions/installOpenJDK.sh +++ b/scriptbuilder/src/main/resources/functions/installOpenJDK.sh @@ -20,7 +20,7 @@ END_OF_JCLOUDS_FILE function installOpenJDK() { if hash apt-get 2>/dev/null; then export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} - test -d $JAVA_HOME || apt-get-install openjdk-6-jdk + test -d $JAVA_HOME || apt-get-install openjdk-6-jdk || ( apt-get-update && apt-get-install openjdk-6-jdk ) elif hash yum 2>/dev/null; then export pkg=java-1.6.0-openjdk-devel yum --nogpgcheck -y install $pkg && diff --git a/scriptbuilder/src/main/resources/functions/setupPublicCurl.sh b/scriptbuilder/src/main/resources/functions/setupPublicCurl.sh index ad72ddb838..b0854d7813 100644 --- a/scriptbuilder/src/main/resources/functions/setupPublicCurl.sh +++ b/scriptbuilder/src/main/resources/functions/setupPublicCurl.sh @@ -1,11 +1,11 @@ alias apt-get-install="apt-get install -f -y -qq --force-yes" -alias apt-get-upgrade="(apt-get update -qq&&apt-get upgrade -y -qq)" +alias apt-get-update="apt-get update -qq" function ensure_cmd_or_install_package_apt(){ local cmd=$1 local pkg=$2 - hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) + hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-update && apt-get-install $pkg ) } function ensure_cmd_or_install_package_yum(){ diff --git a/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh b/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh index f3a502ad4b..52c107410f 100644 --- a/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh +++ b/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh @@ -84,13 +84,13 @@ END_OF_JCLOUDS_SCRIPT exit 1 } alias apt-get-install="apt-get install -f -y -qq --force-yes" -alias apt-get-upgrade="(apt-get update -qq&&apt-get upgrade -y -qq)" +alias apt-get-update="apt-get update -qq" function ensure_cmd_or_install_package_apt(){ local cmd=$1 local pkg=$2 - hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-upgrade && apt-get-install $pkg ) + hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-update && apt-get-install $pkg ) } function ensure_cmd_or_install_package_yum(){ @@ -155,7 +155,7 @@ END_OF_JCLOUDS_FILE function installOpenJDK() { if hash apt-get 2>/dev/null; then export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} - test -d $JAVA_HOME || apt-get-install openjdk-6-jdk + test -d $JAVA_HOME || apt-get-install openjdk-6-jdk || ( apt-get-update && apt-get-install openjdk-6-jdk ) elif hash yum 2>/dev/null; then export pkg=java-1.6.0-openjdk-devel yum --nogpgcheck -y install $pkg &&