path: root/support
diff options
authorGravatar Yann E. MORIN <yann.morin.1998@free.fr>2014-08-03 19:53:42 +0200
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-08-04 20:12:25 +0200
commit9a8470c9ee4dab3b872280656316c08a0d573d53 (patch)
tree9cb7fda1894eda17d311bba2fa62b7527b849710 /support
parenta92290aa20a446b3f01822f0637a2ef7a4846c0b (diff)
support/download: convert wget to use the wrapper
This drastically simplifies the wget helper, as it no longer has to deal with atomically saving the downloaded archive. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Tested-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> (Tested by running 'make busybox-source') Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support')
1 files changed, 8 insertions, 27 deletions
diff --git a/support/download/wget b/support/download/wget
index cbeca3b412..2cea1004c9 100755
--- a/support/download/wget
+++ b/support/download/wget
@@ -1,35 +1,16 @@
-# We want to catch any command failure, and exit immediately
+# We want to catch any unexpected failure, and exit immediately
set -e
-# Download helper for wget
-# Call it with:
-# $1: URL
-# $2: output file
+# Download helper for wget, to be called from the download wrapper script
+# Expected arguments:
+# $1: output file
+# $2: URL
# And this environment:
# WGET : the wget command to call
-# BUILD_DIR: path to Buildroot's build dir
-tmp_dl="$( mktemp "${BUILD_DIR}/.XXXXXX" )"
-tmp_output="$( mktemp "${output}.XXXXXX" )"
-# Play tic-tac-toe with temp files
-# - first, we download to a trashable location (the build-dir)
-# - then we copy to a temporary tarball in the final location, so it is
-# on the same filesystem as the final file
-# - finally, we atomically rename to the final file
-if ${WGET} -O "${tmp_dl}" "${url}"; then
- if mv "${tmp_dl}" "${tmp_output}"; then
- mv "${tmp_output}" "${output}"
- ret=0
- fi
-rm -f "${tmp_dl}" "${tmp_output}"
-exit ${ret}
+${WGET} -O "${output}" "${url}"