mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
scripts/get: fix logic error when download is successful, but checksum is invalid
A download might succeed from, say, github, but have an invalid checksum. In this case it would not attempt the alternative download from the mirror (which might have the correct checksum), but instead it would repeatedly download from github until the download limit is exceeded, and then fail completely.
This commit is contained in:
parent
13dabc00ea
commit
8f2e61c928
15
scripts/get
15
scripts/get
@ -73,15 +73,16 @@ rm -f $STAMP_URL $STAMP_SHA
|
||||
|
||||
NBWGET=10
|
||||
while [ $NBWGET -gt 0 ]; do
|
||||
rm -f $PACKAGE
|
||||
for url in "$PKG_URL" "$PACKAGE_MIRROR"; do
|
||||
rm -f $PACKAGE
|
||||
if $WGET_CMD "$url"; then
|
||||
CALC_SHA256="$(sha256sum $PACKAGE | cut -d" " -f1)"
|
||||
|
||||
if $WGET_CMD "$PKG_URL" || $WGET_CMD "$PACKAGE_MIRROR"; then
|
||||
CALC_SHA256="$(sha256sum $PACKAGE | cut -d" " -f1)"
|
||||
[ -z "${PKG_SHA256}" -o "${PKG_SHA256}" == "${CALC_SHA256}" ] && break 2
|
||||
|
||||
[ -z "${PKG_SHA256}" -o "${PKG_SHA256}" == "${CALC_SHA256}" ] && break
|
||||
|
||||
printf "%${BUILD_INDENT}c $(print_color CLR_WARNING "WARNING") Incorrect checksum calculated on downloaded file: got ${CALC_SHA256}, wanted ${PKG_SHA256}\n\n" ' '>&$SILENT_OUT
|
||||
fi
|
||||
printf "%${BUILD_INDENT}c $(print_color CLR_WARNING "WARNING") Incorrect checksum calculated on downloaded file: got ${CALC_SHA256}, wanted ${PKG_SHA256}\n\n" ' '>&$SILENT_OUT
|
||||
fi
|
||||
done
|
||||
NBWGET=$((NBWGET - 1))
|
||||
done
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user