Permalink
Browse files

Tweak curl stuff further and add resume to all downloads where suppor…

…ted. Update readme
  • Loading branch information...
1 parent 2123b48 commit c676542a6fc7d877cd0c4460dd14191a094a3a91 @xdissent committed May 29, 2012
Showing with 28 additions and 12 deletions.
  1. +16 −1 README.rst
  2. +12 −11 ievms.sh
View
@@ -60,7 +60,7 @@ Recovering from a failed installation
-------------------------------------
Each version is installed into a subdirectory of ``~/.ievms/vhd/``. If the installation fails
-for any reason (lost Internet connection, for instance), delete the version-specific subdirectory
+for any reason (corrupted download, for instance), delete the version-specific subdirectory
and rerun the install.
If nothing else, you can delete ``~/.ievms`` and rerun the install.
@@ -74,6 +74,15 @@ To specify where the VMs are installed, use the INSTALL_PATH variable:
curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | INSTALL_PATH="/Path/to/.ievms" bash
+Passing additional options to curl
+----------------------------------
+
+The ``curl`` command is passed any options present in the ``CURL_OPTS``
+environment variable. For example, you can set a download speed limit:
+
+ curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | CURL_OPTS="--limit-rate 50k" bash
+
+
Features
========
@@ -91,6 +100,12 @@ Clean Snapshot
effectively allowing your VM to work indefinitely.
+Resuming Downloads
+ If one of the comically large files fails to download, the ``curl``
+ command used will automatically attempt to resume where it left off.
+ Thanks, rcmachado (https://github.com/rcmachado).
+
+
License
=======
View
@@ -6,7 +6,7 @@ set -o errtrace
set -o errexit
set -o pipefail
-CURL_EXTRA_OPTS="--limit-rate 50k"
+curl_opts=${CURL_OPTS:-""}
log() { printf "$*\n" ; return $? ; }
@@ -42,13 +42,10 @@ check_virtualbox() {
url="http://download.virtualbox.org/virtualbox/${short_version}/Oracle_VM_VirtualBox_Extension_Pack-${ext_version}.vbox-extpack"
archive="Oracle_VM_VirtualBox_Extension_Pack-${ext_version}.vbox-extpack"
- if [[ ! -f "${archive}" ]]
+ log "Downloading Oracle VM VirtualBox Extension Pack from ${url} to ${ievms_home}/${archive}"
+ if ! curl ${curl_opts} -C - -L "${url}" -o "${archive}"
then
- log "Downloading Oracle VM VirtualBox Extension Pack from ${url} to ${ievms_home}/${archive}"
- if ! curl -L "${url}" -o "${archive}"
- then
- fail "Failed to download ${url} to ${ievms_home}/${archive} using 'curl', error code ($?)"
- fi
+ fail "Failed to download ${url} to ${ievms_home}/${archive} using 'curl', error code ($?)"
fi
log "Installing Oracle VM VirtualBox Extension Pack from ${ievms_home}/${archive}"
@@ -71,7 +68,7 @@ download_unrar() {
archive="rar.tar.gz"
log "Downloading unrar from ${url} to ${ievms_home}/${archive}"
- if ! curl -L "${url}" -o "${archive}"
+ if ! curl ${curl_opts} -C - -L "${url}" -o "${archive}"
then
fail "Failed to download ${url} to ${ievms_home}/${archive} using 'curl', error code ($?)"
fi
@@ -131,13 +128,13 @@ build_ievm() {
do
archive=`basename $url`
log "Downloading VHD from ${url} to ${ievms_home}/"
- if ! curl $CURL_EXTRA_OPTS -C - -L -O "${url}"
+ if ! curl ${curl_opts} -C - -L -O "${url}"
then
fail "Failed to download ${url} to ${vhd_path}/ using 'curl', error code ($?)"
fi
done
- rm -f "${vhd_path}/*.vmc"
+ rm -f "${vhd_path}/"*.vmc
log "Extracting VHD from ${vhd_path}/${archive}"
if ! unrar e "${archive}"
@@ -202,7 +199,11 @@ download_driver() {
log $2
cd "${ievms_home}/drivers"
- curl -L -O $1
+ # Currently the IE6 driver download server doesn't support resume
+ if ! curl ${curl_opts} -L -O "$1"
+ then
+ fail "Failed to download $1 to ${ievms_home}/drivers/ using 'curl', error code ($?)"
+ fi
cd ..
}

0 comments on commit c676542

Please sign in to comment.