diff options
author | Yann E. MORIN <yann.morin.1998@free.fr> | 2014-08-03 19:53:40 +0200 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2014-08-04 20:12:25 +0200 |
commit | 5b3880e174983caa8410a3678975bb7233f33d36 (patch) | |
tree | 2d1339271db2c7fa3e264468ea46463496606388 /support/download | |
parent | 93e678b767a6c2645cd789b8f2231938668ecc65 (diff) |
support/download: convert scp to use the wrapper
This drastically simplifies the scp 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 setting a primary site to 'scp://localhost:/tmp' and
running 'make vim-source')
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support/download')
-rwxr-xr-x | support/download/scp | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/support/download/scp b/support/download/scp index d3aad43f3..167692917 100755 --- a/support/download/scp +++ b/support/download/scp @@ -1,28 +1,16 @@ #!/bin/bash -# 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 scp -# Call it with: -# $1: URL -# $2: output file +# Download helper for scp, to be called from the download wrapper script +# Expected arguments: +# $1: output file +# $2: URL # And this environment: # SCP : the scp command to call -url="${1}" -output="${2}" -tmp_dl="$( mktemp "${BUILD_DIR}/.XXXXXX" )" -tmp_output="$( mktemp "${output}.XXXXXX" )" +output="${1}" +url="${2}" -ret=1 -if ${SCP} "${url}" "${tmp_dl}"; then - if mv "${tmp_dl}" "${tmp_output}"; then - mv "${tmp_output}" "${output}" - ret=0 - fi -fi - -# Cleanup -rm -f "${tmp_dl}" "${tmp_output}" -exit ${ret} +${SCP} "${url}" "${output}" |