path: root/support
diff options
authorGravatar Yann E. MORIN <yann.morin.1998@free.fr>2014-12-11 23:52:06 +0100
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-12-11 23:58:44 +0100
commit2685937e06d6ede44b88b223e02b38b3ff66a53c (patch)
tree2d59bdec9e1e311d4057ad9fd54e0a2d867994ca /support
parent78b92e5055442e225b10ca6baf98f23a0fa8a102 (diff)
pkg-download: check for already downloaded file in the download wrapper
Instead of repeating the same test again and again in all our download rules, just delegate the check for an already downloaded file to the download wrapper. This clears up the path for doing the hash checks on a cached file before the download. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <jacmet@uclibc.org> Cc: Gustavo Zacarias <gustavo@zacarias.com.ar> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support')
1 files changed, 5 insertions, 0 deletions
diff --git a/support/download/dl-wrapper b/support/download/dl-wrapper
index f1bb73a808..dc5b4b08db 100755
--- a/support/download/dl-wrapper
+++ b/support/download/dl-wrapper
@@ -43,6 +43,11 @@ main() {
error "no output specified, use -o\n"
+ # If the output file already exists, do not download it again
+ if [ -e "${output}" ]; then
+ exit 0
+ fi
# tmpd is a temporary directory in which backends may store intermediate
# by-products of the download.
# tmpf is the file in which the backends should put the downloaded content.