summaryrefslogtreecommitdiff
path: root/script/update/blobs/download
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-09-29 03:20:02 +0100
committerLeah Rowe <leah@libreboot.org>2023-09-29 04:03:18 +0100
commit0bb3c596201a42ccee03d6d2b8513b42f850031e (patch)
tree0142462ef7dc99977bfe51fcf5d5f9501d87dddd /script/update/blobs/download
parent5d934be7b0119426aaad1533921b75f8618d6d79 (diff)
update/blobs/*: unified download/checksum logic
Use the same logic between blobs/download and blobs/mrc. The logic is taken from blobs/download. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'script/update/blobs/download')
-rwxr-xr-xscript/update/blobs/download51
1 files changed, 9 insertions, 42 deletions
diff --git a/script/update/blobs/download b/script/update/blobs/download
index fa239e65..e4c7b214 100755
--- a/script/update/blobs/download
+++ b/script/update/blobs/download
@@ -7,6 +7,7 @@
. "include/err.sh"
. "include/defconfig.sh"
. "include/blobutil.sh"
+. "include/fetch.sh"
main()
{
@@ -66,58 +67,24 @@ build_dependencies()
download_blobs()
{
[ -z "${CONFIG_HAVE_ME_BIN}" ] || \
- fetch "intel_me" "${DL_url}" "${DL_url_bkup}" "${DL_hash}"
+ fetch "intel_me" "${DL_url}" "${DL_url_bkup}" "${DL_hash}" \
+ "${blobdir}/cache/${DL_hash}" "err"
[ -z "${CONFIG_INCLUDE_SMSC_SCH5545_EC_FW}" ] || \
fetch "sch5545ec" "${SCH5545EC_DL_url}" \
- "${SCH5545EC_DL_url_bkup}" "${SCH5545EC_DL_hash}"
+ "${SCH5545EC_DL_url_bkup}" "${SCH5545EC_DL_hash}" \
+ "${blobdir}/cache/${SCH5545EC_DL_hash}" "err"
[ -z "${CONFIG_KBC1126_FIRMWARE}" ] || \
- fetch "kbc1126ec" "${EC_url}" "${EC_url_bkup}" "${EC_hash}"
+ fetch "kbc1126ec" "${EC_url}" "${EC_url_bkup}" "${EC_hash}" \
+ "${blobdir}/cache/${EC_hash}" "err"
[ -z "${CONFIG_VGA_BIOS_FILE}" ] || \
fetch "e6400vga" "${E6400_VGA_DL_url}" \
- "${E6400_VGA_DL_url_bkup}" "${E6400_VGA_DL_hash}"
+ "${E6400_VGA_DL_url_bkup}" "${E6400_VGA_DL_hash}" \
+ "${blobdir}/cache/${E6400_VGA_DL_hash}" "err"
if [ ! -z "${CONFIG_HAVE_MRC}" ]; then
./update blobs mrc || err "download_blobs ${board}: !mrc"
fi
}
-fetch()
-{
- dl_type="${1}"
- dl="${2}"
- dl_bkup="${3}"
- dlsum="${4}"
-
- dl_path="${blobdir}/cache/${dlsum}"
- mkdir -p "${blobdir}/cache" || err "fetch: !mkdir ${blobdir}/cache"
-
- dl_fail="y"
- vendor_checksum "${dlsum}" && dl_fail="n"
- for x in "${dl}" "${dl_bkup}"; do
- [ "${dl_fail}" = "n" ] && break
- [ -z "${x}" ] && continue
- rm -f "${dl_path}" || err "fetch: !rm -f ${dl_path}"
- wget --tries 3 -U "${agent}" "${x}" -O "${dl_path}" || continue
- vendor_checksum "${dlsum}" && dl_fail="n"
- done
- if [ "${dl_fail}" = "y" ]; then
- printf "ERROR: invalid vendor updates for: %s\n" "${board}" 1>&2
- err "fetch ${dlsum}: matched vendor update unavailable"
- fi
-
- eval "extract_${dl_type}"
-}
-
-vendor_checksum()
-{
- if [ ! -f "${dl_path}" ]; then
- printf "Vendor update not found for: %s\n" "${board}" 1>&2
- return 1
- elif [ "$(sha512sum ${dl_path} | awk '{print $1}')" != "${1}" ]; then
- printf "Bad checksum on vendor update for: %s\n" "${board}" 1>&2
- return 1
- fi
-}
-
extract_intel_me()
{
_me_destination=${CONFIG_ME_BIN_PATH#../../}