mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-27 13:16:35 +00:00
support/download: keep files downloaded without hash
In the situation where the hash is missing from the hash file, the dl-wrapper downloads the file again and again until the developer specifies the hash to complete the download step. To avoid this situation, the freshly-downloaded file is not removed anymore after a successful download. After this change, the behaviour is as follows: - Hash file doesn't exist, or file is in BR_NO_CHECK_HASH_FOR => always succeeds. - Hash file exists, but file is not present => file is NOT removed, build is terminated immediately (i.e. secondary site is not tried). - Hash file exists, file is present, but hash mismatch => file is removed, secondary site is tried. => If all primary/secondary site downloads or hash checks fail, the build is terminated. Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com> [Arnout: extend commit log] Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
This commit is contained in:
parent
29b7cc88f4
commit
cf9bf7d28b
@ -21,7 +21,7 @@ set -e
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
local OPT OPTARG
|
local OPT OPTARG
|
||||||
local backend output hfile recurse quiet
|
local backend output hfile recurse quiet rc
|
||||||
|
|
||||||
# Parse our options; anything after '--' is for the backend
|
# Parse our options; anything after '--' is for the backend
|
||||||
while getopts :hb:o:H:rq OPT; do
|
while getopts :hb:o:H:rq OPT; do
|
||||||
@ -93,11 +93,18 @@ main() {
|
|||||||
|
|
||||||
# Check if the downloaded file is sane, and matches the stored hashes
|
# Check if the downloaded file is sane, and matches the stored hashes
|
||||||
# for that file
|
# for that file
|
||||||
if ! support/download/check-hash ${quiet} "${hfile}" "${tmpf}" "${output##*/}"; then
|
if support/download/check-hash ${quiet} "${hfile}" "${tmpf}" "${output##*/}"; then
|
||||||
|
rc=0
|
||||||
|
else
|
||||||
|
if [ ${?} -ne 3 ]; then
|
||||||
rm -rf "${tmpd}"
|
rm -rf "${tmpd}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# the hash file exists and there was no hash to check the file against
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
|
||||||
# tmp_output is in the same directory as the final output, so we can
|
# tmp_output is in the same directory as the final output, so we can
|
||||||
# later move it atomically.
|
# later move it atomically.
|
||||||
tmp_output="$(mktemp "${output}.XXXXXX")"
|
tmp_output="$(mktemp "${output}.XXXXXX")"
|
||||||
@ -141,6 +148,8 @@ main() {
|
|||||||
rm -f "${tmp_output}"
|
rm -f "${tmp_output}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
return ${rc}
|
||||||
}
|
}
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user