lib.sh: make build_sbase a macro

sh macros are cool

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-09-17 10:40:55 +01:00
parent 69875b8e10
commit e1c2525783
4 changed files with 6 additions and 9 deletions
+1 -1
View File
@@ -242,7 +242,7 @@ bad_checksum()
e "$2" f missing && \ e "$2" f missing && \
return 0 return 0
build_sbase eval "$build_sbase"
csum="$(x_ "$sha512sum" "$2" | awk '{print $1}')" || \ csum="$(x_ "$sha512sum" "$2" | awk '{print $1}')" || \
err "!sha512 '$2' $1" bad_checksum "$@" err "!sha512 '$2' $1" bad_checksum "$@"
+2 -2
View File
@@ -473,7 +473,7 @@ prep()
mksha512() mksha512()
{ {
build_sbase eval "$build_sbase"
[ "${1%/*}" != "$1" ] && \ [ "${1%/*}" != "$1" ] && \
x_ cd "${1%/*}" x_ cd "${1%/*}"
@@ -571,7 +571,7 @@ vfile()
# must be called from a subshell # must be called from a subshell
check_vendor_hashes() check_vendor_hashes()
{ {
build_sbase eval "$build_sbase"
x_ cd "$tmpromdir" x_ cd "$tmpromdir"
+2 -5
View File
@@ -8,6 +8,8 @@
cbfstool="elf/coreboot/default/cbfstool" cbfstool="elf/coreboot/default/cbfstool"
rmodtool="elf/coreboot/default/rmodtool" rmodtool="elf/coreboot/default/rmodtool"
build_sbase="[ ! -f \"\$sha512sum\" ] && x_ make -C util/sbase" # macro!
newvar() newvar()
{ {
printf "%s\n" "$*" | \ printf "%s\n" "$*" | \
@@ -112,11 +114,6 @@ unpad_one_byte()
x_ mv "$unpaddedfile" "$1" x_ mv "$unpaddedfile" "$1"
} }
build_sbase()
{
[ ! -f "$sha512sum" ] && x_ make -C "$xbmkpwd/util/sbase"; :
}
remkdir() remkdir()
{ {
x_ rm -Rf "$@" x_ rm -Rf "$@"
+1 -1
View File
@@ -392,7 +392,7 @@ project_up_to_date()
"$@" "$@"
fi fi
build_sbase eval "$build_sbase"
fx_ "x_ util/sbase/sha512sum" find "$@" -type f -not -path \ fx_ "x_ util/sbase/sha512sum" find "$@" -type f -not -path \
"*/.git*/*" | awk '{print $1}' > "$xbtmp/tmp.hash" || \ "*/.git*/*" | awk '{print $1}' > "$xbtmp/tmp.hash" || \
err "!h $project $hashdir" \ err "!h $project $hashdir" \