get.sh: Properly error out if tmpclone fails

We rely on a non-zero exit on other try_ commands, which
works fine there because we then check the file afterward
and error out accordingly.

For git repositories, we assume that both mirrors are
identical and therefore once we get to the first clone
attempt, we assume that it must succeed.

Therefore, if it does not succeed, we must fail. This fixes
a regression I found in testing, where sometimes a failed
patching attempt would not result in an error exit, and
would therefore result in broken sources being present.

In practise, I always very closely watch the terminal when
testing xbmk, especially when updating project patches, so
we probably didn't introduce any broken sources in practice.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2025-05-25 14:46:33 +01:00
parent ad333ae248
commit 2493203ee5
+2 -1
View File
@@ -111,7 +111,8 @@ try_file()
eval "[ -$echk \"$cached\" ] || return 1"
if [ "$2" = "git" ]; then
[ -d "$5" ] || tmpclone "$cached" "$5" "$6" "$7" || return 1
[ -d "$5" ] || tmpclone "$cached" "$5" "$6" "$7" || \
err "Can't clone final repo in command: try_file $*"; :
else
bad_checksum "$6" "$cached" && x_ rm -f "$cached" && return 1
[ "$cached" != "$5" ] && x_ cp "$cached" "$5"