mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 13:46:32 +00:00
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>
This commit is contained in:
parent
93e678b767
commit
5b3880e174
@ -168,8 +168,9 @@ endef
|
|||||||
# to prepend the path with a slash: scp://[user@]host:/absolutepath
|
# to prepend the path with a slash: scp://[user@]host:/absolutepath
|
||||||
define DOWNLOAD_SCP
|
define DOWNLOAD_SCP
|
||||||
test -e $(DL_DIR)/$(2) || \
|
test -e $(DL_DIR)/$(2) || \
|
||||||
$(EXTRA_ENV) support/download/scp '$(call stripurischeme,$(call qstrip,$(1)))' \
|
$(EXTRA_ENV) support/download/wrapper scp \
|
||||||
$(DL_DIR)/$(2) && \
|
$(DL_DIR)/$(2) \
|
||||||
|
'$(call stripurischeme,$(call qstrip,$(1)))' && \
|
||||||
$(call VERIFY_HASH,$(PKGDIR)/$($(PKG)_NAME).hash,$(DL_DIR)/$(2))
|
$(call VERIFY_HASH,$(PKGDIR)/$($(PKG)_NAME).hash,$(DL_DIR)/$(2))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
@ -1,28 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# We want to catch any command failure, and exit immediately
|
# We want to catch any unexpected failure, and exit immediately
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Download helper for scp
|
# Download helper for scp, to be called from the download wrapper script
|
||||||
# Call it with:
|
# Expected arguments:
|
||||||
# $1: URL
|
# $1: output file
|
||||||
# $2: output file
|
# $2: URL
|
||||||
# And this environment:
|
# And this environment:
|
||||||
# SCP : the scp command to call
|
# SCP : the scp command to call
|
||||||
|
|
||||||
url="${1}"
|
output="${1}"
|
||||||
output="${2}"
|
url="${2}"
|
||||||
tmp_dl="$( mktemp "${BUILD_DIR}/.XXXXXX" )"
|
|
||||||
tmp_output="$( mktemp "${output}.XXXXXX" )"
|
|
||||||
|
|
||||||
ret=1
|
${SCP} "${url}" "${output}"
|
||||||
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}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user