summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2012-12-05 10:02:08 +0000
committerJonathan Maw <jonathan.maw@codethink.co.uk>2012-12-05 10:02:08 +0000
commitd14f46b629d5f83c41987132d9160a5abbf39446 (patch)
treef3a3dd60774ba51c332002044e1ee3bc397b6272
parentca8c6d3395b4a4f1ef5903ded348e65b160a8446 (diff)
downloadgenivi-initial-setup-d14f46b629d5f83c41987132d9160a5abbf39446.tar.gz
Use curl in create-vm if wget isn't found
-rwxr-xr-xcreate-vm29
1 files changed, 28 insertions, 1 deletions
diff --git a/create-vm b/create-vm
index f2cdaf3..1b36db1 100755
--- a/create-vm
+++ b/create-vm
@@ -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"