get.sh: rename try_file to try_fetch

the previous function name was misleading, because
this tries multiple methods including git and curl.

therefore, this was renamed to match what it dose.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2025-09-26 00:12:21 +01:00
parent e42cb4f4cd
commit b4fbdb448d
+4 -6
View File
@@ -117,7 +117,7 @@ xbget()
do do
if [ -z "$url" ]; then if [ -z "$url" ]; then
err "empty URL given in" "xbget" "$@" err "empty URL given in" "xbget" "$@"
elif ! try_file "$url" "$@"; then elif ! try_fetch "$url" "$@"; then
continue continue
fi fi
@@ -139,13 +139,11 @@ xbget()
err "failed to download file/repository" "xbget" "$@"; : err "failed to download file/repository" "xbget" "$@"; :
} }
# TODO: this function "try_file" actually handles git as well. # TODO: try_fetch is also a bit messy. those eval statements can
# the name is misleading. think of a better name instead.
# TODO: try_file is also a bit messy. those eval statements can
# be tidied up, or eval can be dropped entirely. # be tidied up, or eval can be dropped entirely.
# (it works much better than the old code, but it's over-engineered) # (it works much better than the old code, but it's over-engineered)
try_file() try_fetch()
{ {
cached="file/$6" cached="file/$6"
if [ "$2" = "git" ] if [ "$2" = "git" ]
@@ -187,7 +185,7 @@ try_file()
then then
if [ ! -d "$5" ]; then if [ ! -d "$5" ]; then
tmpclone "$cached" "$5" "$6" "$7" || \ tmpclone "$cached" "$5" "$6" "$7" || \
err "Can't clone final repo" "try_file" "$@"; : err "Can't clone final repo" "try_fetch" "$@"; :
fi fi
else else
if bad_checksum "$6" "$cached"; then if bad_checksum "$6" "$cached"; then