diff options
author | Leah Rowe <leah@libreboot.org> | 2025-09-13 13:27:47 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-09-13 13:27:47 +0100 |
commit | 995963baf4267e2d6221a5efc210130cfb1c64b7 (patch) | |
tree | 0af89063cf01b59dba4e0968d7de19ca7644df72 /include/get.sh | |
parent | 7bed68f5b7096349bc8a6f48d2f4394db7a581af (diff) |
xbmk: much more verbose error messages
use the new functionality in err(), whereby a given
function name and arguments can be provided, for
debugging purposes.
something similar was already done in a few places,
and replaced with this unified functionality.
this patch will make xbmk much easier to debug, under
fault conditions.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/get.sh')
-rw-r--r-- | include/get.sh | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/include/get.sh b/include/get.sh index bee00fe1..6e2e9f8f 100644 --- a/include/get.sh +++ b/include/get.sh @@ -63,7 +63,8 @@ fetch_submodule() eval "$_seval; then st=\"\$st \$xt\"; fi" done - st="${st# }" && [ "$st" = "git curl" ] && err "$mdir: git+curl defined" + st="${st# }" && [ "$st" = "git curl" ] && \ + err "$mdir: git+curl defined" fetch_submodule "$@" [ -z "$st" ] && return 0 # subgit/subcurl not defined chkvars "sub${st}" "sub${st}_bkup" "subhash" @@ -75,7 +76,7 @@ fetch_submodule() xbget() { [ "$1" = "curl" ] || [ "$1" = "copy" ] || [ "$1" = "git" ] || \ - err "Bad dlop (arg 1): xbget $*" + err "Bad dlop (arg 1)" xbget "$@" for url in "$2" "$3"; do [ -n "$url" ] || err "empty URL given in: xbget $*" @@ -86,7 +87,7 @@ xbget() esac return 0 # successful download/copy done - err "$1 $2 $3 $4: not downloaded"; : + err "failed to download file/repository" xbget "$@"; : } try_file() @@ -108,7 +109,7 @@ try_file() if [ "$2" = "git" ]; then [ -d "$5" ] || tmpclone "$cached" "$5" "$6" "$7" || \ - err "Can't clone final repo in command: try_file $*"; : + err "Can't clone final repo" try_file "$@"; : else bad_checksum "$6" "$cached" && x_ rm -f "$cached" && return 1 [ "$cached" != "$5" ] && x_ cp "$cached" "$5" @@ -133,7 +134,8 @@ try_copy() try_git() { - gitdest="$(findpath "$1" || err "Can't get readpath for '$1'")" || err + gitdest="$(findpath "$1" || err "Can't get findpath for '$1'")" || \ + err "failed findpath for '$1'" try_get "$@" x_ rm -Rf "$tmpgitcache" [ -d "$gitdest" ] || ( x_ git clone "$2" "$tmpgitcache" ) || return 1 @@ -150,7 +152,8 @@ try_git() bad_checksum() { e "$2" f missing && return 0 - csum="$(x_ sha512sum "$2" | awk '{print $1}')" || err "!sha512 '$2' $1" + csum="$(x_ sha512sum "$2" | awk '{print $1}')" || \ + err "!sha512 '$2' $1" bad_checksum "$@" [ "$csum" = "$1" ] && return 1; x_ rm -f "$2" printf "BAD SHA512 %s, '%s'; need '%s'\n" "$csum" "$2" "$1" 1>&2 } |