Issue 891: ensure we run apt update when install jdk fails

This commit is contained in:
Adrian Cole 2012-04-18 15:02:06 -07:00
parent b9c4f5cd4b
commit 98a205b603
7 changed files with 17 additions and 17 deletions

View File

@ -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 &&

View File

@ -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 &&

View File

@ -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 &&

View File

@ -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(){

View File

@ -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 &&

View File

@ -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(){

View File

@ -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 &&