Switch to calling apt-get update before every apt-get install.

I found that the previous "apt-get install || (apt-get update; apt-get
install) didn't work in all cases, but switching to always calling
apt-get update got things working properly.
This commit is contained in:
Andrew Bayer 2012-04-19 13:02:47 -07:00
parent 66dc8787ae
commit 9b80b984a4
7 changed files with 11 additions and 11 deletions

View File

@ -90,7 +90,7 @@ function ensure_cmd_or_install_package_apt(){
local cmd=$1 local cmd=$1
local pkg=$2 local pkg=$2
hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-update && apt-get-install $pkg ) hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg )
} }
function ensure_cmd_or_install_package_yum(){ function ensure_cmd_or_install_package_yum(){
@ -155,7 +155,7 @@ END_OF_JCLOUDS_FILE
function installOpenJDK() { function installOpenJDK() {
if hash apt-get 2>/dev/null; then if hash apt-get 2>/dev/null; then
export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk}
test -d $JAVA_HOME || apt-get-install openjdk-6-jdk || ( apt-get-update && apt-get-install openjdk-6-jdk ) test -d $JAVA_HOME || ( apt-get-update && apt-get-install openjdk-6-jdk )
elif hash yum 2>/dev/null; then elif hash yum 2>/dev/null; then
export pkg=java-1.6.0-openjdk-devel export pkg=java-1.6.0-openjdk-devel
yum --nogpgcheck -y install $pkg && yum --nogpgcheck -y install $pkg &&

View File

@ -90,7 +90,7 @@ function ensure_cmd_or_install_package_apt(){
local cmd=$1 local cmd=$1
local pkg=$2 local pkg=$2
hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-update && apt-get-install $pkg ) hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg )
} }
function ensure_cmd_or_install_package_yum(){ function ensure_cmd_or_install_package_yum(){
@ -155,7 +155,7 @@ END_OF_JCLOUDS_FILE
function installOpenJDK() { function installOpenJDK() {
if hash apt-get 2>/dev/null; then if hash apt-get 2>/dev/null; then
export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk}
test -d $JAVA_HOME || apt-get-install openjdk-6-jdk || ( apt-get-update && apt-get-install openjdk-6-jdk ) test -d $JAVA_HOME || ( apt-get-update && apt-get-install openjdk-6-jdk )
elif hash yum 2>/dev/null; then elif hash yum 2>/dev/null; then
export pkg=java-1.6.0-openjdk-devel export pkg=java-1.6.0-openjdk-devel
yum --nogpgcheck -y install $pkg && yum --nogpgcheck -y install $pkg &&

View File

@ -90,7 +90,7 @@ function ensure_cmd_or_install_package_apt(){
local cmd=$1 local cmd=$1
local pkg=$2 local pkg=$2
hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-update && apt-get-install $pkg ) hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg )
} }
function ensure_cmd_or_install_package_yum(){ function ensure_cmd_or_install_package_yum(){
@ -155,7 +155,7 @@ END_OF_JCLOUDS_FILE
function installOpenJDK() { function installOpenJDK() {
if hash apt-get 2>/dev/null; then if hash apt-get 2>/dev/null; then
export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk}
test -d $JAVA_HOME || apt-get-install openjdk-6-jdk || ( apt-get-update && apt-get-install openjdk-6-jdk ) test -d $JAVA_HOME || ( apt-get-update && apt-get-install openjdk-6-jdk )
elif hash yum 2>/dev/null; then elif hash yum 2>/dev/null; then
export pkg=java-1.6.0-openjdk-devel export pkg=java-1.6.0-openjdk-devel
yum --nogpgcheck -y install $pkg && yum --nogpgcheck -y install $pkg &&

View File

@ -90,7 +90,7 @@ function ensure_cmd_or_install_package_apt(){
local cmd=$1 local cmd=$1
local pkg=$2 local pkg=$2
hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-update && apt-get-install $pkg ) hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg )
} }
function ensure_cmd_or_install_package_yum(){ function ensure_cmd_or_install_package_yum(){

View File

@ -20,7 +20,7 @@ END_OF_JCLOUDS_FILE
function installOpenJDK() { function installOpenJDK() {
if hash apt-get 2>/dev/null; then if hash apt-get 2>/dev/null; then
export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk}
test -d $JAVA_HOME || apt-get-install openjdk-6-jdk || ( apt-get-update && apt-get-install openjdk-6-jdk ) test -d $JAVA_HOME || ( apt-get-update && apt-get-install openjdk-6-jdk )
elif hash yum 2>/dev/null; then elif hash yum 2>/dev/null; then
export pkg=java-1.6.0-openjdk-devel export pkg=java-1.6.0-openjdk-devel
yum --nogpgcheck -y install $pkg && yum --nogpgcheck -y install $pkg &&

View File

@ -5,7 +5,7 @@ function ensure_cmd_or_install_package_apt(){
local cmd=$1 local cmd=$1
local pkg=$2 local pkg=$2
hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-update && apt-get-install $pkg ) hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg )
} }
function ensure_cmd_or_install_package_yum(){ function ensure_cmd_or_install_package_yum(){

View File

@ -90,7 +90,7 @@ function ensure_cmd_or_install_package_apt(){
local cmd=$1 local cmd=$1
local pkg=$2 local pkg=$2
hash $cmd 2>/dev/null || apt-get-install $pkg || ( apt-get-update && apt-get-install $pkg ) hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg )
} }
function ensure_cmd_or_install_package_yum(){ function ensure_cmd_or_install_package_yum(){
@ -155,7 +155,7 @@ END_OF_JCLOUDS_FILE
function installOpenJDK() { function installOpenJDK() {
if hash apt-get 2>/dev/null; then if hash apt-get 2>/dev/null; then
export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk} export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-6-openjdk}
test -d $JAVA_HOME || apt-get-install openjdk-6-jdk || ( apt-get-update && apt-get-install openjdk-6-jdk ) test -d $JAVA_HOME || ( apt-get-update && apt-get-install openjdk-6-jdk )
elif hash yum 2>/dev/null; then elif hash yum 2>/dev/null; then
export pkg=java-1.6.0-openjdk-devel export pkg=java-1.6.0-openjdk-devel
yum --nogpgcheck -y install $pkg && yum --nogpgcheck -y install $pkg &&