vendor.sh: condense fetch() a bit

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2024-06-28 23:10:22 +01:00
parent 85c2eb0f7c
commit f2d53eb842
+2 -4
View File
@@ -92,8 +92,7 @@ fetch()
[ "$5" = "/dev/null" ] && return 0 [ "$5" = "/dev/null" ] && return 0
[ "${5# }" = "$5" ] || $err "fetch: space not allowed in _dest: '$5'" [ "${5# }" = "$5" ] || $err "fetch: space not allowed in _dest: '$5'"
[ "${5#/}" = "$5" ] || $err "fetch: absolute path not allowed: '$5'" [ "${5#/}" = "$5" ] || $err "fetch: absolute path not allowed: '$5'"
_dest="${5##*../}" _dest="${5##*../}"; _dl="$vendir/cache/$dlsum"
_dl="$vendir/cache/$dlsum"
download "$dl" "$dl_bkup" "$_dl" "$dlsum" download "$dl" "$dl_bkup" "$_dl" "$dlsum"
@@ -102,8 +101,7 @@ fetch()
eval "extract_$dl_type" eval "extract_$dl_type"
set -u -e set -u -e
[ -f "$_dest" ] && return 0 e "$_dest" f missing && $err "!extract_$dl_type"; return 0
$err "extract_$dl_type (fetch): missing file: '$_dest'"
} }
mkdirs() mkdirs()