tree.sh: add sha512 error for check_project_hashes

handle errors on sha512sum - also handle awk errors inside
the mini subshell, and provide overall error handling.

we know that the project.hash file should always exist, and
always be read no matter what; technically, the find command
that proceeds it might not yield any results, but an empty
file would then be produced.

the edge case of an empty file would have lead to an error
beforehand, when configuring the project in function,
configure_project(), so we've already got that covered.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2025-05-28 18:43:44 +01:00
parent 04bee3834d
commit b1ef562b76

View File

@@ -184,7 +184,8 @@ check_project_hashes()
-type f -not -path "*/.git*/*" | awk '{print $1}' > \
"$xbtmp/project.hash" || err "!h $project $tree"
pjhash="$(sha512sum "$xbtmp/project.hash" | awk '{print $1}')" || :
pjhash="$(x_ sha512sum "$xbtmp/project.hash" | awk '{print $1}' || \
err)" || err "pjhash: Can't read sha512 of '$xbtmp/project.hash'"
[ "$pjhash" != "$old_pjhash" ] && badhash="y"
[ -f "$XBMK_CACHE/hash/$project$tree" ] || badhash="y"