diff options
author | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2012-12-05 10:02:08 +0000 |
---|---|---|
committer | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2012-12-05 10:02:08 +0000 |
commit | d14f46b629d5f83c41987132d9160a5abbf39446 (patch) | |
tree | f3a3dd60774ba51c332002044e1ee3bc397b6272 | |
parent | ca8c6d3395b4a4f1ef5903ded348e65b160a8446 (diff) | |
download | genivi-initial-setup-d14f46b629d5f83c41987132d9160a5abbf39446.tar.gz |
Use curl in create-vm if wget isn't found
-rwxr-xr-x | create-vm | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -27,6 +27,27 @@ if [ -e "$VM_NAME.vdi" ]; then exit 1 fi +# Ensure curl or wget is installed + +if ! which wget >/dev/null; then + if which curl >/dev/null; then + # Fall back to curl if no wget + USE_CURL=true + else + # If neither, try to install curl + if which yum >/dev/null; then + echo "Attempting to install curl using yum" + sudo yum install curl + elif which apt-get >/dev/null; then + echo "Attempting to install curl using apt-get" + sudo apt-get install curl + else + echo "I do not know how to install curl on this system. Please install curl or wget manually" + exit 1 + fi + fi +fi + # Ensuring VirtualBox is installed if which VBoxManage >/dev/null; then echo "VirtualBox is installed" @@ -49,7 +70,13 @@ mkdir -p "$INSTALL_DIRECTORY" cd "$INSTALL_DIRECTORY" # Download and extract the water-bomb .img file -wget --no-clobber "http://download.baserock.org/baserock/$DEVEL_IMAGE_NAME.img.gz" +if [ -z "$USE_CURL" ]; then + wget --no-clobber "http://download.baserock.org/baserock/$DEVEL_IMAGE_NAME.img.gz" +else + if ! [ -e "$DEVEL_IMAGE_NAME.img.gz" ]; then + curl -O "http://download.baserock.org/baserock/$DEVEL_IMAGE_NAME.img.gz" + fi +fi if [ -e $DEVEL_IMAGE_NAME.img ]; then echo "Development image has already been decompressed" |